1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
6 #include "org_ldk_impl_bindings.h"
12 #define LIKELY(v) __builtin_expect(!!(v), 1)
13 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
15 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
16 #define MALLOC(a, _) malloc(a)
17 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
18 #define CHECK_ACCESS(p)
19 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
20 #define DO_ASSERT(a) (void)(a)
23 static jmethodID ordinal_meth = NULL;
24 static jmethodID slicedef_meth = NULL;
25 static jclass slicedef_cls = NULL;
26 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
27 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
28 CHECK(ordinal_meth != NULL);
29 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
30 CHECK(slicedef_meth != NULL);
31 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
32 CHECK(slicedef_cls != NULL);
35 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
38 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
41 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
44 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
45 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
46 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
49 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
50 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
51 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
52 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
55 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
56 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
57 vec->datalen = (*env)->GetArrayLength(env, bytes);
58 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
59 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
62 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
63 LDKTransaction *txdata = (LDKTransaction*)ptr;
65 slice.data = txdata->data;
66 slice.datalen = txdata->datalen;
67 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
69 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
70 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
71 txdata->datalen = (*env)->GetArrayLength(env, bytes);
72 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
73 txdata->data_is_owned = false;
74 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
75 return (uint64_t)txdata;
77 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
78 LDKTransaction *tx = (LDKTransaction*)ptr;
79 tx->data_is_owned = true;
80 Transaction_free(*tx);
83 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
84 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
85 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
86 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
87 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
88 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
89 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
90 return (uint64_t)vec->datalen;
92 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
93 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
94 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
96 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
97 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
98 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
101 return (uint64_t)vec;
104 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
105 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
106 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
109 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
110 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
111 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
113 typedef jlongArray int64_tArray;
114 typedef jbyteArray int8_tArray;
116 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
117 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
118 char* conv_buf = MALLOC(len + 1, "str conv buf");
119 memcpy(conv_buf, chars, len);
121 jstring ret = (*env)->NewStringUTF(env, conv_buf);
125 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
126 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
127 char* newchars = MALLOC(str_len + 1, "String chars");
128 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
129 memcpy(newchars, jchars, str_len);
130 newchars[str_len] = 0;
131 (*env)->ReleaseStringUTFChars(env, str, jchars);
135 .chars_is_owned = true
140 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
141 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
143 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
144 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
147 static jclass arr_of_B_clz = NULL;
148 static jclass arr_of_J_clz = NULL;
149 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
150 arr_of_B_clz = (*env)->FindClass(env, "[B");
151 CHECK(arr_of_B_clz != NULL);
152 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
153 arr_of_J_clz = (*env)->FindClass(env, "[J");
154 CHECK(arr_of_J_clz != NULL);
155 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
157 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
158 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
159 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
160 if (UNLIKELY((*env)->ExceptionCheck(env))) {
161 (*env)->ExceptionDescribe(env);
162 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
165 case 0: return LDKAccessError_UnknownChain;
166 case 1: return LDKAccessError_UnknownTx;
168 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
169 abort(); // Unreachable, but will let the compiler know we don't return here
171 static jclass AccessError_class = NULL;
172 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
173 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
174 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
175 AccessError_class = (*env)->NewGlobalRef(env, clz);
176 CHECK(AccessError_class != NULL);
177 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
178 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
179 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
180 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
182 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
184 case LDKAccessError_UnknownChain:
185 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
186 case LDKAccessError_UnknownTx:
187 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
192 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
193 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
194 if (UNLIKELY((*env)->ExceptionCheck(env))) {
195 (*env)->ExceptionDescribe(env);
196 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
199 case 0: return LDKCOption_NoneZ_Some;
200 case 1: return LDKCOption_NoneZ_None;
202 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
203 abort(); // Unreachable, but will let the compiler know we don't return here
205 static jclass COption_NoneZ_class = NULL;
206 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
207 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
208 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
209 COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
210 CHECK(COption_NoneZ_class != NULL);
211 COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
212 CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
213 COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
214 CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
216 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
218 case LDKCOption_NoneZ_Some:
219 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
220 case LDKCOption_NoneZ_None:
221 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
226 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
227 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
228 if (UNLIKELY((*env)->ExceptionCheck(env))) {
229 (*env)->ExceptionDescribe(env);
230 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
233 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
234 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
236 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
237 abort(); // Unreachable, but will let the compiler know we don't return here
239 static jclass ChannelMonitorUpdateErr_class = NULL;
240 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
241 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
242 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
243 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
244 CHECK(ChannelMonitorUpdateErr_class != NULL);
245 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
246 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
247 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
248 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
250 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
252 case LDKChannelMonitorUpdateErr_TemporaryFailure:
253 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
254 case LDKChannelMonitorUpdateErr_PermanentFailure:
255 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
260 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
261 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
262 if (UNLIKELY((*env)->ExceptionCheck(env))) {
263 (*env)->ExceptionDescribe(env);
264 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
267 case 0: return LDKConfirmationTarget_Background;
268 case 1: return LDKConfirmationTarget_Normal;
269 case 2: return LDKConfirmationTarget_HighPriority;
271 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
272 abort(); // Unreachable, but will let the compiler know we don't return here
274 static jclass ConfirmationTarget_class = NULL;
275 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
276 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
277 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
278 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
279 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
280 CHECK(ConfirmationTarget_class != NULL);
281 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
282 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
283 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
284 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
285 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
286 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
288 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
290 case LDKConfirmationTarget_Background:
291 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
292 case LDKConfirmationTarget_Normal:
293 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
294 case LDKConfirmationTarget_HighPriority:
295 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
300 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
301 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
302 if (UNLIKELY((*env)->ExceptionCheck(env))) {
303 (*env)->ExceptionDescribe(env);
304 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
307 case 0: return LDKCreationError_DescriptionTooLong;
308 case 1: return LDKCreationError_RouteTooLong;
309 case 2: return LDKCreationError_TimestampOutOfBounds;
310 case 3: return LDKCreationError_InvalidAmount;
311 case 4: return LDKCreationError_MissingRouteHints;
313 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
314 abort(); // Unreachable, but will let the compiler know we don't return here
316 static jclass CreationError_class = NULL;
317 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
318 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
319 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
320 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
321 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
322 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
323 CreationError_class = (*env)->NewGlobalRef(env, clz);
324 CHECK(CreationError_class != NULL);
325 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
326 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
327 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
328 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
329 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
331 CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
333 CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
334 CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
336 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
338 case LDKCreationError_DescriptionTooLong:
339 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
340 case LDKCreationError_RouteTooLong:
341 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
342 case LDKCreationError_TimestampOutOfBounds:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
344 case LDKCreationError_InvalidAmount:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
346 case LDKCreationError_MissingRouteHints:
347 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
352 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
353 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
354 if (UNLIKELY((*env)->ExceptionCheck(env))) {
355 (*env)->ExceptionDescribe(env);
356 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
359 case 0: return LDKCurrency_Bitcoin;
360 case 1: return LDKCurrency_BitcoinTestnet;
361 case 2: return LDKCurrency_Regtest;
362 case 3: return LDKCurrency_Simnet;
363 case 4: return LDKCurrency_Signet;
365 (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
366 abort(); // Unreachable, but will let the compiler know we don't return here
368 static jclass Currency_class = NULL;
369 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
370 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
371 static jfieldID Currency_LDKCurrency_Regtest = NULL;
372 static jfieldID Currency_LDKCurrency_Simnet = NULL;
373 static jfieldID Currency_LDKCurrency_Signet = NULL;
374 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
375 Currency_class = (*env)->NewGlobalRef(env, clz);
376 CHECK(Currency_class != NULL);
377 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
378 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
379 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
380 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
381 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
382 CHECK(Currency_LDKCurrency_Regtest != NULL);
383 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
384 CHECK(Currency_LDKCurrency_Simnet != NULL);
385 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
386 CHECK(Currency_LDKCurrency_Signet != NULL);
388 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
390 case LDKCurrency_Bitcoin:
391 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
392 case LDKCurrency_BitcoinTestnet:
393 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
394 case LDKCurrency_Regtest:
395 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
396 case LDKCurrency_Simnet:
397 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
398 case LDKCurrency_Signet:
399 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
404 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
405 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
406 if (UNLIKELY((*env)->ExceptionCheck(env))) {
407 (*env)->ExceptionDescribe(env);
408 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
411 case 0: return LDKIOError_NotFound;
412 case 1: return LDKIOError_PermissionDenied;
413 case 2: return LDKIOError_ConnectionRefused;
414 case 3: return LDKIOError_ConnectionReset;
415 case 4: return LDKIOError_ConnectionAborted;
416 case 5: return LDKIOError_NotConnected;
417 case 6: return LDKIOError_AddrInUse;
418 case 7: return LDKIOError_AddrNotAvailable;
419 case 8: return LDKIOError_BrokenPipe;
420 case 9: return LDKIOError_AlreadyExists;
421 case 10: return LDKIOError_WouldBlock;
422 case 11: return LDKIOError_InvalidInput;
423 case 12: return LDKIOError_InvalidData;
424 case 13: return LDKIOError_TimedOut;
425 case 14: return LDKIOError_WriteZero;
426 case 15: return LDKIOError_Interrupted;
427 case 16: return LDKIOError_Other;
428 case 17: return LDKIOError_UnexpectedEof;
430 (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
431 abort(); // Unreachable, but will let the compiler know we don't return here
433 static jclass IOError_class = NULL;
434 static jfieldID IOError_LDKIOError_NotFound = NULL;
435 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
436 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
437 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
438 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
439 static jfieldID IOError_LDKIOError_NotConnected = NULL;
440 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
441 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
442 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
443 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
444 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
445 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
446 static jfieldID IOError_LDKIOError_InvalidData = NULL;
447 static jfieldID IOError_LDKIOError_TimedOut = NULL;
448 static jfieldID IOError_LDKIOError_WriteZero = NULL;
449 static jfieldID IOError_LDKIOError_Interrupted = NULL;
450 static jfieldID IOError_LDKIOError_Other = NULL;
451 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
452 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
453 IOError_class = (*env)->NewGlobalRef(env, clz);
454 CHECK(IOError_class != NULL);
455 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
456 CHECK(IOError_LDKIOError_NotFound != NULL);
457 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
458 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
459 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
460 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
461 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
462 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
463 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
464 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
465 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
466 CHECK(IOError_LDKIOError_NotConnected != NULL);
467 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
468 CHECK(IOError_LDKIOError_AddrInUse != NULL);
469 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
470 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
471 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
472 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
473 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
474 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
475 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
476 CHECK(IOError_LDKIOError_WouldBlock != NULL);
477 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
478 CHECK(IOError_LDKIOError_InvalidInput != NULL);
479 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
480 CHECK(IOError_LDKIOError_InvalidData != NULL);
481 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
482 CHECK(IOError_LDKIOError_TimedOut != NULL);
483 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
484 CHECK(IOError_LDKIOError_WriteZero != NULL);
485 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
486 CHECK(IOError_LDKIOError_Interrupted != NULL);
487 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
488 CHECK(IOError_LDKIOError_Other != NULL);
489 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
490 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
492 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
494 case LDKIOError_NotFound:
495 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
496 case LDKIOError_PermissionDenied:
497 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
498 case LDKIOError_ConnectionRefused:
499 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
500 case LDKIOError_ConnectionReset:
501 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
502 case LDKIOError_ConnectionAborted:
503 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
504 case LDKIOError_NotConnected:
505 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
506 case LDKIOError_AddrInUse:
507 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
508 case LDKIOError_AddrNotAvailable:
509 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
510 case LDKIOError_BrokenPipe:
511 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
512 case LDKIOError_AlreadyExists:
513 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
514 case LDKIOError_WouldBlock:
515 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
516 case LDKIOError_InvalidInput:
517 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
518 case LDKIOError_InvalidData:
519 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
520 case LDKIOError_TimedOut:
521 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
522 case LDKIOError_WriteZero:
523 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
524 case LDKIOError_Interrupted:
525 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
526 case LDKIOError_Other:
527 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
528 case LDKIOError_UnexpectedEof:
529 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
534 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
535 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
536 if (UNLIKELY((*env)->ExceptionCheck(env))) {
537 (*env)->ExceptionDescribe(env);
538 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
541 case 0: return LDKLevel_Gossip;
542 case 1: return LDKLevel_Trace;
543 case 2: return LDKLevel_Debug;
544 case 3: return LDKLevel_Info;
545 case 4: return LDKLevel_Warn;
546 case 5: return LDKLevel_Error;
548 (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
549 abort(); // Unreachable, but will let the compiler know we don't return here
551 static jclass Level_class = NULL;
552 static jfieldID Level_LDKLevel_Gossip = NULL;
553 static jfieldID Level_LDKLevel_Trace = NULL;
554 static jfieldID Level_LDKLevel_Debug = NULL;
555 static jfieldID Level_LDKLevel_Info = NULL;
556 static jfieldID Level_LDKLevel_Warn = NULL;
557 static jfieldID Level_LDKLevel_Error = NULL;
558 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
559 Level_class = (*env)->NewGlobalRef(env, clz);
560 CHECK(Level_class != NULL);
561 Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
562 CHECK(Level_LDKLevel_Gossip != NULL);
563 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
564 CHECK(Level_LDKLevel_Trace != NULL);
565 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
566 CHECK(Level_LDKLevel_Debug != NULL);
567 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
568 CHECK(Level_LDKLevel_Info != NULL);
569 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
570 CHECK(Level_LDKLevel_Warn != NULL);
571 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
572 CHECK(Level_LDKLevel_Error != NULL);
574 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
576 case LDKLevel_Gossip:
577 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
579 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
581 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
583 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
585 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
587 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
592 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
593 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
594 if (UNLIKELY((*env)->ExceptionCheck(env))) {
595 (*env)->ExceptionDescribe(env);
596 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
599 case 0: return LDKNetwork_Bitcoin;
600 case 1: return LDKNetwork_Testnet;
601 case 2: return LDKNetwork_Regtest;
602 case 3: return LDKNetwork_Signet;
604 (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
605 abort(); // Unreachable, but will let the compiler know we don't return here
607 static jclass Network_class = NULL;
608 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
609 static jfieldID Network_LDKNetwork_Testnet = NULL;
610 static jfieldID Network_LDKNetwork_Regtest = NULL;
611 static jfieldID Network_LDKNetwork_Signet = NULL;
612 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
613 Network_class = (*env)->NewGlobalRef(env, clz);
614 CHECK(Network_class != NULL);
615 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
616 CHECK(Network_LDKNetwork_Bitcoin != NULL);
617 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
618 CHECK(Network_LDKNetwork_Testnet != NULL);
619 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
620 CHECK(Network_LDKNetwork_Regtest != NULL);
621 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
622 CHECK(Network_LDKNetwork_Signet != NULL);
624 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
626 case LDKNetwork_Bitcoin:
627 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
628 case LDKNetwork_Testnet:
629 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
630 case LDKNetwork_Regtest:
631 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
632 case LDKNetwork_Signet:
633 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
638 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
639 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
640 if (UNLIKELY((*env)->ExceptionCheck(env))) {
641 (*env)->ExceptionDescribe(env);
642 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
645 case 0: return LDKRecipient_Node;
646 case 1: return LDKRecipient_PhantomNode;
648 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
649 abort(); // Unreachable, but will let the compiler know we don't return here
651 static jclass Recipient_class = NULL;
652 static jfieldID Recipient_LDKRecipient_Node = NULL;
653 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
654 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
655 Recipient_class = (*env)->NewGlobalRef(env, clz);
656 CHECK(Recipient_class != NULL);
657 Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
658 CHECK(Recipient_LDKRecipient_Node != NULL);
659 Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
660 CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
662 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
664 case LDKRecipient_Node:
665 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
666 case LDKRecipient_PhantomNode:
667 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
672 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
673 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
674 if (UNLIKELY((*env)->ExceptionCheck(env))) {
675 (*env)->ExceptionDescribe(env);
676 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
679 case 0: return LDKSecp256k1Error_IncorrectSignature;
680 case 1: return LDKSecp256k1Error_InvalidMessage;
681 case 2: return LDKSecp256k1Error_InvalidPublicKey;
682 case 3: return LDKSecp256k1Error_InvalidSignature;
683 case 4: return LDKSecp256k1Error_InvalidSecretKey;
684 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
685 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
686 case 7: return LDKSecp256k1Error_InvalidTweak;
687 case 8: return LDKSecp256k1Error_NotEnoughMemory;
688 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
689 case 10: return LDKSecp256k1Error_InvalidParityValue;
691 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
692 abort(); // Unreachable, but will let the compiler know we don't return here
694 static jclass Secp256k1Error_class = NULL;
695 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
696 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
697 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
698 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
699 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
700 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
701 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
702 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
703 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
704 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
705 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
706 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
707 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
708 CHECK(Secp256k1Error_class != NULL);
709 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
710 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
711 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
712 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
713 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
714 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
715 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
716 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
717 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
718 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
719 Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
720 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
721 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
722 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
723 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
724 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
725 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
726 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
727 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
728 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
729 Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
730 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
732 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
734 case LDKSecp256k1Error_IncorrectSignature:
735 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
736 case LDKSecp256k1Error_InvalidMessage:
737 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
738 case LDKSecp256k1Error_InvalidPublicKey:
739 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
740 case LDKSecp256k1Error_InvalidSignature:
741 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
742 case LDKSecp256k1Error_InvalidSecretKey:
743 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
744 case LDKSecp256k1Error_InvalidSharedSecret:
745 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
746 case LDKSecp256k1Error_InvalidRecoveryId:
747 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
748 case LDKSecp256k1Error_InvalidTweak:
749 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
750 case LDKSecp256k1Error_NotEnoughMemory:
751 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
752 case LDKSecp256k1Error_InvalidPublicKeySum:
753 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
754 case LDKSecp256k1Error_InvalidParityValue:
755 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
760 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
761 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
762 if (UNLIKELY((*env)->ExceptionCheck(env))) {
763 (*env)->ExceptionDescribe(env);
764 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
767 case 0: return LDKSemanticError_NoPaymentHash;
768 case 1: return LDKSemanticError_MultiplePaymentHashes;
769 case 2: return LDKSemanticError_NoDescription;
770 case 3: return LDKSemanticError_MultipleDescriptions;
771 case 4: return LDKSemanticError_NoPaymentSecret;
772 case 5: return LDKSemanticError_MultiplePaymentSecrets;
773 case 6: return LDKSemanticError_InvalidFeatures;
774 case 7: return LDKSemanticError_InvalidRecoveryId;
775 case 8: return LDKSemanticError_InvalidSignature;
776 case 9: return LDKSemanticError_ImpreciseAmount;
778 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
779 abort(); // Unreachable, but will let the compiler know we don't return here
781 static jclass SemanticError_class = NULL;
782 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
783 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
784 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
785 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
786 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
787 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
788 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
789 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
790 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
791 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
792 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
793 SemanticError_class = (*env)->NewGlobalRef(env, clz);
794 CHECK(SemanticError_class != NULL);
795 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
796 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
797 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
798 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
799 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
800 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
801 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
802 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
803 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
804 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
805 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
806 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
807 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
808 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
809 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
810 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
811 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
812 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
813 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
814 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
816 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
818 case LDKSemanticError_NoPaymentHash:
819 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
820 case LDKSemanticError_MultiplePaymentHashes:
821 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
822 case LDKSemanticError_NoDescription:
823 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
824 case LDKSemanticError_MultipleDescriptions:
825 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
826 case LDKSemanticError_NoPaymentSecret:
827 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
828 case LDKSemanticError_MultiplePaymentSecrets:
829 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
830 case LDKSemanticError_InvalidFeatures:
831 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
832 case LDKSemanticError_InvalidRecoveryId:
833 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
834 case LDKSemanticError_InvalidSignature:
835 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
836 case LDKSemanticError_ImpreciseAmount:
837 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
842 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
843 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
844 if (UNLIKELY((*env)->ExceptionCheck(env))) {
845 (*env)->ExceptionDescribe(env);
846 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
849 case 0: return LDKSiPrefix_Milli;
850 case 1: return LDKSiPrefix_Micro;
851 case 2: return LDKSiPrefix_Nano;
852 case 3: return LDKSiPrefix_Pico;
854 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
855 abort(); // Unreachable, but will let the compiler know we don't return here
857 static jclass SiPrefix_class = NULL;
858 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
859 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
860 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
861 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
862 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
863 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
864 CHECK(SiPrefix_class != NULL);
865 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
866 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
867 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
868 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
869 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
870 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
871 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
872 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
874 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
876 case LDKSiPrefix_Milli:
877 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
878 case LDKSiPrefix_Micro:
879 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
880 case LDKSiPrefix_Nano:
881 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
882 case LDKSiPrefix_Pico:
883 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
888 static jclass LDKBech32Error_MissingSeparator_class = NULL;
889 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
890 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
891 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
892 static jclass LDKBech32Error_InvalidLength_class = NULL;
893 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
894 static jclass LDKBech32Error_InvalidChar_class = NULL;
895 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
896 static jclass LDKBech32Error_InvalidData_class = NULL;
897 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
898 static jclass LDKBech32Error_InvalidPadding_class = NULL;
899 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
900 static jclass LDKBech32Error_MixedCase_class = NULL;
901 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
903 LDKBech32Error_MissingSeparator_class =
904 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
905 CHECK(LDKBech32Error_MissingSeparator_class != NULL);
906 LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
907 CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
908 LDKBech32Error_InvalidChecksum_class =
909 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
910 CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
911 LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
912 CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
913 LDKBech32Error_InvalidLength_class =
914 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
915 CHECK(LDKBech32Error_InvalidLength_class != NULL);
916 LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
917 CHECK(LDKBech32Error_InvalidLength_meth != NULL);
918 LDKBech32Error_InvalidChar_class =
919 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
920 CHECK(LDKBech32Error_InvalidChar_class != NULL);
921 LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
922 CHECK(LDKBech32Error_InvalidChar_meth != NULL);
923 LDKBech32Error_InvalidData_class =
924 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
925 CHECK(LDKBech32Error_InvalidData_class != NULL);
926 LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
927 CHECK(LDKBech32Error_InvalidData_meth != NULL);
928 LDKBech32Error_InvalidPadding_class =
929 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
930 CHECK(LDKBech32Error_InvalidPadding_class != NULL);
931 LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
932 CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
933 LDKBech32Error_MixedCase_class =
934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
935 CHECK(LDKBech32Error_MixedCase_class != NULL);
936 LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
937 CHECK(LDKBech32Error_MixedCase_meth != NULL);
939 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
940 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
942 case LDKBech32Error_MissingSeparator: {
943 return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
945 case LDKBech32Error_InvalidChecksum: {
946 return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
948 case LDKBech32Error_InvalidLength: {
949 return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
951 case LDKBech32Error_InvalidChar: {
952 int32_t invalid_char_conv = obj->invalid_char;
953 return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
955 case LDKBech32Error_InvalidData: {
956 int8_t invalid_data_conv = obj->invalid_data;
957 return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
959 case LDKBech32Error_InvalidPadding: {
960 return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
962 case LDKBech32Error_MixedCase: {
963 return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
968 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
969 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
970 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
973 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) {
974 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
975 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
976 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
977 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
978 CVec_u8Z_free(ret_var);
982 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) {
983 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
984 int64_t ret_conv = TxOut_get_value(thing_conv);
988 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
989 CHECK(owner->result_ok);
990 return *owner->contents.result;
992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
993 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
994 CResult_NoneNoneZ_get_ok(owner_conv);
997 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
998 CHECK(!owner->result_ok);
999 return *owner->contents.err;
1001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1002 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1003 CResult_NoneNoneZ_get_err(owner_conv);
1006 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1007 CHECK(owner->result_ok);
1008 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
1010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1011 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1012 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1013 int64_t ret_ref = 0;
1014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1017 ret_ref = (uintptr_t)ret_var.inner;
1018 if (ret_var.is_owned) {
1024 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1025 CHECK(!owner->result_ok);
1026 return DecodeError_clone(&*owner->contents.err);
1028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1029 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1030 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1031 int64_t ret_ref = 0;
1032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1035 ret_ref = (uintptr_t)ret_var.inner;
1036 if (ret_var.is_owned) {
1042 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1043 CHECK(owner->result_ok);
1044 return *owner->contents.result;
1046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1047 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1053 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1054 CHECK(!owner->result_ok);
1055 return *owner->contents.err;
1057 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1058 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1059 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1063 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1064 CHECK(owner->result_ok);
1065 return *owner->contents.result;
1067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1068 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1069 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1070 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1074 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1075 CHECK(!owner->result_ok);
1076 return *owner->contents.err;
1078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1079 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1080 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1084 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1085 CHECK(owner->result_ok);
1086 return TxCreationKeys_clone(&*owner->contents.result);
1088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1089 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1090 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1091 int64_t ret_ref = 0;
1092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1095 ret_ref = (uintptr_t)ret_var.inner;
1096 if (ret_var.is_owned) {
1102 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1103 CHECK(!owner->result_ok);
1104 return DecodeError_clone(&*owner->contents.err);
1106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1107 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1108 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1109 int64_t ret_ref = 0;
1110 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1113 ret_ref = (uintptr_t)ret_var.inner;
1114 if (ret_var.is_owned) {
1120 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1121 CHECK(owner->result_ok);
1122 return ChannelPublicKeys_clone(&*owner->contents.result);
1124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1125 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1126 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1127 int64_t ret_ref = 0;
1128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1131 ret_ref = (uintptr_t)ret_var.inner;
1132 if (ret_var.is_owned) {
1138 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1139 CHECK(!owner->result_ok);
1140 return DecodeError_clone(&*owner->contents.err);
1142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1143 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1144 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1145 int64_t ret_ref = 0;
1146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1149 ret_ref = (uintptr_t)ret_var.inner;
1150 if (ret_var.is_owned) {
1156 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1157 CHECK(owner->result_ok);
1158 return TxCreationKeys_clone(&*owner->contents.result);
1160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1161 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1162 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1163 int64_t ret_ref = 0;
1164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1167 ret_ref = (uintptr_t)ret_var.inner;
1168 if (ret_var.is_owned) {
1174 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1175 CHECK(!owner->result_ok);
1176 return *owner->contents.err;
1178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1179 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1180 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1184 static jclass LDKCOption_u32Z_Some_class = NULL;
1185 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1186 static jclass LDKCOption_u32Z_None_class = NULL;
1187 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1189 LDKCOption_u32Z_Some_class =
1190 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1191 CHECK(LDKCOption_u32Z_Some_class != NULL);
1192 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1193 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1194 LDKCOption_u32Z_None_class =
1195 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1196 CHECK(LDKCOption_u32Z_None_class != NULL);
1197 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1198 CHECK(LDKCOption_u32Z_None_meth != NULL);
1200 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1201 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1203 case LDKCOption_u32Z_Some: {
1204 int32_t some_conv = obj->some;
1205 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1207 case LDKCOption_u32Z_None: {
1208 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1213 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1214 CHECK(owner->result_ok);
1215 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1218 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1219 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1220 int64_t ret_ref = 0;
1221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1224 ret_ref = (uintptr_t)ret_var.inner;
1225 if (ret_var.is_owned) {
1231 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1232 CHECK(!owner->result_ok);
1233 return DecodeError_clone(&*owner->contents.err);
1235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1236 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1237 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1238 int64_t ret_ref = 0;
1239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1242 ret_ref = (uintptr_t)ret_var.inner;
1243 if (ret_var.is_owned) {
1249 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1250 CHECK(owner->result_ok);
1251 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1254 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1255 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1256 int64_t ret_ref = 0;
1257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1260 ret_ref = (uintptr_t)ret_var.inner;
1261 if (ret_var.is_owned) {
1267 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1268 CHECK(!owner->result_ok);
1269 return DecodeError_clone(&*owner->contents.err);
1271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1272 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1273 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1274 int64_t ret_ref = 0;
1275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1278 ret_ref = (uintptr_t)ret_var.inner;
1279 if (ret_var.is_owned) {
1285 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1286 CHECK(owner->result_ok);
1287 return ChannelTransactionParameters_clone(&*owner->contents.result);
1289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1290 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1291 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1292 int64_t ret_ref = 0;
1293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1296 ret_ref = (uintptr_t)ret_var.inner;
1297 if (ret_var.is_owned) {
1303 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1304 CHECK(!owner->result_ok);
1305 return DecodeError_clone(&*owner->contents.err);
1307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1308 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1309 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1310 int64_t ret_ref = 0;
1311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1314 ret_ref = (uintptr_t)ret_var.inner;
1315 if (ret_var.is_owned) {
1321 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1322 CHECK(owner->result_ok);
1323 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1326 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1327 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1328 int64_t ret_ref = 0;
1329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1332 ret_ref = (uintptr_t)ret_var.inner;
1333 if (ret_var.is_owned) {
1339 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1340 CHECK(!owner->result_ok);
1341 return DecodeError_clone(&*owner->contents.err);
1343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1344 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1345 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1346 int64_t ret_ref = 0;
1347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1350 ret_ref = (uintptr_t)ret_var.inner;
1351 if (ret_var.is_owned) {
1357 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1358 CHECK(owner->result_ok);
1359 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1362 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1363 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1364 int64_t ret_ref = 0;
1365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1368 ret_ref = (uintptr_t)ret_var.inner;
1369 if (ret_var.is_owned) {
1375 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1376 CHECK(!owner->result_ok);
1377 return DecodeError_clone(&*owner->contents.err);
1379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1380 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1381 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1382 int64_t ret_ref = 0;
1383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1386 ret_ref = (uintptr_t)ret_var.inner;
1387 if (ret_var.is_owned) {
1393 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1394 CHECK(owner->result_ok);
1395 return &*owner->contents.result;
1397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1398 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1399 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1400 int64_t ret_ref = 0;
1401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1404 ret_ref = (uintptr_t)ret_var.inner & ~1;
1408 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1409 CHECK(!owner->result_ok);
1410 return *owner->contents.err;
1412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1413 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1414 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1417 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1418 CHECK(owner->result_ok);
1419 return CommitmentTransaction_clone(&*owner->contents.result);
1421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1422 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1423 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1424 int64_t ret_ref = 0;
1425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1428 ret_ref = (uintptr_t)ret_var.inner;
1429 if (ret_var.is_owned) {
1435 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1436 CHECK(!owner->result_ok);
1437 return DecodeError_clone(&*owner->contents.err);
1439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1440 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1441 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1442 int64_t ret_ref = 0;
1443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1446 ret_ref = (uintptr_t)ret_var.inner;
1447 if (ret_var.is_owned) {
1453 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1454 CHECK(owner->result_ok);
1455 return &*owner->contents.result;
1457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1458 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1459 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1460 int64_t ret_ref = 0;
1461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1464 ret_ref = (uintptr_t)ret_var.inner & ~1;
1468 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1469 CHECK(!owner->result_ok);
1470 return *owner->contents.err;
1472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1473 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1474 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1477 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1478 CHECK(owner->result_ok);
1479 return *owner->contents.result;
1481 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1482 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1483 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1484 jobjectArray ret_arr = NULL;
1485 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1487 for (size_t i = 0; i < ret_var.datalen; i++) {
1488 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1489 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1490 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1496 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1497 CHECK(!owner->result_ok);
1498 return *owner->contents.err;
1500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1501 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1502 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1505 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1506 CHECK(owner->result_ok);
1507 return ShutdownScript_clone(&*owner->contents.result);
1509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1510 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1511 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1512 int64_t ret_ref = 0;
1513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1516 ret_ref = (uintptr_t)ret_var.inner;
1517 if (ret_var.is_owned) {
1523 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1524 CHECK(!owner->result_ok);
1525 return DecodeError_clone(&*owner->contents.err);
1527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1528 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1529 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1530 int64_t ret_ref = 0;
1531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1534 ret_ref = (uintptr_t)ret_var.inner;
1535 if (ret_var.is_owned) {
1541 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1542 CHECK(owner->result_ok);
1543 return ShutdownScript_clone(&*owner->contents.result);
1545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1546 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1547 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1548 int64_t ret_ref = 0;
1549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1552 ret_ref = (uintptr_t)ret_var.inner;
1553 if (ret_var.is_owned) {
1559 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1560 CHECK(!owner->result_ok);
1561 return InvalidShutdownScript_clone(&*owner->contents.err);
1563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1564 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1565 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1566 int64_t ret_ref = 0;
1567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1570 ret_ref = (uintptr_t)ret_var.inner;
1571 if (ret_var.is_owned) {
1577 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1578 CHECK(owner->result_ok);
1579 return *owner->contents.result;
1581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1582 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1583 CResult_NoneErrorZ_get_ok(owner_conv);
1586 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1587 CHECK(!owner->result_ok);
1588 return *owner->contents.err;
1590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1591 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1592 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1596 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1597 CHECK(owner->result_ok);
1598 return RouteHop_clone(&*owner->contents.result);
1600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1601 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1602 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1603 int64_t ret_ref = 0;
1604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1607 ret_ref = (uintptr_t)ret_var.inner;
1608 if (ret_var.is_owned) {
1614 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1615 CHECK(!owner->result_ok);
1616 return DecodeError_clone(&*owner->contents.err);
1618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1619 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1620 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1621 int64_t ret_ref = 0;
1622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1625 ret_ref = (uintptr_t)ret_var.inner;
1626 if (ret_var.is_owned) {
1632 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1633 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1634 for (size_t i = 0; i < ret.datalen; i++) {
1635 ret.data[i] = RouteHop_clone(&orig->data[i]);
1639 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1640 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1641 for (size_t i = 0; i < ret.datalen; i++) {
1642 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1646 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1647 CHECK(owner->result_ok);
1648 return Route_clone(&*owner->contents.result);
1650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1651 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1652 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1653 int64_t ret_ref = 0;
1654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1657 ret_ref = (uintptr_t)ret_var.inner;
1658 if (ret_var.is_owned) {
1664 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1665 CHECK(!owner->result_ok);
1666 return DecodeError_clone(&*owner->contents.err);
1668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1669 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1670 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1671 int64_t ret_ref = 0;
1672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1675 ret_ref = (uintptr_t)ret_var.inner;
1676 if (ret_var.is_owned) {
1682 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1683 CHECK(owner->result_ok);
1684 return RouteParameters_clone(&*owner->contents.result);
1686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1687 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1688 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1689 int64_t ret_ref = 0;
1690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1693 ret_ref = (uintptr_t)ret_var.inner;
1694 if (ret_var.is_owned) {
1700 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1701 CHECK(!owner->result_ok);
1702 return DecodeError_clone(&*owner->contents.err);
1704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1705 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1706 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1707 int64_t ret_ref = 0;
1708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1711 ret_ref = (uintptr_t)ret_var.inner;
1712 if (ret_var.is_owned) {
1718 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1719 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1720 for (size_t i = 0; i < ret.datalen; i++) {
1721 ret.data[i] = RouteHint_clone(&orig->data[i]);
1725 static jclass LDKCOption_u64Z_Some_class = NULL;
1726 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1727 static jclass LDKCOption_u64Z_None_class = NULL;
1728 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1730 LDKCOption_u64Z_Some_class =
1731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1732 CHECK(LDKCOption_u64Z_Some_class != NULL);
1733 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1734 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1735 LDKCOption_u64Z_None_class =
1736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1737 CHECK(LDKCOption_u64Z_None_class != NULL);
1738 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1739 CHECK(LDKCOption_u64Z_None_meth != NULL);
1741 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1742 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1744 case LDKCOption_u64Z_Some: {
1745 int64_t some_conv = obj->some;
1746 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1748 case LDKCOption_u64Z_None: {
1749 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1754 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1755 CHECK(owner->result_ok);
1756 return PaymentParameters_clone(&*owner->contents.result);
1758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1759 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1760 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1761 int64_t ret_ref = 0;
1762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1765 ret_ref = (uintptr_t)ret_var.inner;
1766 if (ret_var.is_owned) {
1772 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1773 CHECK(!owner->result_ok);
1774 return DecodeError_clone(&*owner->contents.err);
1776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1777 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1778 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1779 int64_t ret_ref = 0;
1780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1783 ret_ref = (uintptr_t)ret_var.inner;
1784 if (ret_var.is_owned) {
1790 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1791 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1792 for (size_t i = 0; i < ret.datalen; i++) {
1793 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1797 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1798 CHECK(owner->result_ok);
1799 return RouteHint_clone(&*owner->contents.result);
1801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1802 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1803 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1804 int64_t ret_ref = 0;
1805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1808 ret_ref = (uintptr_t)ret_var.inner;
1809 if (ret_var.is_owned) {
1815 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1816 CHECK(!owner->result_ok);
1817 return DecodeError_clone(&*owner->contents.err);
1819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1820 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1821 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1822 int64_t ret_ref = 0;
1823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1826 ret_ref = (uintptr_t)ret_var.inner;
1827 if (ret_var.is_owned) {
1833 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1834 CHECK(owner->result_ok);
1835 return RouteHintHop_clone(&*owner->contents.result);
1837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1838 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1839 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1840 int64_t ret_ref = 0;
1841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1844 ret_ref = (uintptr_t)ret_var.inner;
1845 if (ret_var.is_owned) {
1851 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1852 CHECK(!owner->result_ok);
1853 return DecodeError_clone(&*owner->contents.err);
1855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1856 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1857 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1858 int64_t ret_ref = 0;
1859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1862 ret_ref = (uintptr_t)ret_var.inner;
1863 if (ret_var.is_owned) {
1869 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1870 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1871 for (size_t i = 0; i < ret.datalen; i++) {
1872 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1876 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1877 CHECK(owner->result_ok);
1878 return Route_clone(&*owner->contents.result);
1880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1881 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1882 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1883 int64_t ret_ref = 0;
1884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1887 ret_ref = (uintptr_t)ret_var.inner;
1888 if (ret_var.is_owned) {
1894 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1895 CHECK(!owner->result_ok);
1896 return LightningError_clone(&*owner->contents.err);
1898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1899 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1900 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1901 int64_t ret_ref = 0;
1902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1905 ret_ref = (uintptr_t)ret_var.inner;
1906 if (ret_var.is_owned) {
1912 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1913 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1914 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1915 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1917 LDKPaymentPurpose_InvoicePayment_class =
1918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1919 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1920 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1921 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1922 LDKPaymentPurpose_SpontaneousPayment_class =
1923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1924 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1925 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1926 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1928 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1929 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1931 case LDKPaymentPurpose_InvoicePayment: {
1932 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1933 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1934 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1935 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1936 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1938 case LDKPaymentPurpose_SpontaneousPayment: {
1939 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1940 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1941 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1946 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1947 CHECK(owner->result_ok);
1948 return PaymentPurpose_clone(&*owner->contents.result);
1950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1951 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1952 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1953 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1954 int64_t ret_ref = (uintptr_t)ret_copy;
1958 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1959 CHECK(!owner->result_ok);
1960 return DecodeError_clone(&*owner->contents.err);
1962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1963 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1964 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1965 int64_t ret_ref = 0;
1966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1969 ret_ref = (uintptr_t)ret_var.inner;
1970 if (ret_var.is_owned) {
1976 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1977 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1978 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1979 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1980 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1981 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1982 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1983 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1984 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1985 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1986 static jclass LDKClosureReason_ProcessingError_class = NULL;
1987 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1988 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1989 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1990 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1991 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1993 LDKClosureReason_CounterpartyForceClosed_class =
1994 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1995 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1996 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1997 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1998 LDKClosureReason_HolderForceClosed_class =
1999 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2000 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2001 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2002 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2003 LDKClosureReason_CooperativeClosure_class =
2004 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2005 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2006 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2007 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2008 LDKClosureReason_CommitmentTxConfirmed_class =
2009 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2010 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2011 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2012 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2013 LDKClosureReason_FundingTimedOut_class =
2014 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2015 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2016 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2017 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2018 LDKClosureReason_ProcessingError_class =
2019 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2020 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2021 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2022 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2023 LDKClosureReason_DisconnectedPeer_class =
2024 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2025 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2026 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2027 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2028 LDKClosureReason_OutdatedChannelManager_class =
2029 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2030 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2031 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2032 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2034 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2035 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2037 case LDKClosureReason_CounterpartyForceClosed: {
2038 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2039 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2040 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2042 case LDKClosureReason_HolderForceClosed: {
2043 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2045 case LDKClosureReason_CooperativeClosure: {
2046 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2048 case LDKClosureReason_CommitmentTxConfirmed: {
2049 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2051 case LDKClosureReason_FundingTimedOut: {
2052 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2054 case LDKClosureReason_ProcessingError: {
2055 LDKStr err_str = obj->processing_error.err;
2056 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2057 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2059 case LDKClosureReason_DisconnectedPeer: {
2060 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2062 case LDKClosureReason_OutdatedChannelManager: {
2063 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2068 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2069 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2070 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2071 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2073 LDKCOption_ClosureReasonZ_Some_class =
2074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2075 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2076 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2077 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2078 LDKCOption_ClosureReasonZ_None_class =
2079 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2080 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2081 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2082 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2084 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2085 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2087 case LDKCOption_ClosureReasonZ_Some: {
2088 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2089 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2091 case LDKCOption_ClosureReasonZ_None: {
2092 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2097 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2098 CHECK(owner->result_ok);
2099 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2102 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2103 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2104 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2105 int64_t ret_ref = (uintptr_t)ret_copy;
2109 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2110 CHECK(!owner->result_ok);
2111 return DecodeError_clone(&*owner->contents.err);
2113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2114 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2115 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2116 int64_t ret_ref = 0;
2117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2120 ret_ref = (uintptr_t)ret_var.inner;
2121 if (ret_var.is_owned) {
2127 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2128 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2129 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2130 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2131 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2132 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2134 LDKNetworkUpdate_ChannelUpdateMessage_class =
2135 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2136 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2137 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2138 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2139 LDKNetworkUpdate_ChannelFailure_class =
2140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2141 CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2142 LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2143 CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2144 LDKNetworkUpdate_NodeFailure_class =
2145 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2146 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2147 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2148 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2150 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2151 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2153 case LDKNetworkUpdate_ChannelUpdateMessage: {
2154 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2155 int64_t msg_ref = 0;
2156 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2157 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2158 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2159 msg_ref = (uintptr_t)msg_var.inner & ~1;
2160 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2162 case LDKNetworkUpdate_ChannelFailure: {
2163 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2164 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2165 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2167 case LDKNetworkUpdate_NodeFailure: {
2168 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2169 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2170 jboolean is_permanent_conv = obj->node_failure.is_permanent;
2171 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2176 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2177 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2178 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2179 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2181 LDKCOption_NetworkUpdateZ_Some_class =
2182 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2183 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2184 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2185 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2186 LDKCOption_NetworkUpdateZ_None_class =
2187 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2188 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2189 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2190 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2192 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2193 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2195 case LDKCOption_NetworkUpdateZ_Some: {
2196 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2197 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2199 case LDKCOption_NetworkUpdateZ_None: {
2200 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2205 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2206 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2207 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2208 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2209 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2210 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2212 LDKSpendableOutputDescriptor_StaticOutput_class =
2213 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2214 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2215 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2216 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2217 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2218 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2219 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2220 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2221 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2222 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2223 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2224 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2225 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2226 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2228 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2229 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2231 case LDKSpendableOutputDescriptor_StaticOutput: {
2232 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2233 int64_t outpoint_ref = 0;
2234 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2235 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2236 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2237 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2238 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2239 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2241 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2242 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2243 int64_t delayed_payment_output_ref = 0;
2244 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2245 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2246 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2247 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2248 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2250 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2251 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2252 int64_t static_payment_output_ref = 0;
2253 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2254 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2255 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2256 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2257 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2262 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2263 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2264 for (size_t i = 0; i < ret.datalen; i++) {
2265 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2269 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2270 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2271 static jclass LDKEvent_PaymentReceived_class = NULL;
2272 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2273 static jclass LDKEvent_PaymentClaimed_class = NULL;
2274 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2275 static jclass LDKEvent_PaymentSent_class = NULL;
2276 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2277 static jclass LDKEvent_PaymentFailed_class = NULL;
2278 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2279 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2280 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2281 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2282 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2283 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2284 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2285 static jclass LDKEvent_SpendableOutputs_class = NULL;
2286 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2287 static jclass LDKEvent_PaymentForwarded_class = NULL;
2288 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2289 static jclass LDKEvent_ChannelClosed_class = NULL;
2290 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2291 static jclass LDKEvent_DiscardFunding_class = NULL;
2292 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2293 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2294 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2296 LDKEvent_FundingGenerationReady_class =
2297 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2298 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2299 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2300 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2301 LDKEvent_PaymentReceived_class =
2302 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2303 CHECK(LDKEvent_PaymentReceived_class != NULL);
2304 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2305 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2306 LDKEvent_PaymentClaimed_class =
2307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2308 CHECK(LDKEvent_PaymentClaimed_class != NULL);
2309 LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2310 CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2311 LDKEvent_PaymentSent_class =
2312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2313 CHECK(LDKEvent_PaymentSent_class != NULL);
2314 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2315 CHECK(LDKEvent_PaymentSent_meth != NULL);
2316 LDKEvent_PaymentFailed_class =
2317 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2318 CHECK(LDKEvent_PaymentFailed_class != NULL);
2319 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2320 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2321 LDKEvent_PaymentPathSuccessful_class =
2322 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2323 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2324 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2325 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2326 LDKEvent_PaymentPathFailed_class =
2327 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2328 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2329 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2330 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2331 LDKEvent_PendingHTLCsForwardable_class =
2332 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2333 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2334 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2335 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2336 LDKEvent_SpendableOutputs_class =
2337 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2338 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2339 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2340 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2341 LDKEvent_PaymentForwarded_class =
2342 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2343 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2344 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2345 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2346 LDKEvent_ChannelClosed_class =
2347 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2348 CHECK(LDKEvent_ChannelClosed_class != NULL);
2349 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2350 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2351 LDKEvent_DiscardFunding_class =
2352 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2353 CHECK(LDKEvent_DiscardFunding_class != NULL);
2354 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2355 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2356 LDKEvent_OpenChannelRequest_class =
2357 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2358 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2359 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2360 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2362 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2363 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2365 case LDKEvent_FundingGenerationReady: {
2366 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2367 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2368 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2369 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2370 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2371 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2372 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2373 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2374 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2375 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);
2377 case LDKEvent_PaymentReceived: {
2378 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2379 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2380 int64_t amount_msat_conv = obj->payment_received.amount_msat;
2381 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2382 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2384 case LDKEvent_PaymentClaimed: {
2385 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2386 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2387 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2388 int64_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
2389 return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2391 case LDKEvent_PaymentSent: {
2392 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2393 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2394 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2395 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2396 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2397 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2398 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2399 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2401 case LDKEvent_PaymentFailed: {
2402 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2403 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2404 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2405 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2406 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2408 case LDKEvent_PaymentPathSuccessful: {
2409 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2410 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2411 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2412 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2413 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2414 int64_tArray path_arr = NULL;
2415 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2416 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2417 for (size_t k = 0; k < path_var.datalen; k++) {
2418 LDKRouteHop path_conv_10_var = path_var.data[k];
2419 int64_t path_conv_10_ref = 0;
2420 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2421 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2422 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2423 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2424 path_arr_ptr[k] = path_conv_10_ref;
2426 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2427 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2429 case LDKEvent_PaymentPathFailed: {
2430 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2431 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2432 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2433 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2434 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2435 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2436 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2437 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2438 int64_tArray path_arr = NULL;
2439 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2440 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2441 for (size_t k = 0; k < path_var.datalen; k++) {
2442 LDKRouteHop path_conv_10_var = path_var.data[k];
2443 int64_t path_conv_10_ref = 0;
2444 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2445 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2446 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2447 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2448 path_arr_ptr[k] = path_conv_10_ref;
2450 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2451 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2452 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2453 int64_t retry_ref = 0;
2454 if ((uintptr_t)retry_var.inner > 4096) {
2455 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2456 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2457 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2458 retry_ref = (uintptr_t)retry_var.inner & ~1;
2460 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);
2462 case LDKEvent_PendingHTLCsForwardable: {
2463 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2464 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2466 case LDKEvent_SpendableOutputs: {
2467 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2468 int64_tArray outputs_arr = NULL;
2469 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2470 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2471 for (size_t b = 0; b < outputs_var.datalen; b++) {
2472 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2473 outputs_arr_ptr[b] = outputs_conv_27_ref;
2475 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2476 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2478 case LDKEvent_PaymentForwarded: {
2479 int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2480 (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2481 int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2482 (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2483 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2484 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2485 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);
2487 case LDKEvent_ChannelClosed: {
2488 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2489 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2490 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2491 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2492 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2494 case LDKEvent_DiscardFunding: {
2495 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2496 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2497 LDKTransaction transaction_var = obj->discard_funding.transaction;
2498 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2499 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2500 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2502 case LDKEvent_OpenChannelRequest: {
2503 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2504 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2505 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2506 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2507 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2508 int64_t push_msat_conv = obj->open_channel_request.push_msat;
2509 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2510 int64_t channel_type_ref = 0;
2511 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2512 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2513 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2514 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2515 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);
2520 static jclass LDKCOption_EventZ_Some_class = NULL;
2521 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2522 static jclass LDKCOption_EventZ_None_class = NULL;
2523 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2525 LDKCOption_EventZ_Some_class =
2526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2527 CHECK(LDKCOption_EventZ_Some_class != NULL);
2528 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2529 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2530 LDKCOption_EventZ_None_class =
2531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2532 CHECK(LDKCOption_EventZ_None_class != NULL);
2533 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2534 CHECK(LDKCOption_EventZ_None_meth != NULL);
2536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2537 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2539 case LDKCOption_EventZ_Some: {
2540 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2541 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2543 case LDKCOption_EventZ_None: {
2544 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2549 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2550 CHECK(owner->result_ok);
2551 return COption_EventZ_clone(&*owner->contents.result);
2553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2554 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2555 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2556 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2557 int64_t ret_ref = (uintptr_t)ret_copy;
2561 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2562 CHECK(!owner->result_ok);
2563 return DecodeError_clone(&*owner->contents.err);
2565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2566 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2567 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2568 int64_t ret_ref = 0;
2569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2572 ret_ref = (uintptr_t)ret_var.inner;
2573 if (ret_var.is_owned) {
2579 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2580 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2581 static jclass LDKErrorAction_IgnoreError_class = NULL;
2582 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2583 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2584 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2585 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2586 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2587 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2588 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2589 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2590 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2592 LDKErrorAction_DisconnectPeer_class =
2593 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2594 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2595 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2596 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2597 LDKErrorAction_IgnoreError_class =
2598 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2599 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2600 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2601 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2602 LDKErrorAction_IgnoreAndLog_class =
2603 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2604 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2605 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2606 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2607 LDKErrorAction_IgnoreDuplicateGossip_class =
2608 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2609 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2610 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2611 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2612 LDKErrorAction_SendErrorMessage_class =
2613 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2614 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2615 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2616 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2617 LDKErrorAction_SendWarningMessage_class =
2618 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2619 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2620 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2621 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2623 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2624 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2626 case LDKErrorAction_DisconnectPeer: {
2627 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2628 int64_t msg_ref = 0;
2629 if ((uintptr_t)msg_var.inner > 4096) {
2630 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2631 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2632 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2633 msg_ref = (uintptr_t)msg_var.inner & ~1;
2635 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2637 case LDKErrorAction_IgnoreError: {
2638 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2640 case LDKErrorAction_IgnoreAndLog: {
2641 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2642 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2644 case LDKErrorAction_IgnoreDuplicateGossip: {
2645 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2647 case LDKErrorAction_SendErrorMessage: {
2648 LDKErrorMessage msg_var = obj->send_error_message.msg;
2649 int64_t msg_ref = 0;
2650 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2651 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2652 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2653 msg_ref = (uintptr_t)msg_var.inner & ~1;
2654 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2656 case LDKErrorAction_SendWarningMessage: {
2657 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2658 int64_t msg_ref = 0;
2659 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2660 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2661 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2662 msg_ref = (uintptr_t)msg_var.inner & ~1;
2663 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2664 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2669 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2670 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2671 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2672 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2673 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2674 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2675 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2676 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2677 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2678 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2679 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2680 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2681 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2682 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2683 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2684 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2685 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2686 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2687 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2688 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2689 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2690 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2691 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2692 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2693 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2694 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2695 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2696 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2697 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2698 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2699 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2700 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2701 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2702 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2703 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2704 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2705 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2706 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2707 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2708 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2710 LDKMessageSendEvent_SendAcceptChannel_class =
2711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2712 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2713 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2714 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2715 LDKMessageSendEvent_SendOpenChannel_class =
2716 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2717 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2718 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2719 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2720 LDKMessageSendEvent_SendFundingCreated_class =
2721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2722 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2723 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2724 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2725 LDKMessageSendEvent_SendFundingSigned_class =
2726 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2727 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2728 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2729 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2730 LDKMessageSendEvent_SendChannelReady_class =
2731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2732 CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2733 LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2734 CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2735 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2737 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2738 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2739 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2740 LDKMessageSendEvent_UpdateHTLCs_class =
2741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2742 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2743 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2744 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2745 LDKMessageSendEvent_SendRevokeAndACK_class =
2746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2747 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2748 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2749 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2750 LDKMessageSendEvent_SendClosingSigned_class =
2751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2752 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2753 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2754 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2755 LDKMessageSendEvent_SendShutdown_class =
2756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2757 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2758 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2759 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2760 LDKMessageSendEvent_SendChannelReestablish_class =
2761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2762 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2763 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2764 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2765 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2767 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2768 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2769 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2770 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2772 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2773 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2774 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2775 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2777 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2778 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2779 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2780 LDKMessageSendEvent_SendChannelUpdate_class =
2781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2782 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2783 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2784 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2785 LDKMessageSendEvent_HandleError_class =
2786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2787 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2788 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2789 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2790 LDKMessageSendEvent_SendChannelRangeQuery_class =
2791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2792 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2793 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2794 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2795 LDKMessageSendEvent_SendShortIdsQuery_class =
2796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2797 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2798 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2799 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2800 LDKMessageSendEvent_SendReplyChannelRange_class =
2801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2802 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2803 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2804 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2805 LDKMessageSendEvent_SendGossipTimestampFilter_class =
2806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2807 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2808 LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2809 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2811 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2812 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2814 case LDKMessageSendEvent_SendAcceptChannel: {
2815 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2816 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2817 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2818 int64_t msg_ref = 0;
2819 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2820 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2821 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2822 msg_ref = (uintptr_t)msg_var.inner & ~1;
2823 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2825 case LDKMessageSendEvent_SendOpenChannel: {
2826 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2827 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2828 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2829 int64_t msg_ref = 0;
2830 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2831 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2832 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2833 msg_ref = (uintptr_t)msg_var.inner & ~1;
2834 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2836 case LDKMessageSendEvent_SendFundingCreated: {
2837 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2838 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2839 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2840 int64_t msg_ref = 0;
2841 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2842 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2843 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2844 msg_ref = (uintptr_t)msg_var.inner & ~1;
2845 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2847 case LDKMessageSendEvent_SendFundingSigned: {
2848 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2849 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2850 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2851 int64_t msg_ref = 0;
2852 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2853 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2854 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2855 msg_ref = (uintptr_t)msg_var.inner & ~1;
2856 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2858 case LDKMessageSendEvent_SendChannelReady: {
2859 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2860 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
2861 LDKChannelReady msg_var = obj->send_channel_ready.msg;
2862 int64_t msg_ref = 0;
2863 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2864 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2865 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2866 msg_ref = (uintptr_t)msg_var.inner & ~1;
2867 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
2869 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2870 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2871 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2872 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2873 int64_t msg_ref = 0;
2874 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2875 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2876 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2877 msg_ref = (uintptr_t)msg_var.inner & ~1;
2878 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2880 case LDKMessageSendEvent_UpdateHTLCs: {
2881 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2882 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2883 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2884 int64_t updates_ref = 0;
2885 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2886 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2887 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2888 updates_ref = (uintptr_t)updates_var.inner & ~1;
2889 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2891 case LDKMessageSendEvent_SendRevokeAndACK: {
2892 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2893 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2894 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2895 int64_t msg_ref = 0;
2896 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2897 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2898 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2899 msg_ref = (uintptr_t)msg_var.inner & ~1;
2900 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2902 case LDKMessageSendEvent_SendClosingSigned: {
2903 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2904 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2905 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2906 int64_t msg_ref = 0;
2907 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2908 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2909 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2910 msg_ref = (uintptr_t)msg_var.inner & ~1;
2911 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2913 case LDKMessageSendEvent_SendShutdown: {
2914 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2915 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2916 LDKShutdown msg_var = obj->send_shutdown.msg;
2917 int64_t msg_ref = 0;
2918 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2919 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2920 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2921 msg_ref = (uintptr_t)msg_var.inner & ~1;
2922 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2924 case LDKMessageSendEvent_SendChannelReestablish: {
2925 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2926 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2927 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2928 int64_t msg_ref = 0;
2929 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2930 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2931 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2932 msg_ref = (uintptr_t)msg_var.inner & ~1;
2933 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2935 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2936 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2937 int64_t msg_ref = 0;
2938 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2939 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2941 msg_ref = (uintptr_t)msg_var.inner & ~1;
2942 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2943 int64_t update_msg_ref = 0;
2944 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2945 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2946 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2947 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2948 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2950 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2951 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2952 int64_t msg_ref = 0;
2953 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2954 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2955 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2956 msg_ref = (uintptr_t)msg_var.inner & ~1;
2957 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2959 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2960 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2961 int64_t msg_ref = 0;
2962 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2963 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2964 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2965 msg_ref = (uintptr_t)msg_var.inner & ~1;
2966 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2968 case LDKMessageSendEvent_SendChannelUpdate: {
2969 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2970 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2971 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2972 int64_t msg_ref = 0;
2973 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2974 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2975 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2976 msg_ref = (uintptr_t)msg_var.inner & ~1;
2977 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2979 case LDKMessageSendEvent_HandleError: {
2980 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2981 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2982 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2983 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2985 case LDKMessageSendEvent_SendChannelRangeQuery: {
2986 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2987 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2988 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2989 int64_t msg_ref = 0;
2990 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2991 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2992 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2993 msg_ref = (uintptr_t)msg_var.inner & ~1;
2994 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2996 case LDKMessageSendEvent_SendShortIdsQuery: {
2997 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2998 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
2999 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3000 int64_t msg_ref = 0;
3001 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3002 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3003 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3004 msg_ref = (uintptr_t)msg_var.inner & ~1;
3005 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3007 case LDKMessageSendEvent_SendReplyChannelRange: {
3008 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3009 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3010 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3011 int64_t msg_ref = 0;
3012 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3013 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3014 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3015 msg_ref = (uintptr_t)msg_var.inner & ~1;
3016 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3018 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3019 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3020 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3021 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3022 int64_t msg_ref = 0;
3023 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3024 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3025 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3026 msg_ref = (uintptr_t)msg_var.inner & ~1;
3027 return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3032 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3033 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3034 for (size_t i = 0; i < ret.datalen; i++) {
3035 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3039 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3040 CHECK(owner->result_ok);
3041 return TxOut_clone(&*owner->contents.result);
3043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3044 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3045 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3046 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3047 return (int64_t)ret_ref;
3050 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3051 CHECK(!owner->result_ok);
3052 return AccessError_clone(&*owner->contents.err);
3054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3055 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3056 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3060 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3064 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3065 int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3069 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3073 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3074 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3075 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3076 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3080 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3081 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3082 for (size_t i = 0; i < ret.datalen; i++) {
3083 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3087 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3088 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3089 for (size_t i = 0; i < ret.datalen; i++) {
3090 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3094 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3095 CHECK(owner->result_ok);
3096 return *owner->contents.result;
3098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3099 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3100 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3103 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3104 CHECK(!owner->result_ok);
3105 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3107 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3108 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3109 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3113 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3114 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3115 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3116 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3117 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3118 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3119 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3120 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3122 LDKMonitorEvent_HTLCEvent_class =
3123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3124 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3125 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3126 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3127 LDKMonitorEvent_CommitmentTxConfirmed_class =
3128 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3129 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3130 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3131 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3132 LDKMonitorEvent_UpdateCompleted_class =
3133 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3134 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3135 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3136 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3137 LDKMonitorEvent_UpdateFailed_class =
3138 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3139 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3140 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3141 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3143 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3144 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
3146 case LDKMonitorEvent_HTLCEvent: {
3147 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3148 int64_t htlc_event_ref = 0;
3149 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3150 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3151 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3152 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
3153 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3155 case LDKMonitorEvent_CommitmentTxConfirmed: {
3156 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3157 int64_t commitment_tx_confirmed_ref = 0;
3158 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3159 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3160 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3161 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
3162 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3164 case LDKMonitorEvent_UpdateCompleted: {
3165 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3166 int64_t funding_txo_ref = 0;
3167 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3168 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3169 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3170 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
3171 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3172 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3174 case LDKMonitorEvent_UpdateFailed: {
3175 LDKOutPoint update_failed_var = obj->update_failed;
3176 int64_t update_failed_ref = 0;
3177 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3178 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3179 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3180 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
3181 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3186 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3187 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3188 for (size_t i = 0; i < ret.datalen; i++) {
3189 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3193 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
3194 return OutPoint_clone(&owner->a);
3196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3197 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
3198 LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv);
3199 int64_t ret_ref = 0;
3200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3203 ret_ref = (uintptr_t)ret_var.inner;
3204 if (ret_var.is_owned) {
3210 static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
3211 return CVec_MonitorEventZ_clone(&owner->b);
3213 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3214 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
3215 LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv);
3216 int64_tArray ret_arr = NULL;
3217 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3218 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3219 for (size_t o = 0; o < ret_var.datalen; o++) {
3220 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3221 *ret_conv_14_copy = ret_var.data[o];
3222 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
3223 ret_arr_ptr[o] = ret_conv_14_ref;
3225 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3230 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) {
3231 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen };
3232 for (size_t i = 0; i < ret.datalen; i++) {
3233 ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]);
3237 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3238 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3239 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3240 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3242 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3243 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3244 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3245 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3246 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3247 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3248 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3249 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3250 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3251 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3253 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3254 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3256 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3257 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3258 *some_conv = obj->some;
3259 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3260 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
3262 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3263 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3268 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3269 CHECK(owner->result_ok);
3270 return FixedPenaltyScorer_clone(&*owner->contents.result);
3272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3273 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3274 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3275 int64_t ret_ref = 0;
3276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3279 ret_ref = (uintptr_t)ret_var.inner;
3280 if (ret_var.is_owned) {
3286 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3287 CHECK(!owner->result_ok);
3288 return DecodeError_clone(&*owner->contents.err);
3290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3291 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3292 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3293 int64_t ret_ref = 0;
3294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3297 ret_ref = (uintptr_t)ret_var.inner;
3298 if (ret_var.is_owned) {
3304 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3308 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3309 int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3313 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3317 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3318 int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3322 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3323 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3324 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3325 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3327 LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3328 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3329 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3330 LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3331 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3332 LDKCOption_C2Tuple_u64u64ZZ_None_class =
3333 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3334 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3335 LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3336 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3338 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3339 LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)(ptr & ~1);
3341 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3342 LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3343 *some_conv = obj->some;
3344 *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3345 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, ((int64_t)some_conv));
3347 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3348 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3353 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3354 LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3355 for (size_t i = 0; i < ret.datalen; i++) {
3356 ret.data[i] = NodeId_clone(&orig->data[i]);
3360 typedef struct LDKLogger_JCalls {
3361 atomic_size_t refcnt;
3366 static void LDKLogger_JCalls_free(void* this_arg) {
3367 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3368 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3370 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3371 if (get_jenv_res == JNI_EDETACHED) {
3372 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3374 DO_ASSERT(get_jenv_res == JNI_OK);
3376 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3377 if (get_jenv_res == JNI_EDETACHED) {
3378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3383 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3384 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3386 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3387 if (get_jenv_res == JNI_EDETACHED) {
3388 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3390 DO_ASSERT(get_jenv_res == JNI_OK);
3392 LDKRecord record_var = *record;
3393 int64_t record_ref = 0;
3394 record_var = Record_clone(&record_var);
3395 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3396 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3397 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3398 record_ref = (uintptr_t)record_var.inner;
3399 if (record_var.is_owned) {
3402 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3404 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3405 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3406 (*env)->ExceptionDescribe(env);
3407 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3409 if (get_jenv_res == JNI_EDETACHED) {
3410 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3413 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3414 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3415 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3417 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3418 jclass c = (*env)->GetObjectClass(env, o);
3420 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3421 atomic_init(&calls->refcnt, 1);
3422 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3423 calls->o = (*env)->NewWeakGlobalRef(env, o);
3424 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3425 CHECK(calls->log_meth != NULL);
3428 .this_arg = (void*) calls,
3429 .log = log_LDKLogger_jcall,
3430 .free = LDKLogger_JCalls_free,
3434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3435 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3436 *res_ptr = LDKLogger_init(env, clz, o);
3437 return (uint64_t)res_ptr;
3439 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3440 CHECK(owner->result_ok);
3441 return &*owner->contents.result;
3443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3444 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3445 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3446 int64_t ret_ref = 0;
3447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3450 ret_ref = (uintptr_t)ret_var.inner & ~1;
3454 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3455 CHECK(!owner->result_ok);
3456 return DecodeError_clone(&*owner->contents.err);
3458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3459 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3460 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3461 int64_t ret_ref = 0;
3462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3465 ret_ref = (uintptr_t)ret_var.inner;
3466 if (ret_var.is_owned) {
3472 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3473 CHECK(owner->result_ok);
3474 return InitFeatures_clone(&*owner->contents.result);
3476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3477 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3478 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3479 int64_t ret_ref = 0;
3480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3483 ret_ref = (uintptr_t)ret_var.inner;
3484 if (ret_var.is_owned) {
3490 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3491 CHECK(!owner->result_ok);
3492 return DecodeError_clone(&*owner->contents.err);
3494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3495 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3496 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3497 int64_t ret_ref = 0;
3498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3501 ret_ref = (uintptr_t)ret_var.inner;
3502 if (ret_var.is_owned) {
3508 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3509 CHECK(owner->result_ok);
3510 return ChannelFeatures_clone(&*owner->contents.result);
3512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3513 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3514 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3515 int64_t ret_ref = 0;
3516 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3517 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3518 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3519 ret_ref = (uintptr_t)ret_var.inner;
3520 if (ret_var.is_owned) {
3526 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3527 CHECK(!owner->result_ok);
3528 return DecodeError_clone(&*owner->contents.err);
3530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3531 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3532 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3533 int64_t ret_ref = 0;
3534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3537 ret_ref = (uintptr_t)ret_var.inner;
3538 if (ret_var.is_owned) {
3544 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3545 CHECK(owner->result_ok);
3546 return NodeFeatures_clone(&*owner->contents.result);
3548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3549 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3550 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3551 int64_t ret_ref = 0;
3552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3555 ret_ref = (uintptr_t)ret_var.inner;
3556 if (ret_var.is_owned) {
3562 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3563 CHECK(!owner->result_ok);
3564 return DecodeError_clone(&*owner->contents.err);
3566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3567 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3568 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3569 int64_t ret_ref = 0;
3570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3573 ret_ref = (uintptr_t)ret_var.inner;
3574 if (ret_var.is_owned) {
3580 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3581 CHECK(owner->result_ok);
3582 return InvoiceFeatures_clone(&*owner->contents.result);
3584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3585 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3586 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3587 int64_t ret_ref = 0;
3588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3591 ret_ref = (uintptr_t)ret_var.inner;
3592 if (ret_var.is_owned) {
3598 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3599 CHECK(!owner->result_ok);
3600 return DecodeError_clone(&*owner->contents.err);
3602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3603 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3604 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3605 int64_t ret_ref = 0;
3606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3609 ret_ref = (uintptr_t)ret_var.inner;
3610 if (ret_var.is_owned) {
3616 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3617 CHECK(owner->result_ok);
3618 return ChannelTypeFeatures_clone(&*owner->contents.result);
3620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3621 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3622 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3623 int64_t ret_ref = 0;
3624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3627 ret_ref = (uintptr_t)ret_var.inner;
3628 if (ret_var.is_owned) {
3634 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3635 CHECK(!owner->result_ok);
3636 return DecodeError_clone(&*owner->contents.err);
3638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3639 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3640 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3641 int64_t ret_ref = 0;
3642 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3643 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3645 ret_ref = (uintptr_t)ret_var.inner;
3646 if (ret_var.is_owned) {
3652 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3653 CHECK(owner->result_ok);
3654 return NodeId_clone(&*owner->contents.result);
3656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3657 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3658 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3659 int64_t ret_ref = 0;
3660 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3661 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3663 ret_ref = (uintptr_t)ret_var.inner;
3664 if (ret_var.is_owned) {
3670 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3671 CHECK(!owner->result_ok);
3672 return DecodeError_clone(&*owner->contents.err);
3674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3675 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3676 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3677 int64_t ret_ref = 0;
3678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3681 ret_ref = (uintptr_t)ret_var.inner;
3682 if (ret_var.is_owned) {
3688 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3689 CHECK(owner->result_ok);
3690 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3693 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3694 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3695 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3696 int64_t ret_ref = (uintptr_t)ret_copy;
3700 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3701 CHECK(!owner->result_ok);
3702 return DecodeError_clone(&*owner->contents.err);
3704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3705 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3706 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3707 int64_t ret_ref = 0;
3708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3711 ret_ref = (uintptr_t)ret_var.inner;
3712 if (ret_var.is_owned) {
3718 typedef struct LDKAccess_JCalls {
3719 atomic_size_t refcnt;
3722 jmethodID get_utxo_meth;
3724 static void LDKAccess_JCalls_free(void* this_arg) {
3725 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3726 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3728 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3729 if (get_jenv_res == JNI_EDETACHED) {
3730 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3732 DO_ASSERT(get_jenv_res == JNI_OK);
3734 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3735 if (get_jenv_res == JNI_EDETACHED) {
3736 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3741 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3742 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3744 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3745 if (get_jenv_res == JNI_EDETACHED) {
3746 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3748 DO_ASSERT(get_jenv_res == JNI_OK);
3750 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3751 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3752 int64_t short_channel_id_conv = short_channel_id;
3753 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3755 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3756 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3757 (*env)->ExceptionDescribe(env);
3758 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3760 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3761 CHECK_ACCESS(ret_ptr);
3762 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3764 if (get_jenv_res == JNI_EDETACHED) {
3765 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3769 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3770 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3771 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3773 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3774 jclass c = (*env)->GetObjectClass(env, o);
3776 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3777 atomic_init(&calls->refcnt, 1);
3778 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3779 calls->o = (*env)->NewWeakGlobalRef(env, o);
3780 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3781 CHECK(calls->get_utxo_meth != NULL);
3784 .this_arg = (void*) calls,
3785 .get_utxo = get_utxo_LDKAccess_jcall,
3786 .free = LDKAccess_JCalls_free,
3790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3791 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3792 *res_ptr = LDKAccess_init(env, clz, o);
3793 return (uint64_t)res_ptr;
3795 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) {
3796 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3797 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3798 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3799 unsigned char genesis_hash_arr[32];
3800 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3801 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3802 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3803 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3804 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3805 return (int64_t)ret_conv;
3808 static jclass LDKCOption_AccessZ_Some_class = NULL;
3809 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3810 static jclass LDKCOption_AccessZ_None_class = NULL;
3811 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
3813 LDKCOption_AccessZ_Some_class =
3814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
3815 CHECK(LDKCOption_AccessZ_Some_class != NULL);
3816 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
3817 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
3818 LDKCOption_AccessZ_None_class =
3819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
3820 CHECK(LDKCOption_AccessZ_None_class != NULL);
3821 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
3822 CHECK(LDKCOption_AccessZ_None_meth != NULL);
3824 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3825 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3827 case LDKCOption_AccessZ_Some: {
3828 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3829 *some_ret = obj->some;
3830 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3831 if ((*some_ret).free == LDKAccess_JCalls_free) {
3832 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3833 LDKAccess_JCalls_cloned(&(*some_ret));
3835 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
3837 case LDKCOption_AccessZ_None: {
3838 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
3843 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3844 CHECK(owner->result_ok);
3845 return *owner->contents.result;
3847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3848 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3849 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3853 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3854 CHECK(!owner->result_ok);
3855 return LightningError_clone(&*owner->contents.err);
3857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3858 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3859 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3860 int64_t ret_ref = 0;
3861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3864 ret_ref = (uintptr_t)ret_var.inner;
3865 if (ret_var.is_owned) {
3871 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3872 return ChannelAnnouncement_clone(&owner->a);
3874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3875 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3876 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3877 int64_t ret_ref = 0;
3878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3881 ret_ref = (uintptr_t)ret_var.inner;
3882 if (ret_var.is_owned) {
3888 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3889 return ChannelUpdate_clone(&owner->b);
3891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3892 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3893 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(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 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3906 return ChannelUpdate_clone(&owner->c);
3908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3909 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3910 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3911 int64_t ret_ref = 0;
3912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3915 ret_ref = (uintptr_t)ret_var.inner;
3916 if (ret_var.is_owned) {
3922 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3923 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3924 for (size_t i = 0; i < ret.datalen; i++) {
3925 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3929 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3930 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3931 for (size_t i = 0; i < ret.datalen; i++) {
3932 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3936 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3937 CHECK(owner->result_ok);
3938 return *owner->contents.result;
3940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3941 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3942 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3945 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3946 CHECK(!owner->result_ok);
3947 return LightningError_clone(&*owner->contents.err);
3949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3950 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3951 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3952 int64_t ret_ref = 0;
3953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3956 ret_ref = (uintptr_t)ret_var.inner;
3957 if (ret_var.is_owned) {
3963 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3964 CHECK(owner->result_ok);
3965 return ChannelUpdateInfo_clone(&*owner->contents.result);
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3968 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3969 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3970 int64_t ret_ref = 0;
3971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3974 ret_ref = (uintptr_t)ret_var.inner;
3975 if (ret_var.is_owned) {
3981 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3982 CHECK(!owner->result_ok);
3983 return DecodeError_clone(&*owner->contents.err);
3985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3986 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3987 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3988 int64_t ret_ref = 0;
3989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3992 ret_ref = (uintptr_t)ret_var.inner;
3993 if (ret_var.is_owned) {
3999 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4000 CHECK(owner->result_ok);
4001 return ChannelInfo_clone(&*owner->contents.result);
4003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4004 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4005 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4006 int64_t ret_ref = 0;
4007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4010 ret_ref = (uintptr_t)ret_var.inner;
4011 if (ret_var.is_owned) {
4017 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4018 CHECK(!owner->result_ok);
4019 return DecodeError_clone(&*owner->contents.err);
4021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4022 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4023 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4024 int64_t ret_ref = 0;
4025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4028 ret_ref = (uintptr_t)ret_var.inner;
4029 if (ret_var.is_owned) {
4035 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4036 CHECK(owner->result_ok);
4037 return RoutingFees_clone(&*owner->contents.result);
4039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4040 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4041 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4042 int64_t ret_ref = 0;
4043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4046 ret_ref = (uintptr_t)ret_var.inner;
4047 if (ret_var.is_owned) {
4053 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4054 CHECK(!owner->result_ok);
4055 return DecodeError_clone(&*owner->contents.err);
4057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4058 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4059 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4060 int64_t ret_ref = 0;
4061 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4062 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4064 ret_ref = (uintptr_t)ret_var.inner;
4065 if (ret_var.is_owned) {
4071 static jclass LDKNetAddress_IPv4_class = NULL;
4072 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4073 static jclass LDKNetAddress_IPv6_class = NULL;
4074 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4075 static jclass LDKNetAddress_OnionV2_class = NULL;
4076 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4077 static jclass LDKNetAddress_OnionV3_class = NULL;
4078 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4080 LDKNetAddress_IPv4_class =
4081 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4082 CHECK(LDKNetAddress_IPv4_class != NULL);
4083 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4084 CHECK(LDKNetAddress_IPv4_meth != NULL);
4085 LDKNetAddress_IPv6_class =
4086 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4087 CHECK(LDKNetAddress_IPv6_class != NULL);
4088 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4089 CHECK(LDKNetAddress_IPv6_meth != NULL);
4090 LDKNetAddress_OnionV2_class =
4091 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4092 CHECK(LDKNetAddress_OnionV2_class != NULL);
4093 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4094 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4095 LDKNetAddress_OnionV3_class =
4096 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4097 CHECK(LDKNetAddress_OnionV3_class != NULL);
4098 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4099 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4101 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4102 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4104 case LDKNetAddress_IPv4: {
4105 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4106 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4107 int16_t port_conv = obj->i_pv4.port;
4108 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4110 case LDKNetAddress_IPv6: {
4111 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4112 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4113 int16_t port_conv = obj->i_pv6.port;
4114 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4116 case LDKNetAddress_OnionV2: {
4117 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4118 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4119 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4121 case LDKNetAddress_OnionV3: {
4122 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4123 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4124 int16_t checksum_conv = obj->onion_v3.checksum;
4125 int8_t version_conv = obj->onion_v3.version;
4126 int16_t port_conv = obj->onion_v3.port;
4127 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4132 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4133 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4134 for (size_t i = 0; i < ret.datalen; i++) {
4135 ret.data[i] = NetAddress_clone(&orig->data[i]);
4139 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4140 CHECK(owner->result_ok);
4141 return NodeAnnouncementInfo_clone(&*owner->contents.result);
4143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4144 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4145 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4146 int64_t ret_ref = 0;
4147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4150 ret_ref = (uintptr_t)ret_var.inner;
4151 if (ret_var.is_owned) {
4157 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4158 CHECK(!owner->result_ok);
4159 return DecodeError_clone(&*owner->contents.err);
4161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4162 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4163 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4164 int64_t ret_ref = 0;
4165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4168 ret_ref = (uintptr_t)ret_var.inner;
4169 if (ret_var.is_owned) {
4175 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4176 CHECK(owner->result_ok);
4177 return NodeAlias_clone(&*owner->contents.result);
4179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4180 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4181 LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4182 int64_t ret_ref = 0;
4183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4186 ret_ref = (uintptr_t)ret_var.inner;
4187 if (ret_var.is_owned) {
4193 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4194 CHECK(!owner->result_ok);
4195 return DecodeError_clone(&*owner->contents.err);
4197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4198 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4199 LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4200 int64_t ret_ref = 0;
4201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4204 ret_ref = (uintptr_t)ret_var.inner;
4205 if (ret_var.is_owned) {
4211 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4212 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4213 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4216 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4217 CHECK(owner->result_ok);
4218 return NodeInfo_clone(&*owner->contents.result);
4220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4221 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4222 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4223 int64_t ret_ref = 0;
4224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4227 ret_ref = (uintptr_t)ret_var.inner;
4228 if (ret_var.is_owned) {
4234 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4235 CHECK(!owner->result_ok);
4236 return DecodeError_clone(&*owner->contents.err);
4238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4239 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4240 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4241 int64_t ret_ref = 0;
4242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4245 ret_ref = (uintptr_t)ret_var.inner;
4246 if (ret_var.is_owned) {
4252 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4253 CHECK(owner->result_ok);
4254 return &*owner->contents.result;
4256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4257 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4258 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4259 int64_t ret_ref = 0;
4260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4263 ret_ref = (uintptr_t)ret_var.inner & ~1;
4267 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4268 CHECK(!owner->result_ok);
4269 return DecodeError_clone(&*owner->contents.err);
4271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4272 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4273 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4274 int64_t ret_ref = 0;
4275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4278 ret_ref = (uintptr_t)ret_var.inner;
4279 if (ret_var.is_owned) {
4285 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4286 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4287 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4288 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4290 LDKCOption_CVec_NetAddressZZ_Some_class =
4291 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4292 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4293 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4294 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4295 LDKCOption_CVec_NetAddressZZ_None_class =
4296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4297 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4298 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4299 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4301 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4302 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4304 case LDKCOption_CVec_NetAddressZZ_Some: {
4305 LDKCVec_NetAddressZ some_var = obj->some;
4306 int64_tArray some_arr = NULL;
4307 some_arr = (*env)->NewLongArray(env, some_var.datalen);
4308 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4309 for (size_t m = 0; m < some_var.datalen; m++) {
4310 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
4311 some_arr_ptr[m] = some_conv_12_ref;
4313 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4314 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4316 case LDKCOption_CVec_NetAddressZZ_None: {
4317 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4322 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4323 CHECK(owner->result_ok);
4324 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
4326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4327 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4328 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4329 int64_t ret_ref = 0;
4330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4333 ret_ref = (uintptr_t)ret_var.inner;
4334 if (ret_var.is_owned) {
4340 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4341 CHECK(!owner->result_ok);
4342 return DecodeError_clone(&*owner->contents.err);
4344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4345 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4346 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4347 int64_t ret_ref = 0;
4348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4351 ret_ref = (uintptr_t)ret_var.inner;
4352 if (ret_var.is_owned) {
4358 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4359 CHECK(owner->result_ok);
4360 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
4362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4363 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4364 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4365 int64_t ret_ref = 0;
4366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4369 ret_ref = (uintptr_t)ret_var.inner;
4370 if (ret_var.is_owned) {
4376 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4377 CHECK(!owner->result_ok);
4378 return DecodeError_clone(&*owner->contents.err);
4380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4381 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4382 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4383 int64_t ret_ref = 0;
4384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4387 ret_ref = (uintptr_t)ret_var.inner;
4388 if (ret_var.is_owned) {
4394 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4395 CHECK(owner->result_ok);
4396 return SpendableOutputDescriptor_clone(&*owner->contents.result);
4398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4399 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4400 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4401 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4402 int64_t ret_ref = (uintptr_t)ret_copy;
4406 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4407 CHECK(!owner->result_ok);
4408 return DecodeError_clone(&*owner->contents.err);
4410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4411 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4412 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4413 int64_t ret_ref = 0;
4414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4417 ret_ref = (uintptr_t)ret_var.inner;
4418 if (ret_var.is_owned) {
4424 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4425 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4426 for (size_t i = 0; i < ret.datalen; i++) {
4427 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4431 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4435 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4436 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4437 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4441 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4444 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4445 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4446 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4447 jobjectArray ret_arr = NULL;
4448 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4450 for (size_t i = 0; i < ret_var.datalen; i++) {
4451 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4452 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4453 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4459 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4460 CHECK(owner->result_ok);
4461 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4464 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4465 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4466 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4467 return ((int64_t)ret_conv);
4470 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4471 CHECK(!owner->result_ok);
4472 return *owner->contents.err;
4474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4475 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4476 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4479 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4480 CHECK(owner->result_ok);
4481 return *owner->contents.result;
4483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4484 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4485 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4486 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4490 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4491 CHECK(!owner->result_ok);
4492 return *owner->contents.err;
4494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4495 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4496 CResult_SignatureNoneZ_get_err(owner_conv);
4499 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4503 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4504 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4509 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4513 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4514 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4515 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4519 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4520 CHECK(owner->result_ok);
4521 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4524 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4525 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4526 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4527 return ((int64_t)ret_conv);
4530 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4531 CHECK(!owner->result_ok);
4532 return *owner->contents.err;
4534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4535 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4536 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4539 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4540 CHECK(owner->result_ok);
4541 return *owner->contents.result;
4543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4544 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4545 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4550 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4551 CHECK(!owner->result_ok);
4552 return *owner->contents.err;
4554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4555 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4556 CResult_SecretKeyNoneZ_get_err(owner_conv);
4559 typedef struct LDKBaseSign_JCalls {
4560 atomic_size_t refcnt;
4563 jmethodID get_per_commitment_point_meth;
4564 jmethodID release_commitment_secret_meth;
4565 jmethodID validate_holder_commitment_meth;
4566 jmethodID channel_keys_id_meth;
4567 jmethodID sign_counterparty_commitment_meth;
4568 jmethodID validate_counterparty_revocation_meth;
4569 jmethodID sign_holder_commitment_and_htlcs_meth;
4570 jmethodID sign_justice_revoked_output_meth;
4571 jmethodID sign_justice_revoked_htlc_meth;
4572 jmethodID sign_counterparty_htlc_transaction_meth;
4573 jmethodID sign_closing_transaction_meth;
4574 jmethodID sign_channel_announcement_meth;
4575 jmethodID ready_channel_meth;
4576 } LDKBaseSign_JCalls;
4577 static void LDKBaseSign_JCalls_free(void* this_arg) {
4578 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4579 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4581 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4582 if (get_jenv_res == JNI_EDETACHED) {
4583 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4585 DO_ASSERT(get_jenv_res == JNI_OK);
4587 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4588 if (get_jenv_res == JNI_EDETACHED) {
4589 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4594 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4595 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4597 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4598 if (get_jenv_res == JNI_EDETACHED) {
4599 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4601 DO_ASSERT(get_jenv_res == JNI_OK);
4603 int64_t idx_conv = idx;
4604 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4606 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4607 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4608 (*env)->ExceptionDescribe(env);
4609 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4611 LDKPublicKey ret_ref;
4612 CHECK((*env)->GetArrayLength(env, ret) == 33);
4613 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4614 if (get_jenv_res == JNI_EDETACHED) {
4615 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4619 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4620 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4623 if (get_jenv_res == JNI_EDETACHED) {
4624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4626 DO_ASSERT(get_jenv_res == JNI_OK);
4628 int64_t idx_conv = idx;
4629 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4631 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4632 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4633 (*env)->ExceptionDescribe(env);
4634 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4636 LDKThirtyTwoBytes ret_ref;
4637 CHECK((*env)->GetArrayLength(env, ret) == 32);
4638 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4639 if (get_jenv_res == JNI_EDETACHED) {
4640 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4644 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4645 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4647 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4648 if (get_jenv_res == JNI_EDETACHED) {
4649 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4651 DO_ASSERT(get_jenv_res == JNI_OK);
4653 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4654 int64_t holder_tx_ref = 0;
4655 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4656 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4657 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4658 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4659 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
4660 if (holder_tx_var.is_owned) {
4663 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4664 jobjectArray preimages_arr = NULL;
4665 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4667 for (size_t i = 0; i < preimages_var.datalen; i++) {
4668 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4669 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4670 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4673 FREE(preimages_var.data);
4674 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4676 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4677 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4678 (*env)->ExceptionDescribe(env);
4679 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4681 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4682 CHECK_ACCESS(ret_ptr);
4683 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4685 if (get_jenv_res == JNI_EDETACHED) {
4686 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4690 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4691 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4693 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4694 if (get_jenv_res == JNI_EDETACHED) {
4695 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4697 DO_ASSERT(get_jenv_res == JNI_OK);
4699 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4701 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4702 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4703 (*env)->ExceptionDescribe(env);
4704 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4706 LDKThirtyTwoBytes ret_ref;
4707 CHECK((*env)->GetArrayLength(env, ret) == 32);
4708 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4709 if (get_jenv_res == JNI_EDETACHED) {
4710 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4714 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4715 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4717 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4718 if (get_jenv_res == JNI_EDETACHED) {
4719 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4721 DO_ASSERT(get_jenv_res == JNI_OK);
4723 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4724 int64_t commitment_tx_ref = 0;
4725 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4726 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4727 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4728 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4729 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4730 if (commitment_tx_var.is_owned) {
4731 commitment_tx_ref |= 1;
4733 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4734 jobjectArray preimages_arr = NULL;
4735 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4737 for (size_t i = 0; i < preimages_var.datalen; i++) {
4738 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4739 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4740 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4743 FREE(preimages_var.data);
4744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4746 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4747 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4748 (*env)->ExceptionDescribe(env);
4749 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4751 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4752 CHECK_ACCESS(ret_ptr);
4753 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4755 if (get_jenv_res == JNI_EDETACHED) {
4756 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4760 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4761 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4763 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4764 if (get_jenv_res == JNI_EDETACHED) {
4765 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4767 DO_ASSERT(get_jenv_res == JNI_OK);
4769 int64_t idx_conv = idx;
4770 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4771 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4772 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4774 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4775 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4776 (*env)->ExceptionDescribe(env);
4777 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4779 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4780 CHECK_ACCESS(ret_ptr);
4781 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4783 if (get_jenv_res == JNI_EDETACHED) {
4784 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4788 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4789 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4791 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4792 if (get_jenv_res == JNI_EDETACHED) {
4793 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4795 DO_ASSERT(get_jenv_res == JNI_OK);
4797 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4798 int64_t commitment_tx_ref = 0;
4799 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4800 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4801 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4802 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4803 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4804 if (commitment_tx_var.is_owned) {
4805 commitment_tx_ref |= 1;
4807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4809 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
4810 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4811 (*env)->ExceptionDescribe(env);
4812 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
4814 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4815 CHECK_ACCESS(ret_ptr);
4816 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4818 if (get_jenv_res == JNI_EDETACHED) {
4819 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4823 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]) {
4824 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4826 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4827 if (get_jenv_res == JNI_EDETACHED) {
4828 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4830 DO_ASSERT(get_jenv_res == JNI_OK);
4832 LDKTransaction justice_tx_var = justice_tx;
4833 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4834 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4835 Transaction_free(justice_tx_var);
4836 int64_t input_conv = input;
4837 int64_t amount_conv = amount;
4838 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4839 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4840 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4842 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);
4843 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4844 (*env)->ExceptionDescribe(env);
4845 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4847 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4848 CHECK_ACCESS(ret_ptr);
4849 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4851 if (get_jenv_res == JNI_EDETACHED) {
4852 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4856 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) {
4857 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4859 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4860 if (get_jenv_res == JNI_EDETACHED) {
4861 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4863 DO_ASSERT(get_jenv_res == JNI_OK);
4865 LDKTransaction justice_tx_var = justice_tx;
4866 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4867 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4868 Transaction_free(justice_tx_var);
4869 int64_t input_conv = input;
4870 int64_t amount_conv = amount;
4871 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4872 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4873 LDKHTLCOutputInCommitment htlc_var = *htlc;
4874 int64_t htlc_ref = 0;
4875 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4876 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4877 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4878 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4879 htlc_ref = (uintptr_t)htlc_var.inner;
4880 if (htlc_var.is_owned) {
4883 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4885 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);
4886 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4887 (*env)->ExceptionDescribe(env);
4888 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4890 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4891 CHECK_ACCESS(ret_ptr);
4892 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4894 if (get_jenv_res == JNI_EDETACHED) {
4895 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4899 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) {
4900 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4903 if (get_jenv_res == JNI_EDETACHED) {
4904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4906 DO_ASSERT(get_jenv_res == JNI_OK);
4908 LDKTransaction htlc_tx_var = htlc_tx;
4909 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4910 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4911 Transaction_free(htlc_tx_var);
4912 int64_t input_conv = input;
4913 int64_t amount_conv = amount;
4914 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4915 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4916 LDKHTLCOutputInCommitment htlc_var = *htlc;
4917 int64_t htlc_ref = 0;
4918 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4919 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4920 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4921 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4922 htlc_ref = (uintptr_t)htlc_var.inner;
4923 if (htlc_var.is_owned) {
4926 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4928 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);
4929 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4930 (*env)->ExceptionDescribe(env);
4931 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4933 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4934 CHECK_ACCESS(ret_ptr);
4935 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4937 if (get_jenv_res == JNI_EDETACHED) {
4938 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4942 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4943 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4945 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4946 if (get_jenv_res == JNI_EDETACHED) {
4947 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4949 DO_ASSERT(get_jenv_res == JNI_OK);
4951 LDKClosingTransaction closing_tx_var = *closing_tx;
4952 int64_t closing_tx_ref = 0;
4953 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4954 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4955 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4956 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4957 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4958 if (closing_tx_var.is_owned) {
4959 closing_tx_ref |= 1;
4961 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4963 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4964 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4965 (*env)->ExceptionDescribe(env);
4966 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4968 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4969 CHECK_ACCESS(ret_ptr);
4970 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4972 if (get_jenv_res == JNI_EDETACHED) {
4973 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4977 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4978 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4980 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4981 if (get_jenv_res == JNI_EDETACHED) {
4982 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4984 DO_ASSERT(get_jenv_res == JNI_OK);
4986 LDKUnsignedChannelAnnouncement msg_var = *msg;
4987 int64_t msg_ref = 0;
4988 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4989 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4990 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4991 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4992 msg_ref = (uintptr_t)msg_var.inner;
4993 if (msg_var.is_owned) {
4996 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4998 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4999 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5000 (*env)->ExceptionDescribe(env);
5001 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
5003 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5004 CHECK_ACCESS(ret_ptr);
5005 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
5007 if (get_jenv_res == JNI_EDETACHED) {
5008 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5012 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
5013 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5015 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5016 if (get_jenv_res == JNI_EDETACHED) {
5017 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5019 DO_ASSERT(get_jenv_res == JNI_OK);
5021 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
5022 int64_t channel_parameters_ref = 0;
5023 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
5024 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5025 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5026 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
5027 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
5028 if (channel_parameters_var.is_owned) {
5029 channel_parameters_ref |= 1;
5031 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5033 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
5034 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5035 (*env)->ExceptionDescribe(env);
5036 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
5038 if (get_jenv_res == JNI_EDETACHED) {
5039 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5042 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5043 jclass c = (*env)->GetObjectClass(env, o);
5045 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
5046 atomic_init(&calls->refcnt, 1);
5047 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5048 calls->o = (*env)->NewWeakGlobalRef(env, o);
5049 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
5050 CHECK(calls->get_per_commitment_point_meth != NULL);
5051 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
5052 CHECK(calls->release_commitment_secret_meth != NULL);
5053 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
5054 CHECK(calls->validate_holder_commitment_meth != NULL);
5055 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
5056 CHECK(calls->channel_keys_id_meth != NULL);
5057 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
5058 CHECK(calls->sign_counterparty_commitment_meth != NULL);
5059 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
5060 CHECK(calls->validate_counterparty_revocation_meth != NULL);
5061 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
5062 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
5063 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
5064 CHECK(calls->sign_justice_revoked_output_meth != NULL);
5065 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
5066 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
5067 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
5068 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
5069 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
5070 CHECK(calls->sign_closing_transaction_meth != NULL);
5071 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
5072 CHECK(calls->sign_channel_announcement_meth != NULL);
5073 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
5074 CHECK(calls->ready_channel_meth != NULL);
5076 LDKChannelPublicKeys pubkeys_conv;
5077 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5078 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5079 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5082 .this_arg = (void*) calls,
5083 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
5084 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
5085 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
5086 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
5087 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
5088 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
5089 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
5090 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
5091 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
5092 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
5093 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
5094 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
5095 .ready_channel = ready_channel_LDKBaseSign_jcall,
5096 .free = LDKBaseSign_JCalls_free,
5097 .pubkeys = pubkeys_conv,
5098 .set_pubkeys = NULL,
5102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5103 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
5104 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
5105 return (uint64_t)res_ptr;
5107 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) {
5108 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5109 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5110 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5111 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5112 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5117 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5118 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5119 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5120 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5121 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5125 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) {
5126 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5127 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5128 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5129 LDKHolderCommitmentTransaction holder_tx_conv;
5130 holder_tx_conv.inner = (void*)(holder_tx & (~1));
5131 holder_tx_conv.is_owned = false;
5132 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5133 LDKCVec_PaymentPreimageZ preimages_constr;
5134 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5135 if (preimages_constr.datalen > 0)
5136 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5138 preimages_constr.data = NULL;
5139 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5140 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5141 LDKThirtyTwoBytes preimages_conv_8_ref;
5142 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5143 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5144 preimages_constr.data[i] = preimages_conv_8_ref;
5146 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5147 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5148 return (int64_t)ret_conv;
5151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5152 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5153 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5154 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5155 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5160 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) {
5161 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5162 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5163 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5164 LDKCommitmentTransaction commitment_tx_conv;
5165 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5166 commitment_tx_conv.is_owned = false;
5167 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5168 LDKCVec_PaymentPreimageZ preimages_constr;
5169 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5170 if (preimages_constr.datalen > 0)
5171 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5173 preimages_constr.data = NULL;
5174 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5175 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5176 LDKThirtyTwoBytes preimages_conv_8_ref;
5177 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5178 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5179 preimages_constr.data[i] = preimages_conv_8_ref;
5181 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5182 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
5183 return (int64_t)ret_conv;
5186 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) {
5187 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5188 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5189 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5190 unsigned char secret_arr[32];
5191 CHECK((*env)->GetArrayLength(env, secret) == 32);
5192 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5193 unsigned char (*secret_ref)[32] = &secret_arr;
5194 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5195 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5196 return (int64_t)ret_conv;
5199 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) {
5200 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5201 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5202 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5203 LDKHolderCommitmentTransaction commitment_tx_conv;
5204 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5205 commitment_tx_conv.is_owned = false;
5206 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5207 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5208 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5209 return (int64_t)ret_conv;
5212 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) {
5213 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5214 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5215 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5216 LDKTransaction justice_tx_ref;
5217 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5218 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5219 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5220 justice_tx_ref.data_is_owned = true;
5221 unsigned char per_commitment_key_arr[32];
5222 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5223 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5224 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5225 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5226 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5227 return (int64_t)ret_conv;
5230 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) {
5231 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5232 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5233 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5234 LDKTransaction justice_tx_ref;
5235 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5236 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5237 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5238 justice_tx_ref.data_is_owned = true;
5239 unsigned char per_commitment_key_arr[32];
5240 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5241 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5242 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5243 LDKHTLCOutputInCommitment htlc_conv;
5244 htlc_conv.inner = (void*)(htlc & (~1));
5245 htlc_conv.is_owned = false;
5246 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5247 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5248 *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);
5249 return (int64_t)ret_conv;
5252 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) {
5253 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5254 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5255 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5256 LDKTransaction htlc_tx_ref;
5257 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5258 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5259 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5260 htlc_tx_ref.data_is_owned = true;
5261 LDKPublicKey per_commitment_point_ref;
5262 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5263 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5264 LDKHTLCOutputInCommitment htlc_conv;
5265 htlc_conv.inner = (void*)(htlc & (~1));
5266 htlc_conv.is_owned = false;
5267 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5268 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5269 *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);
5270 return (int64_t)ret_conv;
5273 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) {
5274 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5275 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5276 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5277 LDKClosingTransaction closing_tx_conv;
5278 closing_tx_conv.inner = (void*)(closing_tx & (~1));
5279 closing_tx_conv.is_owned = false;
5280 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5281 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5282 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5283 return (int64_t)ret_conv;
5286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5287 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5288 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5289 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5290 LDKUnsignedChannelAnnouncement msg_conv;
5291 msg_conv.inner = (void*)(msg & (~1));
5292 msg_conv.is_owned = false;
5293 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5294 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5295 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5296 return (int64_t)ret_conv;
5299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5300 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5301 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5302 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5303 LDKChannelTransactionParameters channel_parameters_conv;
5304 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
5305 channel_parameters_conv.is_owned = false;
5306 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5307 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5310 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5311 if (this_arg->set_pubkeys != NULL)
5312 this_arg->set_pubkeys(this_arg);
5313 return this_arg->pubkeys;
5315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
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 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5320 int64_t ret_ref = 0;
5321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5324 ret_ref = (uintptr_t)ret_var.inner;
5325 if (ret_var.is_owned) {
5331 typedef struct LDKSign_JCalls {
5332 atomic_size_t refcnt;
5335 LDKBaseSign_JCalls* BaseSign;
5336 jmethodID write_meth;
5338 static void LDKSign_JCalls_free(void* this_arg) {
5339 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5340 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5342 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5343 if (get_jenv_res == JNI_EDETACHED) {
5344 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5346 DO_ASSERT(get_jenv_res == JNI_OK);
5348 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5349 if (get_jenv_res == JNI_EDETACHED) {
5350 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5355 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5356 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5358 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5359 if (get_jenv_res == JNI_EDETACHED) {
5360 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5362 DO_ASSERT(get_jenv_res == JNI_OK);
5364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5366 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5367 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5368 (*env)->ExceptionDescribe(env);
5369 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5371 LDKCVec_u8Z ret_ref;
5372 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5373 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5374 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5375 if (get_jenv_res == JNI_EDETACHED) {
5376 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5380 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5381 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5382 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5383 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5385 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5386 jclass c = (*env)->GetObjectClass(env, o);
5388 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5389 atomic_init(&calls->refcnt, 1);
5390 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5391 calls->o = (*env)->NewWeakGlobalRef(env, o);
5392 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5393 CHECK(calls->write_meth != NULL);
5395 LDKChannelPublicKeys pubkeys_conv;
5396 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5397 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5398 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5401 .this_arg = (void*) calls,
5402 .write = write_LDKSign_jcall,
5403 .cloned = LDKSign_JCalls_cloned,
5404 .free = LDKSign_JCalls_free,
5405 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5407 calls->BaseSign = ret.BaseSign.this_arg;
5410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5411 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5412 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5413 return (uint64_t)res_ptr;
5415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5416 LDKSign *inp = (LDKSign *)(arg & ~1);
5417 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
5418 DO_ASSERT((res_ptr & 1) == 0);
5419 return (int64_t)(res_ptr | 1);
5421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5422 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5423 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5424 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5425 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5426 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5427 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5428 CVec_u8Z_free(ret_var);
5432 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5433 CHECK(owner->result_ok);
5434 return Sign_clone(&*owner->contents.result);
5436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5437 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5438 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5439 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5440 return (int64_t)ret_ret;
5443 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5444 CHECK(!owner->result_ok);
5445 return DecodeError_clone(&*owner->contents.err);
5447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5448 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5449 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5450 int64_t ret_ref = 0;
5451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5454 ret_ref = (uintptr_t)ret_var.inner;
5455 if (ret_var.is_owned) {
5461 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5462 CHECK(owner->result_ok);
5463 return *owner->contents.result;
5465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5466 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5467 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5472 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5473 CHECK(!owner->result_ok);
5474 return *owner->contents.err;
5476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5477 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5478 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5481 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5482 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5483 for (size_t i = 0; i < ret.datalen; i++) {
5484 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5488 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5489 CHECK(owner->result_ok);
5490 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5492 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5493 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5494 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5495 jobjectArray ret_arr = NULL;
5496 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5498 for (size_t i = 0; i < ret_var.datalen; i++) {
5499 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5500 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5501 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5502 CVec_u8Z_free(ret_conv_8_var);
5503 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5510 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5511 CHECK(!owner->result_ok);
5512 return *owner->contents.err;
5514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5515 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5516 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5519 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5520 CHECK(owner->result_ok);
5521 return InMemorySigner_clone(&*owner->contents.result);
5523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5524 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5525 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5526 int64_t ret_ref = 0;
5527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5530 ret_ref = (uintptr_t)ret_var.inner;
5531 if (ret_var.is_owned) {
5537 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5538 CHECK(!owner->result_ok);
5539 return DecodeError_clone(&*owner->contents.err);
5541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5542 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5543 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5544 int64_t ret_ref = 0;
5545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5548 ret_ref = (uintptr_t)ret_var.inner;
5549 if (ret_var.is_owned) {
5555 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5556 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5557 for (size_t i = 0; i < ret.datalen; i++) {
5558 ret.data[i] = TxOut_clone(&orig->data[i]);
5562 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5563 CHECK(owner->result_ok);
5564 return *owner->contents.result;
5566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5567 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5568 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5569 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5570 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5574 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5575 CHECK(!owner->result_ok);
5576 return *owner->contents.err;
5578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5579 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5580 CResult_TransactionNoneZ_get_err(owner_conv);
5583 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5584 return ThirtyTwoBytes_clone(&owner->a);
5586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5587 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5588 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5593 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5594 return ChannelMonitor_clone(&owner->b);
5596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5597 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5598 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5599 int64_t ret_ref = 0;
5600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5603 ret_ref = (uintptr_t)ret_var.inner;
5604 if (ret_var.is_owned) {
5610 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5611 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5612 for (size_t i = 0; i < ret.datalen; i++) {
5613 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5617 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5618 CHECK(owner->result_ok);
5619 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5621 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5622 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5623 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5624 int64_tArray ret_arr = NULL;
5625 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5626 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5627 for (size_t j = 0; j < ret_var.datalen; j++) {
5628 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5629 *ret_conv_35_conv = ret_var.data[j];
5630 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
5632 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5637 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5638 CHECK(!owner->result_ok);
5639 return *owner->contents.err;
5641 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5642 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5643 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5647 static jclass LDKCOption_u16Z_Some_class = NULL;
5648 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5649 static jclass LDKCOption_u16Z_None_class = NULL;
5650 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5652 LDKCOption_u16Z_Some_class =
5653 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5654 CHECK(LDKCOption_u16Z_Some_class != NULL);
5655 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5656 CHECK(LDKCOption_u16Z_Some_meth != NULL);
5657 LDKCOption_u16Z_None_class =
5658 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5659 CHECK(LDKCOption_u16Z_None_class != NULL);
5660 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5661 CHECK(LDKCOption_u16Z_None_meth != NULL);
5663 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5664 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5666 case LDKCOption_u16Z_Some: {
5667 int16_t some_conv = obj->some;
5668 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5670 case LDKCOption_u16Z_None: {
5671 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5676 static jclass LDKAPIError_APIMisuseError_class = NULL;
5677 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5678 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5679 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5680 static jclass LDKAPIError_RouteError_class = NULL;
5681 static jmethodID LDKAPIError_RouteError_meth = NULL;
5682 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5683 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5684 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5685 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5686 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5687 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5689 LDKAPIError_APIMisuseError_class =
5690 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5691 CHECK(LDKAPIError_APIMisuseError_class != NULL);
5692 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5693 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5694 LDKAPIError_FeeRateTooHigh_class =
5695 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5696 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5697 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5698 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5699 LDKAPIError_RouteError_class =
5700 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5701 CHECK(LDKAPIError_RouteError_class != NULL);
5702 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5703 CHECK(LDKAPIError_RouteError_meth != NULL);
5704 LDKAPIError_ChannelUnavailable_class =
5705 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5706 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5707 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5708 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5709 LDKAPIError_MonitorUpdateFailed_class =
5710 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5711 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5712 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5713 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5714 LDKAPIError_IncompatibleShutdownScript_class =
5715 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5716 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5717 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5718 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5720 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5721 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5723 case LDKAPIError_APIMisuseError: {
5724 LDKStr err_str = obj->api_misuse_error.err;
5725 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5726 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5728 case LDKAPIError_FeeRateTooHigh: {
5729 LDKStr err_str = obj->fee_rate_too_high.err;
5730 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5731 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5732 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5734 case LDKAPIError_RouteError: {
5735 LDKStr err_str = obj->route_error.err;
5736 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5737 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5739 case LDKAPIError_ChannelUnavailable: {
5740 LDKStr err_str = obj->channel_unavailable.err;
5741 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5742 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5744 case LDKAPIError_MonitorUpdateFailed: {
5745 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5747 case LDKAPIError_IncompatibleShutdownScript: {
5748 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5749 int64_t script_ref = 0;
5750 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5751 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5752 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5753 script_ref = (uintptr_t)script_var.inner & ~1;
5754 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5759 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5760 CHECK(owner->result_ok);
5761 return *owner->contents.result;
5763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5764 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5765 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5768 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5769 CHECK(!owner->result_ok);
5770 return APIError_clone(&*owner->contents.err);
5772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5773 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5774 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5775 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5776 int64_t ret_ref = (uintptr_t)ret_copy;
5780 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5781 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5782 for (size_t i = 0; i < ret.datalen; i++) {
5783 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5787 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5788 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5789 for (size_t i = 0; i < ret.datalen; i++) {
5790 ret.data[i] = APIError_clone(&orig->data[i]);
5794 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5795 CHECK(owner->result_ok);
5796 return ThirtyTwoBytes_clone(&*owner->contents.result);
5798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5799 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5800 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5801 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
5805 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5806 CHECK(!owner->result_ok);
5807 return APIError_clone(&*owner->contents.err);
5809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5810 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5811 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5812 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5813 int64_t ret_ref = (uintptr_t)ret_copy;
5817 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
5818 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
5819 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
5820 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
5821 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
5822 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
5823 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
5824 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
5825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
5826 LDKPaymentSendFailure_ParameterError_class =
5827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
5828 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
5829 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
5830 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
5831 LDKPaymentSendFailure_PathParameterError_class =
5832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
5833 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
5834 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
5835 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
5836 LDKPaymentSendFailure_AllFailedRetrySafe_class =
5837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
5838 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
5839 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
5840 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
5841 LDKPaymentSendFailure_PartialFailure_class =
5842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
5843 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5844 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5845 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5848 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5850 case LDKPaymentSendFailure_ParameterError: {
5851 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
5852 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5854 case LDKPaymentSendFailure_PathParameterError: {
5855 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5856 int64_tArray path_parameter_error_arr = NULL;
5857 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5858 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5859 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5860 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5861 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5862 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5863 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
5865 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5866 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5868 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5869 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5870 int64_tArray all_failed_retry_safe_arr = NULL;
5871 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5872 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5873 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5874 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
5875 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5877 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5878 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5880 case LDKPaymentSendFailure_PartialFailure: {
5881 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5882 int64_tArray results_arr = NULL;
5883 results_arr = (*env)->NewLongArray(env, results_var.datalen);
5884 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5885 for (size_t w = 0; w < results_var.datalen; w++) {
5886 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5887 *results_conv_22_conv = results_var.data[w];
5888 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5889 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
5891 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5892 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5893 int64_t failed_paths_retry_ref = 0;
5894 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
5895 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5896 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5897 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5898 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
5900 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5901 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5902 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5907 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5908 CHECK(owner->result_ok);
5909 return ThirtyTwoBytes_clone(&*owner->contents.result);
5911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5912 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5913 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5918 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5919 CHECK(!owner->result_ok);
5920 return PaymentSendFailure_clone(&*owner->contents.err);
5922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5923 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5924 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5925 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5926 int64_t ret_ref = (uintptr_t)ret_copy;
5930 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5931 CHECK(owner->result_ok);
5932 return *owner->contents.result;
5934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5935 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5936 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5939 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5940 CHECK(!owner->result_ok);
5941 return PaymentSendFailure_clone(&*owner->contents.err);
5943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5944 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5945 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5946 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5947 int64_t ret_ref = (uintptr_t)ret_copy;
5951 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5952 return ThirtyTwoBytes_clone(&owner->a);
5954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5955 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5956 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5961 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5962 return ThirtyTwoBytes_clone(&owner->b);
5964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5965 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5966 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5967 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5971 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5972 CHECK(owner->result_ok);
5973 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5976 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5977 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5978 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5979 return ((int64_t)ret_conv);
5982 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5983 CHECK(!owner->result_ok);
5984 return PaymentSendFailure_clone(&*owner->contents.err);
5986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5987 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5988 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5989 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5990 int64_t ret_ref = (uintptr_t)ret_copy;
5994 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5995 LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5996 for (size_t i = 0; i < ret.datalen; i++) {
5997 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6001 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6002 return ThirtyTwoBytes_clone(&owner->a);
6004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6005 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6006 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6007 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6011 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6012 return ThirtyTwoBytes_clone(&owner->b);
6014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6015 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6016 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6017 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6021 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6022 CHECK(owner->result_ok);
6023 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6026 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6027 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6028 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6029 return ((int64_t)ret_conv);
6032 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6033 CHECK(!owner->result_ok);
6034 return *owner->contents.err;
6036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6037 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6038 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6041 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6042 CHECK(owner->result_ok);
6043 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6046 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6047 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6048 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6049 return ((int64_t)ret_conv);
6052 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6053 CHECK(!owner->result_ok);
6054 return APIError_clone(&*owner->contents.err);
6056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6057 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6058 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6059 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6060 int64_t ret_ref = (uintptr_t)ret_copy;
6064 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6065 CHECK(owner->result_ok);
6066 return ThirtyTwoBytes_clone(&*owner->contents.result);
6068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6069 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6070 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6071 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6075 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6076 CHECK(!owner->result_ok);
6077 return *owner->contents.err;
6079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6080 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6081 CResult_PaymentSecretNoneZ_get_err(owner_conv);
6084 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6085 CHECK(owner->result_ok);
6086 return ThirtyTwoBytes_clone(&*owner->contents.result);
6088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6089 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6090 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
6095 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6096 CHECK(!owner->result_ok);
6097 return APIError_clone(&*owner->contents.err);
6099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6100 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6101 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6102 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6103 int64_t ret_ref = (uintptr_t)ret_copy;
6107 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6108 CHECK(owner->result_ok);
6109 return ThirtyTwoBytes_clone(&*owner->contents.result);
6111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6112 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6113 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6114 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6118 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6119 CHECK(!owner->result_ok);
6120 return APIError_clone(&*owner->contents.err);
6122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6123 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6124 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6125 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6126 int64_t ret_ref = (uintptr_t)ret_copy;
6130 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6131 CHECK(owner->result_ok);
6132 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
6134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6135 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6136 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6137 int64_t ret_ref = 0;
6138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6141 ret_ref = (uintptr_t)ret_var.inner;
6142 if (ret_var.is_owned) {
6148 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6149 CHECK(!owner->result_ok);
6150 return DecodeError_clone(&*owner->contents.err);
6152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6153 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6154 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6155 int64_t ret_ref = 0;
6156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6159 ret_ref = (uintptr_t)ret_var.inner;
6160 if (ret_var.is_owned) {
6166 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6167 CHECK(owner->result_ok);
6168 return ChannelCounterparty_clone(&*owner->contents.result);
6170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6171 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6172 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6173 int64_t ret_ref = 0;
6174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6177 ret_ref = (uintptr_t)ret_var.inner;
6178 if (ret_var.is_owned) {
6184 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6185 CHECK(!owner->result_ok);
6186 return DecodeError_clone(&*owner->contents.err);
6188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6189 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6190 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6191 int64_t ret_ref = 0;
6192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6195 ret_ref = (uintptr_t)ret_var.inner;
6196 if (ret_var.is_owned) {
6202 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6203 CHECK(owner->result_ok);
6204 return ChannelDetails_clone(&*owner->contents.result);
6206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6207 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6208 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6209 int64_t ret_ref = 0;
6210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6213 ret_ref = (uintptr_t)ret_var.inner;
6214 if (ret_var.is_owned) {
6220 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6221 CHECK(!owner->result_ok);
6222 return DecodeError_clone(&*owner->contents.err);
6224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6225 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6226 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6227 int64_t ret_ref = 0;
6228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6231 ret_ref = (uintptr_t)ret_var.inner;
6232 if (ret_var.is_owned) {
6238 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6239 CHECK(owner->result_ok);
6240 return PhantomRouteHints_clone(&*owner->contents.result);
6242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6243 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6244 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6245 int64_t ret_ref = 0;
6246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6249 ret_ref = (uintptr_t)ret_var.inner;
6250 if (ret_var.is_owned) {
6256 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6257 CHECK(!owner->result_ok);
6258 return DecodeError_clone(&*owner->contents.err);
6260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6261 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6262 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6263 int64_t ret_ref = 0;
6264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6267 ret_ref = (uintptr_t)ret_var.inner;
6268 if (ret_var.is_owned) {
6274 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6275 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6276 for (size_t i = 0; i < ret.datalen; i++) {
6277 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6281 typedef struct LDKWatch_JCalls {
6282 atomic_size_t refcnt;
6285 jmethodID watch_channel_meth;
6286 jmethodID update_channel_meth;
6287 jmethodID release_pending_monitor_events_meth;
6289 static void LDKWatch_JCalls_free(void* this_arg) {
6290 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6291 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6293 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6294 if (get_jenv_res == JNI_EDETACHED) {
6295 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6297 DO_ASSERT(get_jenv_res == JNI_OK);
6299 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6300 if (get_jenv_res == JNI_EDETACHED) {
6301 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6306 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6307 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6309 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6310 if (get_jenv_res == JNI_EDETACHED) {
6311 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6313 DO_ASSERT(get_jenv_res == JNI_OK);
6315 LDKOutPoint funding_txo_var = funding_txo;
6316 int64_t funding_txo_ref = 0;
6317 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6318 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6319 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6320 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6321 if (funding_txo_var.is_owned) {
6322 funding_txo_ref |= 1;
6324 LDKChannelMonitor monitor_var = monitor;
6325 int64_t monitor_ref = 0;
6326 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6327 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6328 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6329 monitor_ref = (uintptr_t)monitor_var.inner;
6330 if (monitor_var.is_owned) {
6333 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6335 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6336 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6337 (*env)->ExceptionDescribe(env);
6338 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6340 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6341 CHECK_ACCESS(ret_ptr);
6342 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6344 if (get_jenv_res == JNI_EDETACHED) {
6345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6349 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6350 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6353 if (get_jenv_res == JNI_EDETACHED) {
6354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6356 DO_ASSERT(get_jenv_res == JNI_OK);
6358 LDKOutPoint funding_txo_var = funding_txo;
6359 int64_t funding_txo_ref = 0;
6360 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6361 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6362 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6363 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6364 if (funding_txo_var.is_owned) {
6365 funding_txo_ref |= 1;
6367 LDKChannelMonitorUpdate update_var = update;
6368 int64_t update_ref = 0;
6369 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6370 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6371 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6372 update_ref = (uintptr_t)update_var.inner;
6373 if (update_var.is_owned) {
6376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6378 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6379 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6380 (*env)->ExceptionDescribe(env);
6381 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6383 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6384 CHECK_ACCESS(ret_ptr);
6385 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6387 if (get_jenv_res == JNI_EDETACHED) {
6388 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6392 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6393 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6396 if (get_jenv_res == JNI_EDETACHED) {
6397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6399 DO_ASSERT(get_jenv_res == JNI_OK);
6401 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6403 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6405 (*env)->ExceptionDescribe(env);
6406 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6408 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr;
6409 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6410 if (ret_constr.datalen > 0)
6411 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
6413 ret_constr.data = NULL;
6414 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6415 for (size_t m = 0; m < ret_constr.datalen; m++) {
6416 int64_t ret_conv_38 = ret_vals[m];
6417 void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1);
6418 CHECK_ACCESS(ret_conv_38_ptr);
6419 LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr);
6420 FREE((void*)ret_conv_38);
6421 ret_constr.data[m] = ret_conv_38_conv;
6423 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6424 if (get_jenv_res == JNI_EDETACHED) {
6425 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6429 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6430 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6431 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6433 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6434 jclass c = (*env)->GetObjectClass(env, o);
6436 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6437 atomic_init(&calls->refcnt, 1);
6438 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6439 calls->o = (*env)->NewWeakGlobalRef(env, o);
6440 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6441 CHECK(calls->watch_channel_meth != NULL);
6442 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6443 CHECK(calls->update_channel_meth != NULL);
6444 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6445 CHECK(calls->release_pending_monitor_events_meth != NULL);
6448 .this_arg = (void*) calls,
6449 .watch_channel = watch_channel_LDKWatch_jcall,
6450 .update_channel = update_channel_LDKWatch_jcall,
6451 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6452 .free = LDKWatch_JCalls_free,
6456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6457 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6458 *res_ptr = LDKWatch_init(env, clz, o);
6459 return (uint64_t)res_ptr;
6461 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) {
6462 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6463 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6464 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6465 LDKOutPoint funding_txo_conv;
6466 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6467 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6468 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6469 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6470 LDKChannelMonitor monitor_conv;
6471 monitor_conv.inner = (void*)(monitor & (~1));
6472 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6473 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6474 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6475 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6476 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6477 return (int64_t)ret_conv;
6480 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) {
6481 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6482 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6483 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6484 LDKOutPoint funding_txo_conv;
6485 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6486 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6487 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6488 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6489 LDKChannelMonitorUpdate update_conv;
6490 update_conv.inner = (void*)(update & (~1));
6491 update_conv.is_owned = (update & 1) || (update == 0);
6492 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6493 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6494 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6495 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6496 return (int64_t)ret_conv;
6499 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6500 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6501 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6502 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6503 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6504 int64_tArray ret_arr = NULL;
6505 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6506 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6507 for (size_t m = 0; m < ret_var.datalen; m++) {
6508 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
6509 *ret_conv_38_conv = ret_var.data[m];
6510 ret_arr_ptr[m] = ((int64_t)ret_conv_38_conv);
6512 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6517 typedef struct LDKBroadcasterInterface_JCalls {
6518 atomic_size_t refcnt;
6521 jmethodID broadcast_transaction_meth;
6522 } LDKBroadcasterInterface_JCalls;
6523 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6524 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6525 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6527 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6528 if (get_jenv_res == JNI_EDETACHED) {
6529 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6531 DO_ASSERT(get_jenv_res == JNI_OK);
6533 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6534 if (get_jenv_res == JNI_EDETACHED) {
6535 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6540 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6541 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6543 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6544 if (get_jenv_res == JNI_EDETACHED) {
6545 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6547 DO_ASSERT(get_jenv_res == JNI_OK);
6549 LDKTransaction tx_var = tx;
6550 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6551 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6552 Transaction_free(tx_var);
6553 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6555 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6556 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6557 (*env)->ExceptionDescribe(env);
6558 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6560 if (get_jenv_res == JNI_EDETACHED) {
6561 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6564 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6565 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6566 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6568 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6569 jclass c = (*env)->GetObjectClass(env, o);
6571 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6572 atomic_init(&calls->refcnt, 1);
6573 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6574 calls->o = (*env)->NewWeakGlobalRef(env, o);
6575 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6576 CHECK(calls->broadcast_transaction_meth != NULL);
6578 LDKBroadcasterInterface ret = {
6579 .this_arg = (void*) calls,
6580 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6581 .free = LDKBroadcasterInterface_JCalls_free,
6585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6586 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6587 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6588 return (uint64_t)res_ptr;
6590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6591 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6592 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6593 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6594 LDKTransaction tx_ref;
6595 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6596 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6597 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6598 tx_ref.data_is_owned = true;
6599 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6602 typedef struct LDKKeysInterface_JCalls {
6603 atomic_size_t refcnt;
6606 jmethodID get_node_secret_meth;
6607 jmethodID get_destination_script_meth;
6608 jmethodID get_shutdown_scriptpubkey_meth;
6609 jmethodID get_channel_signer_meth;
6610 jmethodID get_secure_random_bytes_meth;
6611 jmethodID read_chan_signer_meth;
6612 jmethodID sign_invoice_meth;
6613 jmethodID get_inbound_payment_key_material_meth;
6614 } LDKKeysInterface_JCalls;
6615 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6616 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6617 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6619 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6620 if (get_jenv_res == JNI_EDETACHED) {
6621 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6623 DO_ASSERT(get_jenv_res == JNI_OK);
6625 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6626 if (get_jenv_res == JNI_EDETACHED) {
6627 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6632 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6633 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6635 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6636 if (get_jenv_res == JNI_EDETACHED) {
6637 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6639 DO_ASSERT(get_jenv_res == JNI_OK);
6641 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6644 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6645 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6646 (*env)->ExceptionDescribe(env);
6647 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6649 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6650 CHECK_ACCESS(ret_ptr);
6651 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6653 if (get_jenv_res == JNI_EDETACHED) {
6654 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6658 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6659 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6661 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6662 if (get_jenv_res == JNI_EDETACHED) {
6663 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6665 DO_ASSERT(get_jenv_res == JNI_OK);
6667 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6669 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6670 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6671 (*env)->ExceptionDescribe(env);
6672 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6674 LDKCVec_u8Z ret_ref;
6675 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6676 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6677 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6678 if (get_jenv_res == JNI_EDETACHED) {
6679 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6683 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6684 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6686 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6687 if (get_jenv_res == JNI_EDETACHED) {
6688 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6690 DO_ASSERT(get_jenv_res == JNI_OK);
6692 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6694 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6695 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6696 (*env)->ExceptionDescribe(env);
6697 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6699 LDKShutdownScript ret_conv;
6700 ret_conv.inner = (void*)(ret & (~1));
6701 ret_conv.is_owned = (ret & 1) || (ret == 0);
6702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6703 if (get_jenv_res == JNI_EDETACHED) {
6704 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6708 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6709 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6712 if (get_jenv_res == JNI_EDETACHED) {
6713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6715 DO_ASSERT(get_jenv_res == JNI_OK);
6717 jboolean inbound_conv = inbound;
6718 int64_t channel_value_satoshis_conv = channel_value_satoshis;
6719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6721 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6722 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6723 (*env)->ExceptionDescribe(env);
6724 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6726 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6727 CHECK_ACCESS(ret_ptr);
6728 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6730 if (get_jenv_res == JNI_EDETACHED) {
6731 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6735 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6736 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6738 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6739 if (get_jenv_res == JNI_EDETACHED) {
6740 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6742 DO_ASSERT(get_jenv_res == JNI_OK);
6744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6746 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6747 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6748 (*env)->ExceptionDescribe(env);
6749 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6751 LDKThirtyTwoBytes ret_ref;
6752 CHECK((*env)->GetArrayLength(env, ret) == 32);
6753 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6754 if (get_jenv_res == JNI_EDETACHED) {
6755 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6759 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6760 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6762 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6763 if (get_jenv_res == JNI_EDETACHED) {
6764 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6766 DO_ASSERT(get_jenv_res == JNI_OK);
6768 LDKu8slice reader_var = reader;
6769 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6770 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6773 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6775 (*env)->ExceptionDescribe(env);
6776 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6778 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6779 CHECK_ACCESS(ret_ptr);
6780 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6782 if (get_jenv_res == JNI_EDETACHED) {
6783 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6787 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6788 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6790 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6791 if (get_jenv_res == JNI_EDETACHED) {
6792 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6794 DO_ASSERT(get_jenv_res == JNI_OK);
6796 LDKu8slice hrp_bytes_var = hrp_bytes;
6797 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6798 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6799 LDKCVec_u5Z invoice_data_var = invoice_data;
6800 jobjectArray invoice_data_arr = NULL;
6801 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6802 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6803 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6804 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6805 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6807 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6808 FREE(invoice_data_var.data);
6809 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6810 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6812 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6813 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6814 (*env)->ExceptionDescribe(env);
6815 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6817 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6818 CHECK_ACCESS(ret_ptr);
6819 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6821 if (get_jenv_res == JNI_EDETACHED) {
6822 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6826 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6827 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6830 if (get_jenv_res == JNI_EDETACHED) {
6831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6833 DO_ASSERT(get_jenv_res == JNI_OK);
6835 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6837 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6838 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6839 (*env)->ExceptionDescribe(env);
6840 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6842 LDKThirtyTwoBytes ret_ref;
6843 CHECK((*env)->GetArrayLength(env, ret) == 32);
6844 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6845 if (get_jenv_res == JNI_EDETACHED) {
6846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6850 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6852 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6854 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6855 jclass c = (*env)->GetObjectClass(env, o);
6857 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6858 atomic_init(&calls->refcnt, 1);
6859 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6860 calls->o = (*env)->NewWeakGlobalRef(env, o);
6861 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6862 CHECK(calls->get_node_secret_meth != NULL);
6863 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6864 CHECK(calls->get_destination_script_meth != NULL);
6865 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6866 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6867 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6868 CHECK(calls->get_channel_signer_meth != NULL);
6869 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6870 CHECK(calls->get_secure_random_bytes_meth != NULL);
6871 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6872 CHECK(calls->read_chan_signer_meth != NULL);
6873 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6874 CHECK(calls->sign_invoice_meth != NULL);
6875 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6876 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6878 LDKKeysInterface ret = {
6879 .this_arg = (void*) calls,
6880 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6881 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6882 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6883 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6884 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6885 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6886 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6887 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6888 .free = LDKKeysInterface_JCalls_free,
6892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6893 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6894 *res_ptr = LDKKeysInterface_init(env, clz, o);
6895 return (uint64_t)res_ptr;
6897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6898 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6899 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6900 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6901 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6902 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6903 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6904 return (int64_t)ret_conv;
6907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6908 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6909 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6910 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6911 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6912 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6913 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6914 CVec_u8Z_free(ret_var);
6918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6919 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6921 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6922 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6923 int64_t ret_ref = 0;
6924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6927 ret_ref = (uintptr_t)ret_var.inner;
6928 if (ret_var.is_owned) {
6934 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) {
6935 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6936 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6937 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6938 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6939 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6940 return (int64_t)ret_ret;
6943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6944 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6945 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6946 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6947 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6948 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6953 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6954 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6955 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6956 LDKu8slice reader_ref;
6957 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6958 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6959 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6960 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6961 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6962 return (int64_t)ret_conv;
6965 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) {
6966 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6967 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6968 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6969 LDKu8slice hrp_bytes_ref;
6970 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6971 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6972 LDKCVec_u5Z invoice_data_constr;
6973 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6974 if (invoice_data_constr.datalen > 0)
6975 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6977 invoice_data_constr.data = NULL;
6978 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6979 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6980 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6982 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6984 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6985 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6986 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6987 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6988 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6989 return (int64_t)ret_conv;
6992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6993 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6994 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6995 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6996 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6997 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7001 typedef struct LDKFeeEstimator_JCalls {
7002 atomic_size_t refcnt;
7005 jmethodID get_est_sat_per_1000_weight_meth;
7006 } LDKFeeEstimator_JCalls;
7007 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7008 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7009 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7011 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7012 if (get_jenv_res == JNI_EDETACHED) {
7013 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7015 DO_ASSERT(get_jenv_res == JNI_OK);
7017 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7018 if (get_jenv_res == JNI_EDETACHED) {
7019 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7024 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7025 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7027 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7028 if (get_jenv_res == JNI_EDETACHED) {
7029 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7031 DO_ASSERT(get_jenv_res == JNI_OK);
7033 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
7034 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7036 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
7037 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7038 (*env)->ExceptionDescribe(env);
7039 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
7041 if (get_jenv_res == JNI_EDETACHED) {
7042 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7046 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7047 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7048 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7050 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
7051 jclass c = (*env)->GetObjectClass(env, o);
7053 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7054 atomic_init(&calls->refcnt, 1);
7055 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7056 calls->o = (*env)->NewWeakGlobalRef(env, o);
7057 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
7058 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
7060 LDKFeeEstimator ret = {
7061 .this_arg = (void*) calls,
7062 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7063 .free = LDKFeeEstimator_JCalls_free,
7067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
7068 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7069 *res_ptr = LDKFeeEstimator_init(env, clz, o);
7070 return (uint64_t)res_ptr;
7072 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) {
7073 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7074 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7075 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7076 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
7077 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7081 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7082 return ThirtyTwoBytes_clone(&owner->a);
7084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7085 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7086 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7087 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
7091 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7095 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7096 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7097 int64_t ret_ref = 0;
7098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7101 ret_ref = (uintptr_t)ret_var.inner & ~1;
7105 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7106 CHECK(owner->result_ok);
7107 return &*owner->contents.result;
7109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7110 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7111 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
7115 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7116 CHECK(!owner->result_ok);
7117 return DecodeError_clone(&*owner->contents.err);
7119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7120 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7121 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
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 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7134 CHECK(owner->result_ok);
7135 return ChannelConfig_clone(&*owner->contents.result);
7137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7138 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7139 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7140 int64_t ret_ref = 0;
7141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7144 ret_ref = (uintptr_t)ret_var.inner;
7145 if (ret_var.is_owned) {
7151 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7152 CHECK(!owner->result_ok);
7153 return DecodeError_clone(&*owner->contents.err);
7155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7156 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7157 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7158 int64_t ret_ref = 0;
7159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7162 ret_ref = (uintptr_t)ret_var.inner;
7163 if (ret_var.is_owned) {
7169 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7170 CHECK(owner->result_ok);
7171 return OutPoint_clone(&*owner->contents.result);
7173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7174 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7175 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7176 int64_t ret_ref = 0;
7177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7180 ret_ref = (uintptr_t)ret_var.inner;
7181 if (ret_var.is_owned) {
7187 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7188 CHECK(!owner->result_ok);
7189 return DecodeError_clone(&*owner->contents.err);
7191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7192 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7193 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7194 int64_t ret_ref = 0;
7195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7198 ret_ref = (uintptr_t)ret_var.inner;
7199 if (ret_var.is_owned) {
7205 typedef struct LDKType_JCalls {
7206 atomic_size_t refcnt;
7209 jmethodID type_id_meth;
7210 jmethodID debug_str_meth;
7211 jmethodID write_meth;
7213 static void LDKType_JCalls_free(void* this_arg) {
7214 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7215 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7217 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7218 if (get_jenv_res == JNI_EDETACHED) {
7219 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7221 DO_ASSERT(get_jenv_res == JNI_OK);
7223 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7224 if (get_jenv_res == JNI_EDETACHED) {
7225 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7230 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7231 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7233 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7234 if (get_jenv_res == JNI_EDETACHED) {
7235 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7237 DO_ASSERT(get_jenv_res == JNI_OK);
7239 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7241 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
7242 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7243 (*env)->ExceptionDescribe(env);
7244 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
7246 if (get_jenv_res == JNI_EDETACHED) {
7247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7251 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7252 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7254 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7255 if (get_jenv_res == JNI_EDETACHED) {
7256 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7258 DO_ASSERT(get_jenv_res == JNI_OK);
7260 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7262 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
7263 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7264 (*env)->ExceptionDescribe(env);
7265 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
7267 LDKStr ret_conv = java_to_owned_str(env, ret);
7268 if (get_jenv_res == JNI_EDETACHED) {
7269 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7273 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7274 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7277 if (get_jenv_res == JNI_EDETACHED) {
7278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7280 DO_ASSERT(get_jenv_res == JNI_OK);
7282 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7284 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
7285 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7286 (*env)->ExceptionDescribe(env);
7287 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
7289 LDKCVec_u8Z ret_ref;
7290 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7291 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7292 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7293 if (get_jenv_res == JNI_EDETACHED) {
7294 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7298 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7299 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7300 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7302 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7303 jclass c = (*env)->GetObjectClass(env, o);
7305 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7306 atomic_init(&calls->refcnt, 1);
7307 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7308 calls->o = (*env)->NewWeakGlobalRef(env, o);
7309 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7310 CHECK(calls->type_id_meth != NULL);
7311 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7312 CHECK(calls->debug_str_meth != NULL);
7313 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7314 CHECK(calls->write_meth != NULL);
7317 .this_arg = (void*) calls,
7318 .type_id = type_id_LDKType_jcall,
7319 .debug_str = debug_str_LDKType_jcall,
7320 .write = write_LDKType_jcall,
7321 .cloned = LDKType_JCalls_cloned,
7322 .free = LDKType_JCalls_free,
7326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7327 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7328 *res_ptr = LDKType_init(env, clz, o);
7329 return (uint64_t)res_ptr;
7331 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7332 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7333 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7334 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7335 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7339 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7340 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7341 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7342 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7343 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7344 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7350 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7351 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7352 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7353 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7354 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7355 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7356 CVec_u8Z_free(ret_var);
7360 static jclass LDKCOption_TypeZ_Some_class = NULL;
7361 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7362 static jclass LDKCOption_TypeZ_None_class = NULL;
7363 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7365 LDKCOption_TypeZ_Some_class =
7366 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7367 CHECK(LDKCOption_TypeZ_Some_class != NULL);
7368 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7369 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7370 LDKCOption_TypeZ_None_class =
7371 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7372 CHECK(LDKCOption_TypeZ_None_class != NULL);
7373 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7374 CHECK(LDKCOption_TypeZ_None_meth != NULL);
7376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7377 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
7379 case LDKCOption_TypeZ_Some: {
7380 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7381 *some_ret = Type_clone(&obj->some);
7382 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
7384 case LDKCOption_TypeZ_None: {
7385 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7390 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7391 CHECK(owner->result_ok);
7392 return COption_TypeZ_clone(&*owner->contents.result);
7394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7395 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7396 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7397 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7398 int64_t ret_ref = (uintptr_t)ret_copy;
7402 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7403 CHECK(!owner->result_ok);
7404 return DecodeError_clone(&*owner->contents.err);
7406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7407 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7408 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7409 int64_t ret_ref = 0;
7410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7413 ret_ref = (uintptr_t)ret_var.inner;
7414 if (ret_var.is_owned) {
7420 static jclass LDKPaymentError_Invoice_class = NULL;
7421 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7422 static jclass LDKPaymentError_Routing_class = NULL;
7423 static jmethodID LDKPaymentError_Routing_meth = NULL;
7424 static jclass LDKPaymentError_Sending_class = NULL;
7425 static jmethodID LDKPaymentError_Sending_meth = NULL;
7426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7427 LDKPaymentError_Invoice_class =
7428 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7429 CHECK(LDKPaymentError_Invoice_class != NULL);
7430 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7431 CHECK(LDKPaymentError_Invoice_meth != NULL);
7432 LDKPaymentError_Routing_class =
7433 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7434 CHECK(LDKPaymentError_Routing_class != NULL);
7435 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7436 CHECK(LDKPaymentError_Routing_meth != NULL);
7437 LDKPaymentError_Sending_class =
7438 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7439 CHECK(LDKPaymentError_Sending_class != NULL);
7440 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7441 CHECK(LDKPaymentError_Sending_meth != NULL);
7443 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7444 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
7446 case LDKPaymentError_Invoice: {
7447 LDKStr invoice_str = obj->invoice;
7448 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7449 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7451 case LDKPaymentError_Routing: {
7452 LDKLightningError routing_var = obj->routing;
7453 int64_t routing_ref = 0;
7454 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7455 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7456 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7457 routing_ref = (uintptr_t)routing_var.inner & ~1;
7458 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7460 case LDKPaymentError_Sending: {
7461 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
7462 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7467 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7468 CHECK(owner->result_ok);
7469 return ThirtyTwoBytes_clone(&*owner->contents.result);
7471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7472 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7473 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7474 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7478 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7479 CHECK(!owner->result_ok);
7480 return PaymentError_clone(&*owner->contents.err);
7482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7483 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7484 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7485 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7486 int64_t ret_ref = (uintptr_t)ret_copy;
7490 static jclass LDKParseError_Bech32Error_class = NULL;
7491 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7492 static jclass LDKParseError_ParseAmountError_class = NULL;
7493 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7494 static jclass LDKParseError_MalformedSignature_class = NULL;
7495 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7496 static jclass LDKParseError_BadPrefix_class = NULL;
7497 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7498 static jclass LDKParseError_UnknownCurrency_class = NULL;
7499 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7500 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7501 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7502 static jclass LDKParseError_MalformedHRP_class = NULL;
7503 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7504 static jclass LDKParseError_TooShortDataPart_class = NULL;
7505 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7506 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7507 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7508 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7509 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7510 static jclass LDKParseError_PaddingError_class = NULL;
7511 static jmethodID LDKParseError_PaddingError_meth = NULL;
7512 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7513 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7514 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7515 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7516 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7517 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7518 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7519 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7520 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7521 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7522 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7523 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7524 static jclass LDKParseError_Skip_class = NULL;
7525 static jmethodID LDKParseError_Skip_meth = NULL;
7526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7527 LDKParseError_Bech32Error_class =
7528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7529 CHECK(LDKParseError_Bech32Error_class != NULL);
7530 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7531 CHECK(LDKParseError_Bech32Error_meth != NULL);
7532 LDKParseError_ParseAmountError_class =
7533 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7534 CHECK(LDKParseError_ParseAmountError_class != NULL);
7535 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7536 CHECK(LDKParseError_ParseAmountError_meth != NULL);
7537 LDKParseError_MalformedSignature_class =
7538 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7539 CHECK(LDKParseError_MalformedSignature_class != NULL);
7540 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7541 CHECK(LDKParseError_MalformedSignature_meth != NULL);
7542 LDKParseError_BadPrefix_class =
7543 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7544 CHECK(LDKParseError_BadPrefix_class != NULL);
7545 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7546 CHECK(LDKParseError_BadPrefix_meth != NULL);
7547 LDKParseError_UnknownCurrency_class =
7548 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7549 CHECK(LDKParseError_UnknownCurrency_class != NULL);
7550 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7551 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7552 LDKParseError_UnknownSiPrefix_class =
7553 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7554 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7555 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7556 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7557 LDKParseError_MalformedHRP_class =
7558 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7559 CHECK(LDKParseError_MalformedHRP_class != NULL);
7560 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7561 CHECK(LDKParseError_MalformedHRP_meth != NULL);
7562 LDKParseError_TooShortDataPart_class =
7563 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7564 CHECK(LDKParseError_TooShortDataPart_class != NULL);
7565 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7566 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7567 LDKParseError_UnexpectedEndOfTaggedFields_class =
7568 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7569 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7570 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7571 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7572 LDKParseError_DescriptionDecodeError_class =
7573 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7574 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7575 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7576 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7577 LDKParseError_PaddingError_class =
7578 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7579 CHECK(LDKParseError_PaddingError_class != NULL);
7580 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7581 CHECK(LDKParseError_PaddingError_meth != NULL);
7582 LDKParseError_IntegerOverflowError_class =
7583 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7584 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7585 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7586 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7587 LDKParseError_InvalidSegWitProgramLength_class =
7588 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7589 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7590 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7591 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7592 LDKParseError_InvalidPubKeyHashLength_class =
7593 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7594 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7595 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7596 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7597 LDKParseError_InvalidScriptHashLength_class =
7598 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7599 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7600 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7601 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7602 LDKParseError_InvalidRecoveryId_class =
7603 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7604 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7605 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7606 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7607 LDKParseError_InvalidSliceLength_class =
7608 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7609 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7610 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7611 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7612 LDKParseError_Skip_class =
7613 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7614 CHECK(LDKParseError_Skip_class != NULL);
7615 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7616 CHECK(LDKParseError_Skip_meth != NULL);
7618 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7619 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
7621 case LDKParseError_Bech32Error: {
7622 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
7623 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7625 case LDKParseError_ParseAmountError: {
7626 /*obj->parse_amount_error*/
7627 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7629 case LDKParseError_MalformedSignature: {
7630 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7631 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7633 case LDKParseError_BadPrefix: {
7634 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7636 case LDKParseError_UnknownCurrency: {
7637 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7639 case LDKParseError_UnknownSiPrefix: {
7640 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7642 case LDKParseError_MalformedHRP: {
7643 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7645 case LDKParseError_TooShortDataPart: {
7646 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7648 case LDKParseError_UnexpectedEndOfTaggedFields: {
7649 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7651 case LDKParseError_DescriptionDecodeError: {
7652 /*obj->description_decode_error*/
7653 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7655 case LDKParseError_PaddingError: {
7656 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7658 case LDKParseError_IntegerOverflowError: {
7659 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7661 case LDKParseError_InvalidSegWitProgramLength: {
7662 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7664 case LDKParseError_InvalidPubKeyHashLength: {
7665 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7667 case LDKParseError_InvalidScriptHashLength: {
7668 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7670 case LDKParseError_InvalidRecoveryId: {
7671 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7673 case LDKParseError_InvalidSliceLength: {
7674 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7675 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7676 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7678 case LDKParseError_Skip: {
7679 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7684 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7685 CHECK(owner->result_ok);
7686 return SiPrefix_clone(&*owner->contents.result);
7688 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7689 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7690 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7694 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7695 CHECK(!owner->result_ok);
7696 return ParseError_clone(&*owner->contents.err);
7698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7699 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7700 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7701 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7702 int64_t ret_ref = (uintptr_t)ret_copy;
7706 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7707 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7708 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7709 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7711 LDKParseOrSemanticError_ParseError_class =
7712 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7713 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7714 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7715 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7716 LDKParseOrSemanticError_SemanticError_class =
7717 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7718 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7719 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7720 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7722 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7723 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
7725 case LDKParseOrSemanticError_ParseError: {
7726 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
7727 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7729 case LDKParseOrSemanticError_SemanticError: {
7730 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7731 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7736 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7737 CHECK(owner->result_ok);
7738 return Invoice_clone(&*owner->contents.result);
7740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7741 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7742 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7743 int64_t ret_ref = 0;
7744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7747 ret_ref = (uintptr_t)ret_var.inner;
7748 if (ret_var.is_owned) {
7754 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7755 CHECK(!owner->result_ok);
7756 return ParseOrSemanticError_clone(&*owner->contents.err);
7758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7759 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7760 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7761 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7762 int64_t ret_ref = (uintptr_t)ret_copy;
7766 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7767 CHECK(owner->result_ok);
7768 return SignedRawInvoice_clone(&*owner->contents.result);
7770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7771 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7772 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7773 int64_t ret_ref = 0;
7774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7777 ret_ref = (uintptr_t)ret_var.inner;
7778 if (ret_var.is_owned) {
7784 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7785 CHECK(!owner->result_ok);
7786 return ParseError_clone(&*owner->contents.err);
7788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7789 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7790 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7791 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7792 int64_t ret_ref = (uintptr_t)ret_copy;
7796 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7797 return RawInvoice_clone(&owner->a);
7799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7800 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7801 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7802 int64_t ret_ref = 0;
7803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7806 ret_ref = (uintptr_t)ret_var.inner;
7807 if (ret_var.is_owned) {
7813 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7814 return ThirtyTwoBytes_clone(&owner->b);
7816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7817 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7818 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7823 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7824 return InvoiceSignature_clone(&owner->c);
7826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7827 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7828 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7829 int64_t ret_ref = 0;
7830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7833 ret_ref = (uintptr_t)ret_var.inner;
7834 if (ret_var.is_owned) {
7840 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7841 CHECK(owner->result_ok);
7842 return PayeePubKey_clone(&*owner->contents.result);
7844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7845 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7846 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7847 int64_t ret_ref = 0;
7848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7851 ret_ref = (uintptr_t)ret_var.inner;
7852 if (ret_var.is_owned) {
7858 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7859 CHECK(!owner->result_ok);
7860 return *owner->contents.err;
7862 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7863 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7864 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7868 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7869 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7870 for (size_t i = 0; i < ret.datalen; i++) {
7871 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7875 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7876 CHECK(owner->result_ok);
7877 return PositiveTimestamp_clone(&*owner->contents.result);
7879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7880 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7881 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7882 int64_t ret_ref = 0;
7883 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7884 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7886 ret_ref = (uintptr_t)ret_var.inner;
7887 if (ret_var.is_owned) {
7893 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7894 CHECK(!owner->result_ok);
7895 return CreationError_clone(&*owner->contents.err);
7897 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7898 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7899 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7903 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7904 CHECK(owner->result_ok);
7905 return *owner->contents.result;
7907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7908 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7909 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7912 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7913 CHECK(!owner->result_ok);
7914 return SemanticError_clone(&*owner->contents.err);
7916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7917 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7918 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7922 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7923 CHECK(owner->result_ok);
7924 return Invoice_clone(&*owner->contents.result);
7926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7927 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7928 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7929 int64_t ret_ref = 0;
7930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7933 ret_ref = (uintptr_t)ret_var.inner;
7934 if (ret_var.is_owned) {
7940 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7941 CHECK(!owner->result_ok);
7942 return SemanticError_clone(&*owner->contents.err);
7944 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7945 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7946 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7950 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7951 CHECK(owner->result_ok);
7952 return Description_clone(&*owner->contents.result);
7954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7955 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7956 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7957 int64_t ret_ref = 0;
7958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7961 ret_ref = (uintptr_t)ret_var.inner;
7962 if (ret_var.is_owned) {
7968 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7969 CHECK(!owner->result_ok);
7970 return CreationError_clone(&*owner->contents.err);
7972 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7973 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7974 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7978 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7979 CHECK(owner->result_ok);
7980 return PrivateRoute_clone(&*owner->contents.result);
7982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7983 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7984 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7985 int64_t ret_ref = 0;
7986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7989 ret_ref = (uintptr_t)ret_var.inner;
7990 if (ret_var.is_owned) {
7996 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7997 CHECK(!owner->result_ok);
7998 return CreationError_clone(&*owner->contents.err);
8000 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8001 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
8002 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
8006 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8007 CHECK(owner->result_ok);
8008 return *owner->contents.result;
8010 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8011 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8012 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
8013 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8017 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8018 CHECK(!owner->result_ok);
8019 return *owner->contents.err;
8021 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8022 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8023 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
8027 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8028 CHECK(owner->result_ok);
8029 return ChannelMonitorUpdate_clone(&*owner->contents.result);
8031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8032 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8033 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8034 int64_t ret_ref = 0;
8035 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8036 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8038 ret_ref = (uintptr_t)ret_var.inner;
8039 if (ret_var.is_owned) {
8045 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8046 CHECK(!owner->result_ok);
8047 return DecodeError_clone(&*owner->contents.err);
8049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8050 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8051 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8052 int64_t ret_ref = 0;
8053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8056 ret_ref = (uintptr_t)ret_var.inner;
8057 if (ret_var.is_owned) {
8063 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8064 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8065 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8066 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8068 LDKCOption_MonitorEventZ_Some_class =
8069 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8070 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8071 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8072 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8073 LDKCOption_MonitorEventZ_None_class =
8074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8075 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8076 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8077 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8079 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8080 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
8082 case LDKCOption_MonitorEventZ_Some: {
8083 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8084 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8086 case LDKCOption_MonitorEventZ_None: {
8087 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8092 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8093 CHECK(owner->result_ok);
8094 return COption_MonitorEventZ_clone(&*owner->contents.result);
8096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8097 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8098 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8099 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8100 int64_t ret_ref = (uintptr_t)ret_copy;
8104 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8105 CHECK(!owner->result_ok);
8106 return DecodeError_clone(&*owner->contents.err);
8108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8109 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8110 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8111 int64_t ret_ref = 0;
8112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8115 ret_ref = (uintptr_t)ret_var.inner;
8116 if (ret_var.is_owned) {
8122 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8123 CHECK(owner->result_ok);
8124 return HTLCUpdate_clone(&*owner->contents.result);
8126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8127 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8128 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8129 int64_t ret_ref = 0;
8130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8133 ret_ref = (uintptr_t)ret_var.inner;
8134 if (ret_var.is_owned) {
8140 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8141 CHECK(!owner->result_ok);
8142 return DecodeError_clone(&*owner->contents.err);
8144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8145 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8146 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8147 int64_t ret_ref = 0;
8148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8151 ret_ref = (uintptr_t)ret_var.inner;
8152 if (ret_var.is_owned) {
8158 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8159 return OutPoint_clone(&owner->a);
8161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8162 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8163 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8164 int64_t ret_ref = 0;
8165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8168 ret_ref = (uintptr_t)ret_var.inner;
8169 if (ret_var.is_owned) {
8175 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8176 return CVec_u8Z_clone(&owner->b);
8178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8179 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8180 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8181 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8182 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8183 CVec_u8Z_free(ret_var);
8187 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8190 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8191 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8192 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8196 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8197 return CVec_u8Z_clone(&owner->b);
8199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8200 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8201 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8202 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8203 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8204 CVec_u8Z_free(ret_var);
8208 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8209 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8210 for (size_t i = 0; i < ret.datalen; i++) {
8211 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8215 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8216 return ThirtyTwoBytes_clone(&owner->a);
8218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8219 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8220 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8225 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8226 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8228 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8229 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8230 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8231 int64_tArray ret_arr = NULL;
8232 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8233 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8234 for (size_t v = 0; v < ret_var.datalen; v++) {
8235 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8236 *ret_conv_21_conv = ret_var.data[v];
8237 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
8239 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8244 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8245 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 };
8246 for (size_t i = 0; i < ret.datalen; i++) {
8247 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8251 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
8252 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
8253 for (size_t i = 0; i < ret.datalen; i++) {
8254 ret.data[i] = Event_clone(&orig->data[i]);
8258 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8261 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8262 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8263 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8267 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8268 return TxOut_clone(&owner->b);
8270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8271 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8272 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8273 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8274 return (int64_t)ret_ref;
8277 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8278 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8279 for (size_t i = 0; i < ret.datalen; i++) {
8280 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8284 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8285 return ThirtyTwoBytes_clone(&owner->a);
8287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8288 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8289 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8290 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8294 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8295 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8297 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8298 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8299 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8300 int64_tArray ret_arr = NULL;
8301 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8302 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8303 for (size_t u = 0; u < ret_var.datalen; u++) {
8304 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8305 *ret_conv_20_conv = ret_var.data[u];
8306 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
8308 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8313 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8314 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 };
8315 for (size_t i = 0; i < ret.datalen; i++) {
8316 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8320 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8321 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8322 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8323 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8324 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8325 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8326 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
8327 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
8328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8329 LDKBalance_ClaimableOnChannelClose_class =
8330 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8331 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8332 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8333 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8334 LDKBalance_ClaimableAwaitingConfirmations_class =
8335 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8336 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8337 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8338 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8339 LDKBalance_ContentiousClaimable_class =
8340 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8341 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8342 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
8343 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8344 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
8345 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
8346 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
8347 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
8348 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
8350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8351 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
8353 case LDKBalance_ClaimableOnChannelClose: {
8354 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8355 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8357 case LDKBalance_ClaimableAwaitingConfirmations: {
8358 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8359 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8360 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8362 case LDKBalance_ContentiousClaimable: {
8363 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8364 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8365 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8367 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8368 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8369 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8370 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8375 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8376 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8377 for (size_t i = 0; i < ret.datalen; i++) {
8378 ret.data[i] = Balance_clone(&orig->data[i]);
8382 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8383 CHECK(owner->result_ok);
8384 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8387 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8388 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8389 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8390 return ((int64_t)ret_conv);
8393 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8394 CHECK(!owner->result_ok);
8395 return DecodeError_clone(&*owner->contents.err);
8397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8398 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8399 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8400 int64_t ret_ref = 0;
8401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8404 ret_ref = (uintptr_t)ret_var.inner;
8405 if (ret_var.is_owned) {
8411 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8415 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8416 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8417 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8421 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8422 return Type_clone(&owner->b);
8424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8425 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8426 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8427 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8428 return (int64_t)ret_ret;
8431 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8432 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8433 for (size_t i = 0; i < ret.datalen; i++) {
8434 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8438 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8439 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8440 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8441 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8443 LDKCOption_NetAddressZ_Some_class =
8444 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8445 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8446 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8447 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8448 LDKCOption_NetAddressZ_None_class =
8449 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8450 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8451 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8452 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8454 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8455 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
8457 case LDKCOption_NetAddressZ_Some: {
8458 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8459 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8461 case LDKCOption_NetAddressZ_None: {
8462 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8467 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8468 CHECK(owner->result_ok);
8469 return CVec_u8Z_clone(&*owner->contents.result);
8471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8472 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8473 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8474 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8475 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8476 CVec_u8Z_free(ret_var);
8480 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8481 CHECK(!owner->result_ok);
8482 return PeerHandleError_clone(&*owner->contents.err);
8484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8485 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8486 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8487 int64_t ret_ref = 0;
8488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8491 ret_ref = (uintptr_t)ret_var.inner;
8492 if (ret_var.is_owned) {
8498 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8499 CHECK(owner->result_ok);
8500 return *owner->contents.result;
8502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8503 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8504 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8507 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8508 CHECK(!owner->result_ok);
8509 return PeerHandleError_clone(&*owner->contents.err);
8511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8512 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8513 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8514 int64_t ret_ref = 0;
8515 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8516 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8518 ret_ref = (uintptr_t)ret_var.inner;
8519 if (ret_var.is_owned) {
8525 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8526 CHECK(owner->result_ok);
8527 return *owner->contents.result;
8529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8530 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8531 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8535 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8536 CHECK(!owner->result_ok);
8537 return PeerHandleError_clone(&*owner->contents.err);
8539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8540 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8541 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8542 int64_t ret_ref = 0;
8543 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8544 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8546 ret_ref = (uintptr_t)ret_var.inner;
8547 if (ret_var.is_owned) {
8553 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8554 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8555 static jclass LDKGraphSyncError_LightningError_class = NULL;
8556 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8558 LDKGraphSyncError_DecodeError_class =
8559 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8560 CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8561 LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8562 CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8563 LDKGraphSyncError_LightningError_class =
8564 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8565 CHECK(LDKGraphSyncError_LightningError_class != NULL);
8566 LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8567 CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8569 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8570 LDKGraphSyncError *obj = (LDKGraphSyncError*)(ptr & ~1);
8572 case LDKGraphSyncError_DecodeError: {
8573 LDKDecodeError decode_error_var = obj->decode_error;
8574 int64_t decode_error_ref = 0;
8575 CHECK((((uintptr_t)decode_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8576 CHECK((((uintptr_t)&decode_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8577 CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8578 decode_error_ref = (uintptr_t)decode_error_var.inner & ~1;
8579 return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8581 case LDKGraphSyncError_LightningError: {
8582 LDKLightningError lightning_error_var = obj->lightning_error;
8583 int64_t lightning_error_ref = 0;
8584 CHECK((((uintptr_t)lightning_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8585 CHECK((((uintptr_t)&lightning_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8586 CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8587 lightning_error_ref = (uintptr_t)lightning_error_var.inner & ~1;
8588 return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8593 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8594 CHECK(owner->result_ok);
8595 return *owner->contents.result;
8597 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8598 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8599 int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8603 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8604 CHECK(!owner->result_ok);
8605 return GraphSyncError_clone(&*owner->contents.err);
8607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8608 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8609 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8610 *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8611 int64_t ret_ref = (uintptr_t)ret_copy;
8615 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8616 CHECK(owner->result_ok);
8617 return NetAddress_clone(&*owner->contents.result);
8619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8620 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8621 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8622 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8623 int64_t ret_ref = (uintptr_t)ret_copy;
8627 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8628 CHECK(!owner->result_ok);
8629 return DecodeError_clone(&*owner->contents.err);
8631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8632 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8633 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8634 int64_t ret_ref = 0;
8635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8638 ret_ref = (uintptr_t)ret_var.inner;
8639 if (ret_var.is_owned) {
8645 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8646 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8647 for (size_t i = 0; i < ret.datalen; i++) {
8648 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8652 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8653 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8654 for (size_t i = 0; i < ret.datalen; i++) {
8655 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8659 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8660 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8661 for (size_t i = 0; i < ret.datalen; i++) {
8662 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8666 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8667 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8668 for (size_t i = 0; i < ret.datalen; i++) {
8669 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8673 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8674 CHECK(owner->result_ok);
8675 return AcceptChannel_clone(&*owner->contents.result);
8677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8678 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8679 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8680 int64_t ret_ref = 0;
8681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8684 ret_ref = (uintptr_t)ret_var.inner;
8685 if (ret_var.is_owned) {
8691 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8692 CHECK(!owner->result_ok);
8693 return DecodeError_clone(&*owner->contents.err);
8695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8696 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8697 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8698 int64_t ret_ref = 0;
8699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8702 ret_ref = (uintptr_t)ret_var.inner;
8703 if (ret_var.is_owned) {
8709 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8710 CHECK(owner->result_ok);
8711 return AnnouncementSignatures_clone(&*owner->contents.result);
8713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8714 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8715 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8716 int64_t ret_ref = 0;
8717 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8718 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8720 ret_ref = (uintptr_t)ret_var.inner;
8721 if (ret_var.is_owned) {
8727 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8728 CHECK(!owner->result_ok);
8729 return DecodeError_clone(&*owner->contents.err);
8731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8732 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8733 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8734 int64_t ret_ref = 0;
8735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8738 ret_ref = (uintptr_t)ret_var.inner;
8739 if (ret_var.is_owned) {
8745 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8746 CHECK(owner->result_ok);
8747 return ChannelReestablish_clone(&*owner->contents.result);
8749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8750 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8751 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8752 int64_t ret_ref = 0;
8753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8756 ret_ref = (uintptr_t)ret_var.inner;
8757 if (ret_var.is_owned) {
8763 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8764 CHECK(!owner->result_ok);
8765 return DecodeError_clone(&*owner->contents.err);
8767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8768 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8769 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8770 int64_t ret_ref = 0;
8771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8774 ret_ref = (uintptr_t)ret_var.inner;
8775 if (ret_var.is_owned) {
8781 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8782 CHECK(owner->result_ok);
8783 return ClosingSigned_clone(&*owner->contents.result);
8785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8786 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8787 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8788 int64_t ret_ref = 0;
8789 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8790 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8792 ret_ref = (uintptr_t)ret_var.inner;
8793 if (ret_var.is_owned) {
8799 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8800 CHECK(!owner->result_ok);
8801 return DecodeError_clone(&*owner->contents.err);
8803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8804 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8805 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8806 int64_t ret_ref = 0;
8807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8810 ret_ref = (uintptr_t)ret_var.inner;
8811 if (ret_var.is_owned) {
8817 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8818 CHECK(owner->result_ok);
8819 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8822 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8823 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8824 int64_t ret_ref = 0;
8825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8828 ret_ref = (uintptr_t)ret_var.inner;
8829 if (ret_var.is_owned) {
8835 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8836 CHECK(!owner->result_ok);
8837 return DecodeError_clone(&*owner->contents.err);
8839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8840 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8841 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8842 int64_t ret_ref = 0;
8843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8846 ret_ref = (uintptr_t)ret_var.inner;
8847 if (ret_var.is_owned) {
8853 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8854 CHECK(owner->result_ok);
8855 return CommitmentSigned_clone(&*owner->contents.result);
8857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8858 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8859 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8860 int64_t ret_ref = 0;
8861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8864 ret_ref = (uintptr_t)ret_var.inner;
8865 if (ret_var.is_owned) {
8871 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8872 CHECK(!owner->result_ok);
8873 return DecodeError_clone(&*owner->contents.err);
8875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8876 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8877 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8878 int64_t ret_ref = 0;
8879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8882 ret_ref = (uintptr_t)ret_var.inner;
8883 if (ret_var.is_owned) {
8889 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8890 CHECK(owner->result_ok);
8891 return FundingCreated_clone(&*owner->contents.result);
8893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8894 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8895 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8896 int64_t ret_ref = 0;
8897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8900 ret_ref = (uintptr_t)ret_var.inner;
8901 if (ret_var.is_owned) {
8907 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8908 CHECK(!owner->result_ok);
8909 return DecodeError_clone(&*owner->contents.err);
8911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8912 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8913 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8914 int64_t ret_ref = 0;
8915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8918 ret_ref = (uintptr_t)ret_var.inner;
8919 if (ret_var.is_owned) {
8925 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8926 CHECK(owner->result_ok);
8927 return FundingSigned_clone(&*owner->contents.result);
8929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8930 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8931 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8932 int64_t ret_ref = 0;
8933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8936 ret_ref = (uintptr_t)ret_var.inner;
8937 if (ret_var.is_owned) {
8943 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8944 CHECK(!owner->result_ok);
8945 return DecodeError_clone(&*owner->contents.err);
8947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8948 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8949 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8950 int64_t ret_ref = 0;
8951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8954 ret_ref = (uintptr_t)ret_var.inner;
8955 if (ret_var.is_owned) {
8961 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8962 CHECK(owner->result_ok);
8963 return ChannelReady_clone(&*owner->contents.result);
8965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8966 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
8967 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8968 int64_t ret_ref = 0;
8969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8972 ret_ref = (uintptr_t)ret_var.inner;
8973 if (ret_var.is_owned) {
8979 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8980 CHECK(!owner->result_ok);
8981 return DecodeError_clone(&*owner->contents.err);
8983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8984 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
8985 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8986 int64_t ret_ref = 0;
8987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8990 ret_ref = (uintptr_t)ret_var.inner;
8991 if (ret_var.is_owned) {
8997 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8998 CHECK(owner->result_ok);
8999 return Init_clone(&*owner->contents.result);
9001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9002 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9003 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9004 int64_t ret_ref = 0;
9005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9008 ret_ref = (uintptr_t)ret_var.inner;
9009 if (ret_var.is_owned) {
9015 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9016 CHECK(!owner->result_ok);
9017 return DecodeError_clone(&*owner->contents.err);
9019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9020 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9021 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
9022 int64_t ret_ref = 0;
9023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9026 ret_ref = (uintptr_t)ret_var.inner;
9027 if (ret_var.is_owned) {
9033 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9034 CHECK(owner->result_ok);
9035 return OpenChannel_clone(&*owner->contents.result);
9037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9038 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9039 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9040 int64_t ret_ref = 0;
9041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9044 ret_ref = (uintptr_t)ret_var.inner;
9045 if (ret_var.is_owned) {
9051 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9052 CHECK(!owner->result_ok);
9053 return DecodeError_clone(&*owner->contents.err);
9055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9056 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9057 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9058 int64_t ret_ref = 0;
9059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9062 ret_ref = (uintptr_t)ret_var.inner;
9063 if (ret_var.is_owned) {
9069 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9070 CHECK(owner->result_ok);
9071 return RevokeAndACK_clone(&*owner->contents.result);
9073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9074 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9075 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9076 int64_t ret_ref = 0;
9077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9080 ret_ref = (uintptr_t)ret_var.inner;
9081 if (ret_var.is_owned) {
9087 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9088 CHECK(!owner->result_ok);
9089 return DecodeError_clone(&*owner->contents.err);
9091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9092 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9093 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9094 int64_t ret_ref = 0;
9095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9098 ret_ref = (uintptr_t)ret_var.inner;
9099 if (ret_var.is_owned) {
9105 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9106 CHECK(owner->result_ok);
9107 return Shutdown_clone(&*owner->contents.result);
9109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9110 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9111 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9112 int64_t ret_ref = 0;
9113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9116 ret_ref = (uintptr_t)ret_var.inner;
9117 if (ret_var.is_owned) {
9123 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9124 CHECK(!owner->result_ok);
9125 return DecodeError_clone(&*owner->contents.err);
9127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9128 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9129 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9130 int64_t ret_ref = 0;
9131 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9132 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9134 ret_ref = (uintptr_t)ret_var.inner;
9135 if (ret_var.is_owned) {
9141 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9142 CHECK(owner->result_ok);
9143 return UpdateFailHTLC_clone(&*owner->contents.result);
9145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9146 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9147 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9148 int64_t ret_ref = 0;
9149 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9150 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9152 ret_ref = (uintptr_t)ret_var.inner;
9153 if (ret_var.is_owned) {
9159 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9160 CHECK(!owner->result_ok);
9161 return DecodeError_clone(&*owner->contents.err);
9163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9164 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9165 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9166 int64_t ret_ref = 0;
9167 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9168 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9170 ret_ref = (uintptr_t)ret_var.inner;
9171 if (ret_var.is_owned) {
9177 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9178 CHECK(owner->result_ok);
9179 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
9181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9182 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9183 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9184 int64_t ret_ref = 0;
9185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9188 ret_ref = (uintptr_t)ret_var.inner;
9189 if (ret_var.is_owned) {
9195 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9196 CHECK(!owner->result_ok);
9197 return DecodeError_clone(&*owner->contents.err);
9199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9200 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9201 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9202 int64_t ret_ref = 0;
9203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9206 ret_ref = (uintptr_t)ret_var.inner;
9207 if (ret_var.is_owned) {
9213 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9214 CHECK(owner->result_ok);
9215 return UpdateFee_clone(&*owner->contents.result);
9217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9218 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9219 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9220 int64_t ret_ref = 0;
9221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9224 ret_ref = (uintptr_t)ret_var.inner;
9225 if (ret_var.is_owned) {
9231 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9232 CHECK(!owner->result_ok);
9233 return DecodeError_clone(&*owner->contents.err);
9235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9236 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9237 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9238 int64_t ret_ref = 0;
9239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9242 ret_ref = (uintptr_t)ret_var.inner;
9243 if (ret_var.is_owned) {
9249 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9250 CHECK(owner->result_ok);
9251 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9254 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9255 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9256 int64_t ret_ref = 0;
9257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9260 ret_ref = (uintptr_t)ret_var.inner;
9261 if (ret_var.is_owned) {
9267 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9268 CHECK(!owner->result_ok);
9269 return DecodeError_clone(&*owner->contents.err);
9271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9272 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9273 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9274 int64_t ret_ref = 0;
9275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9278 ret_ref = (uintptr_t)ret_var.inner;
9279 if (ret_var.is_owned) {
9285 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9286 CHECK(owner->result_ok);
9287 return UpdateAddHTLC_clone(&*owner->contents.result);
9289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9290 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9291 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9292 int64_t ret_ref = 0;
9293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9296 ret_ref = (uintptr_t)ret_var.inner;
9297 if (ret_var.is_owned) {
9303 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9304 CHECK(!owner->result_ok);
9305 return DecodeError_clone(&*owner->contents.err);
9307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9308 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9309 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9310 int64_t ret_ref = 0;
9311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9314 ret_ref = (uintptr_t)ret_var.inner;
9315 if (ret_var.is_owned) {
9321 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9322 CHECK(owner->result_ok);
9323 return Ping_clone(&*owner->contents.result);
9325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9326 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9327 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9328 int64_t ret_ref = 0;
9329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9332 ret_ref = (uintptr_t)ret_var.inner;
9333 if (ret_var.is_owned) {
9339 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9340 CHECK(!owner->result_ok);
9341 return DecodeError_clone(&*owner->contents.err);
9343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9344 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9345 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9346 int64_t ret_ref = 0;
9347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9350 ret_ref = (uintptr_t)ret_var.inner;
9351 if (ret_var.is_owned) {
9357 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9358 CHECK(owner->result_ok);
9359 return Pong_clone(&*owner->contents.result);
9361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9362 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9363 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9364 int64_t ret_ref = 0;
9365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9368 ret_ref = (uintptr_t)ret_var.inner;
9369 if (ret_var.is_owned) {
9375 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9376 CHECK(!owner->result_ok);
9377 return DecodeError_clone(&*owner->contents.err);
9379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9380 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9381 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9382 int64_t ret_ref = 0;
9383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9386 ret_ref = (uintptr_t)ret_var.inner;
9387 if (ret_var.is_owned) {
9393 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9394 CHECK(owner->result_ok);
9395 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9398 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9399 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9400 int64_t ret_ref = 0;
9401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9404 ret_ref = (uintptr_t)ret_var.inner;
9405 if (ret_var.is_owned) {
9411 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9412 CHECK(!owner->result_ok);
9413 return DecodeError_clone(&*owner->contents.err);
9415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9416 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9417 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9418 int64_t ret_ref = 0;
9419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9422 ret_ref = (uintptr_t)ret_var.inner;
9423 if (ret_var.is_owned) {
9429 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9430 CHECK(owner->result_ok);
9431 return ChannelAnnouncement_clone(&*owner->contents.result);
9433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9434 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9435 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9436 int64_t ret_ref = 0;
9437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9440 ret_ref = (uintptr_t)ret_var.inner;
9441 if (ret_var.is_owned) {
9447 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9448 CHECK(!owner->result_ok);
9449 return DecodeError_clone(&*owner->contents.err);
9451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9452 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9453 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9454 int64_t ret_ref = 0;
9455 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9456 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9458 ret_ref = (uintptr_t)ret_var.inner;
9459 if (ret_var.is_owned) {
9465 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9466 CHECK(owner->result_ok);
9467 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9470 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9471 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9472 int64_t ret_ref = 0;
9473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9476 ret_ref = (uintptr_t)ret_var.inner;
9477 if (ret_var.is_owned) {
9483 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9484 CHECK(!owner->result_ok);
9485 return DecodeError_clone(&*owner->contents.err);
9487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9488 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9489 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9490 int64_t ret_ref = 0;
9491 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9492 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9494 ret_ref = (uintptr_t)ret_var.inner;
9495 if (ret_var.is_owned) {
9501 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9502 CHECK(owner->result_ok);
9503 return ChannelUpdate_clone(&*owner->contents.result);
9505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9506 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9507 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9508 int64_t ret_ref = 0;
9509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9512 ret_ref = (uintptr_t)ret_var.inner;
9513 if (ret_var.is_owned) {
9519 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9520 CHECK(!owner->result_ok);
9521 return DecodeError_clone(&*owner->contents.err);
9523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9524 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9525 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9526 int64_t ret_ref = 0;
9527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9530 ret_ref = (uintptr_t)ret_var.inner;
9531 if (ret_var.is_owned) {
9537 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9538 CHECK(owner->result_ok);
9539 return ErrorMessage_clone(&*owner->contents.result);
9541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9542 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9543 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9544 int64_t ret_ref = 0;
9545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9548 ret_ref = (uintptr_t)ret_var.inner;
9549 if (ret_var.is_owned) {
9555 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9556 CHECK(!owner->result_ok);
9557 return DecodeError_clone(&*owner->contents.err);
9559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9560 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9561 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9562 int64_t ret_ref = 0;
9563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9566 ret_ref = (uintptr_t)ret_var.inner;
9567 if (ret_var.is_owned) {
9573 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9574 CHECK(owner->result_ok);
9575 return WarningMessage_clone(&*owner->contents.result);
9577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9578 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9579 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9580 int64_t ret_ref = 0;
9581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9584 ret_ref = (uintptr_t)ret_var.inner;
9585 if (ret_var.is_owned) {
9591 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9592 CHECK(!owner->result_ok);
9593 return DecodeError_clone(&*owner->contents.err);
9595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9596 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9597 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9598 int64_t ret_ref = 0;
9599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9602 ret_ref = (uintptr_t)ret_var.inner;
9603 if (ret_var.is_owned) {
9609 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9610 CHECK(owner->result_ok);
9611 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9614 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9615 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9616 int64_t ret_ref = 0;
9617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9620 ret_ref = (uintptr_t)ret_var.inner;
9621 if (ret_var.is_owned) {
9627 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9628 CHECK(!owner->result_ok);
9629 return DecodeError_clone(&*owner->contents.err);
9631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9632 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9633 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9634 int64_t ret_ref = 0;
9635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9638 ret_ref = (uintptr_t)ret_var.inner;
9639 if (ret_var.is_owned) {
9645 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9646 CHECK(owner->result_ok);
9647 return NodeAnnouncement_clone(&*owner->contents.result);
9649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9650 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9651 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9652 int64_t ret_ref = 0;
9653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9656 ret_ref = (uintptr_t)ret_var.inner;
9657 if (ret_var.is_owned) {
9663 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9664 CHECK(!owner->result_ok);
9665 return DecodeError_clone(&*owner->contents.err);
9667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9668 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9669 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9670 int64_t ret_ref = 0;
9671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9674 ret_ref = (uintptr_t)ret_var.inner;
9675 if (ret_var.is_owned) {
9681 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9682 CHECK(owner->result_ok);
9683 return QueryShortChannelIds_clone(&*owner->contents.result);
9685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9686 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9687 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9688 int64_t ret_ref = 0;
9689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9692 ret_ref = (uintptr_t)ret_var.inner;
9693 if (ret_var.is_owned) {
9699 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9700 CHECK(!owner->result_ok);
9701 return DecodeError_clone(&*owner->contents.err);
9703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9704 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9705 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9706 int64_t ret_ref = 0;
9707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9710 ret_ref = (uintptr_t)ret_var.inner;
9711 if (ret_var.is_owned) {
9717 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9718 CHECK(owner->result_ok);
9719 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9722 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9723 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9724 int64_t ret_ref = 0;
9725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9728 ret_ref = (uintptr_t)ret_var.inner;
9729 if (ret_var.is_owned) {
9735 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9736 CHECK(!owner->result_ok);
9737 return DecodeError_clone(&*owner->contents.err);
9739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9740 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9741 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9742 int64_t ret_ref = 0;
9743 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9744 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9746 ret_ref = (uintptr_t)ret_var.inner;
9747 if (ret_var.is_owned) {
9753 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9754 CHECK(owner->result_ok);
9755 return QueryChannelRange_clone(&*owner->contents.result);
9757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9758 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9759 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9760 int64_t ret_ref = 0;
9761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9764 ret_ref = (uintptr_t)ret_var.inner;
9765 if (ret_var.is_owned) {
9771 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9772 CHECK(!owner->result_ok);
9773 return DecodeError_clone(&*owner->contents.err);
9775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9776 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9777 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9778 int64_t ret_ref = 0;
9779 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9780 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9782 ret_ref = (uintptr_t)ret_var.inner;
9783 if (ret_var.is_owned) {
9789 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9790 CHECK(owner->result_ok);
9791 return ReplyChannelRange_clone(&*owner->contents.result);
9793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9794 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9795 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9796 int64_t ret_ref = 0;
9797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9800 ret_ref = (uintptr_t)ret_var.inner;
9801 if (ret_var.is_owned) {
9807 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9808 CHECK(!owner->result_ok);
9809 return DecodeError_clone(&*owner->contents.err);
9811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9812 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9813 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9814 int64_t ret_ref = 0;
9815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9818 ret_ref = (uintptr_t)ret_var.inner;
9819 if (ret_var.is_owned) {
9825 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9826 CHECK(owner->result_ok);
9827 return GossipTimestampFilter_clone(&*owner->contents.result);
9829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9830 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9831 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9832 int64_t ret_ref = 0;
9833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9836 ret_ref = (uintptr_t)ret_var.inner;
9837 if (ret_var.is_owned) {
9843 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9844 CHECK(!owner->result_ok);
9845 return DecodeError_clone(&*owner->contents.err);
9847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9848 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9849 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9850 int64_t ret_ref = 0;
9851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9854 ret_ref = (uintptr_t)ret_var.inner;
9855 if (ret_var.is_owned) {
9861 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9862 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9863 for (size_t i = 0; i < ret.datalen; i++) {
9864 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9868 static jclass LDKSignOrCreationError_SignError_class = NULL;
9869 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9870 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9871 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9873 LDKSignOrCreationError_SignError_class =
9874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9875 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9876 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9877 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9878 LDKSignOrCreationError_CreationError_class =
9879 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9880 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9881 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9882 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9884 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9885 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9887 case LDKSignOrCreationError_SignError: {
9888 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9890 case LDKSignOrCreationError_CreationError: {
9891 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9892 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9897 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9898 CHECK(owner->result_ok);
9899 return Invoice_clone(&*owner->contents.result);
9901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9902 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9903 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9904 int64_t ret_ref = 0;
9905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9908 ret_ref = (uintptr_t)ret_var.inner;
9909 if (ret_var.is_owned) {
9915 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9916 CHECK(!owner->result_ok);
9917 return SignOrCreationError_clone(&*owner->contents.err);
9919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9920 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9921 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9922 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9923 int64_t ret_ref = (uintptr_t)ret_copy;
9927 typedef struct LDKFilter_JCalls {
9928 atomic_size_t refcnt;
9931 jmethodID register_tx_meth;
9932 jmethodID register_output_meth;
9934 static void LDKFilter_JCalls_free(void* this_arg) {
9935 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9936 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9938 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9939 if (get_jenv_res == JNI_EDETACHED) {
9940 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9942 DO_ASSERT(get_jenv_res == JNI_OK);
9944 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9945 if (get_jenv_res == JNI_EDETACHED) {
9946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9951 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9952 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9954 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9955 if (get_jenv_res == JNI_EDETACHED) {
9956 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9958 DO_ASSERT(get_jenv_res == JNI_OK);
9960 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9961 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9962 LDKu8slice script_pubkey_var = script_pubkey;
9963 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9964 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9965 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9967 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9968 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9969 (*env)->ExceptionDescribe(env);
9970 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9972 if (get_jenv_res == JNI_EDETACHED) {
9973 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9976 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9977 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9979 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9980 if (get_jenv_res == JNI_EDETACHED) {
9981 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9983 DO_ASSERT(get_jenv_res == JNI_OK);
9985 LDKWatchedOutput output_var = output;
9986 int64_t output_ref = 0;
9987 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9988 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9989 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9990 output_ref = (uintptr_t)output_var.inner;
9991 if (output_var.is_owned) {
9994 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9996 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9997 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9998 (*env)->ExceptionDescribe(env);
9999 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
10001 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10002 CHECK_ACCESS(ret_ptr);
10003 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
10005 if (get_jenv_res == JNI_EDETACHED) {
10006 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10010 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10011 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10012 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10014 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
10015 jclass c = (*env)->GetObjectClass(env, o);
10017 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10018 atomic_init(&calls->refcnt, 1);
10019 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10020 calls->o = (*env)->NewWeakGlobalRef(env, o);
10021 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
10022 CHECK(calls->register_tx_meth != NULL);
10023 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
10024 CHECK(calls->register_output_meth != NULL);
10027 .this_arg = (void*) calls,
10028 .register_tx = register_tx_LDKFilter_jcall,
10029 .register_output = register_output_LDKFilter_jcall,
10030 .free = LDKFilter_JCalls_free,
10034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
10035 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10036 *res_ptr = LDKFilter_init(env, clz, o);
10037 return (uint64_t)res_ptr;
10039 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) {
10040 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10041 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10042 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10043 unsigned char txid_arr[32];
10044 CHECK((*env)->GetArrayLength(env, txid) == 32);
10045 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10046 unsigned char (*txid_ref)[32] = &txid_arr;
10047 LDKu8slice script_pubkey_ref;
10048 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10049 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
10050 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10051 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
10054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
10055 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10056 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10057 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10058 LDKWatchedOutput output_conv;
10059 output_conv.inner = (void*)(output & (~1));
10060 output_conv.is_owned = (output & 1) || (output == 0);
10061 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10062 output_conv = WatchedOutput_clone(&output_conv);
10063 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10064 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10065 int64_t ret_ref = (uintptr_t)ret_copy;
10069 static jclass LDKCOption_FilterZ_Some_class = NULL;
10070 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
10071 static jclass LDKCOption_FilterZ_None_class = NULL;
10072 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
10073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
10074 LDKCOption_FilterZ_Some_class =
10075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
10076 CHECK(LDKCOption_FilterZ_Some_class != NULL);
10077 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
10078 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
10079 LDKCOption_FilterZ_None_class =
10080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
10081 CHECK(LDKCOption_FilterZ_None_class != NULL);
10082 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
10083 CHECK(LDKCOption_FilterZ_None_meth != NULL);
10085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10086 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
10088 case LDKCOption_FilterZ_Some: {
10089 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10090 *some_ret = obj->some;
10091 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10092 if ((*some_ret).free == LDKFilter_JCalls_free) {
10093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10094 LDKFilter_JCalls_cloned(&(*some_ret));
10096 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
10098 case LDKCOption_FilterZ_None: {
10099 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
10104 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10105 CHECK(owner->result_ok);
10106 return &*owner->contents.result;
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10109 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10110 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10111 int64_t ret_ref = 0;
10112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10115 ret_ref = (uintptr_t)ret_var.inner & ~1;
10119 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10120 CHECK(!owner->result_ok);
10121 return *owner->contents.err;
10123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10124 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10125 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10128 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10129 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10130 for (size_t i = 0; i < ret.datalen; i++) {
10131 ret.data[i] = OutPoint_clone(&orig->data[i]);
10135 typedef struct LDKMessageSendEventsProvider_JCalls {
10136 atomic_size_t refcnt;
10139 jmethodID get_and_clear_pending_msg_events_meth;
10140 } LDKMessageSendEventsProvider_JCalls;
10141 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
10142 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10143 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10145 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10146 if (get_jenv_res == JNI_EDETACHED) {
10147 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10149 DO_ASSERT(get_jenv_res == JNI_OK);
10151 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10152 if (get_jenv_res == JNI_EDETACHED) {
10153 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10158 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
10159 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10161 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10162 if (get_jenv_res == JNI_EDETACHED) {
10163 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10165 DO_ASSERT(get_jenv_res == JNI_OK);
10167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10168 CHECK(obj != NULL);
10169 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
10170 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10171 (*env)->ExceptionDescribe(env);
10172 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
10174 LDKCVec_MessageSendEventZ ret_constr;
10175 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10176 if (ret_constr.datalen > 0)
10177 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10179 ret_constr.data = NULL;
10180 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10181 for (size_t s = 0; s < ret_constr.datalen; s++) {
10182 int64_t ret_conv_18 = ret_vals[s];
10183 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
10184 CHECK_ACCESS(ret_conv_18_ptr);
10185 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10186 FREE((void*)ret_conv_18);
10187 ret_constr.data[s] = ret_conv_18_conv;
10189 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10190 if (get_jenv_res == JNI_EDETACHED) {
10191 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10195 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10196 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10197 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10199 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10200 jclass c = (*env)->GetObjectClass(env, o);
10202 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10203 atomic_init(&calls->refcnt, 1);
10204 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10205 calls->o = (*env)->NewWeakGlobalRef(env, o);
10206 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10207 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10209 LDKMessageSendEventsProvider ret = {
10210 .this_arg = (void*) calls,
10211 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10212 .free = LDKMessageSendEventsProvider_JCalls_free,
10216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10217 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10218 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10219 return (uint64_t)res_ptr;
10221 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10222 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10223 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10224 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10225 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10226 int64_tArray ret_arr = NULL;
10227 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10228 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10229 for (size_t s = 0; s < ret_var.datalen; s++) {
10230 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10231 *ret_conv_18_copy = ret_var.data[s];
10232 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
10233 ret_arr_ptr[s] = ret_conv_18_ref;
10235 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10236 FREE(ret_var.data);
10240 typedef struct LDKEventHandler_JCalls {
10241 atomic_size_t refcnt;
10244 jmethodID handle_event_meth;
10245 } LDKEventHandler_JCalls;
10246 static void LDKEventHandler_JCalls_free(void* this_arg) {
10247 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10248 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10250 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10251 if (get_jenv_res == JNI_EDETACHED) {
10252 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10254 DO_ASSERT(get_jenv_res == JNI_OK);
10256 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10257 if (get_jenv_res == JNI_EDETACHED) {
10258 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10263 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10264 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10266 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10267 if (get_jenv_res == JNI_EDETACHED) {
10268 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10270 DO_ASSERT(get_jenv_res == JNI_OK);
10272 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10273 *ret_event = Event_clone(event);
10274 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10275 CHECK(obj != NULL);
10276 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10277 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10278 (*env)->ExceptionDescribe(env);
10279 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10281 if (get_jenv_res == JNI_EDETACHED) {
10282 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10285 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10286 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10287 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10289 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10290 jclass c = (*env)->GetObjectClass(env, o);
10292 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10293 atomic_init(&calls->refcnt, 1);
10294 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10295 calls->o = (*env)->NewWeakGlobalRef(env, o);
10296 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10297 CHECK(calls->handle_event_meth != NULL);
10299 LDKEventHandler ret = {
10300 .this_arg = (void*) calls,
10301 .handle_event = handle_event_LDKEventHandler_jcall,
10302 .free = LDKEventHandler_JCalls_free,
10306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10307 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10308 *res_ptr = LDKEventHandler_init(env, clz, o);
10309 return (uint64_t)res_ptr;
10311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10312 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10313 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10314 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10315 LDKEvent* event_conv = (LDKEvent*)event;
10316 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10319 typedef struct LDKEventsProvider_JCalls {
10320 atomic_size_t refcnt;
10323 jmethodID process_pending_events_meth;
10324 } LDKEventsProvider_JCalls;
10325 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10326 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10327 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10329 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10330 if (get_jenv_res == JNI_EDETACHED) {
10331 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10333 DO_ASSERT(get_jenv_res == JNI_OK);
10335 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10336 if (get_jenv_res == JNI_EDETACHED) {
10337 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10342 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10343 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10345 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10346 if (get_jenv_res == JNI_EDETACHED) {
10347 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10349 DO_ASSERT(get_jenv_res == JNI_OK);
10351 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10352 *handler_ret = handler;
10353 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10354 CHECK(obj != NULL);
10355 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10356 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10357 (*env)->ExceptionDescribe(env);
10358 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10360 if (get_jenv_res == JNI_EDETACHED) {
10361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10364 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10365 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10366 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10368 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10369 jclass c = (*env)->GetObjectClass(env, o);
10371 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10372 atomic_init(&calls->refcnt, 1);
10373 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10374 calls->o = (*env)->NewWeakGlobalRef(env, o);
10375 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10376 CHECK(calls->process_pending_events_meth != NULL);
10378 LDKEventsProvider ret = {
10379 .this_arg = (void*) calls,
10380 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10381 .free = LDKEventsProvider_JCalls_free,
10385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10386 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10387 *res_ptr = LDKEventsProvider_init(env, clz, o);
10388 return (uint64_t)res_ptr;
10390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10391 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10392 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10393 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10394 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10395 CHECK_ACCESS(handler_ptr);
10396 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10397 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10398 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10399 LDKEventHandler_JCalls_cloned(&handler_conv);
10401 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10404 typedef struct LDKScore_JCalls {
10405 atomic_size_t refcnt;
10408 jmethodID channel_penalty_msat_meth;
10409 jmethodID payment_path_failed_meth;
10410 jmethodID payment_path_successful_meth;
10411 jmethodID write_meth;
10413 static void LDKScore_JCalls_free(void* this_arg) {
10414 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10415 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10417 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10418 if (get_jenv_res == JNI_EDETACHED) {
10419 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10421 DO_ASSERT(get_jenv_res == JNI_OK);
10423 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10424 if (get_jenv_res == JNI_EDETACHED) {
10425 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10430 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
10431 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10433 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10434 if (get_jenv_res == JNI_EDETACHED) {
10435 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10437 DO_ASSERT(get_jenv_res == JNI_OK);
10439 int64_t short_channel_id_conv = short_channel_id;
10440 LDKNodeId source_var = *source;
10441 int64_t source_ref = 0;
10442 source_var = NodeId_clone(&source_var);
10443 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10444 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10445 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10446 source_ref = (uintptr_t)source_var.inner;
10447 if (source_var.is_owned) {
10450 LDKNodeId target_var = *target;
10451 int64_t target_ref = 0;
10452 target_var = NodeId_clone(&target_var);
10453 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10454 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10455 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10456 target_ref = (uintptr_t)target_var.inner;
10457 if (target_var.is_owned) {
10460 LDKChannelUsage usage_var = usage;
10461 int64_t usage_ref = 0;
10462 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10463 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10464 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10465 usage_ref = (uintptr_t)usage_var.inner;
10466 if (usage_var.is_owned) {
10469 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10470 CHECK(obj != NULL);
10471 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
10472 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10473 (*env)->ExceptionDescribe(env);
10474 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10476 if (get_jenv_res == JNI_EDETACHED) {
10477 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10481 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10482 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10484 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10485 if (get_jenv_res == JNI_EDETACHED) {
10486 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10488 DO_ASSERT(get_jenv_res == JNI_OK);
10490 LDKCVec_RouteHopZ path_var = path;
10491 int64_tArray path_arr = NULL;
10492 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10493 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10494 for (size_t k = 0; k < path_var.datalen; k++) {
10495 LDKRouteHop path_conv_10_var = path_var.data[k];
10496 int64_t path_conv_10_ref = 0;
10497 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10498 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10499 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10500 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10501 if (path_conv_10_var.is_owned) {
10502 path_conv_10_ref |= 1;
10504 path_arr_ptr[k] = path_conv_10_ref;
10506 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10507 FREE(path_var.data);
10508 int64_t short_channel_id_conv = short_channel_id;
10509 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10510 CHECK(obj != NULL);
10511 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
10512 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10513 (*env)->ExceptionDescribe(env);
10514 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10516 if (get_jenv_res == JNI_EDETACHED) {
10517 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10520 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10521 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10523 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10524 if (get_jenv_res == JNI_EDETACHED) {
10525 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10527 DO_ASSERT(get_jenv_res == JNI_OK);
10529 LDKCVec_RouteHopZ path_var = path;
10530 int64_tArray path_arr = NULL;
10531 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10532 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10533 for (size_t k = 0; k < path_var.datalen; k++) {
10534 LDKRouteHop path_conv_10_var = path_var.data[k];
10535 int64_t path_conv_10_ref = 0;
10536 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10537 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10538 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10539 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10540 if (path_conv_10_var.is_owned) {
10541 path_conv_10_ref |= 1;
10543 path_arr_ptr[k] = path_conv_10_ref;
10545 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10546 FREE(path_var.data);
10547 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10548 CHECK(obj != NULL);
10549 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
10550 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10551 (*env)->ExceptionDescribe(env);
10552 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
10554 if (get_jenv_res == JNI_EDETACHED) {
10555 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10558 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10559 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10561 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10562 if (get_jenv_res == JNI_EDETACHED) {
10563 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10565 DO_ASSERT(get_jenv_res == JNI_OK);
10567 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10568 CHECK(obj != NULL);
10569 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10570 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10571 (*env)->ExceptionDescribe(env);
10572 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10574 LDKCVec_u8Z ret_ref;
10575 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10576 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10577 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10578 if (get_jenv_res == JNI_EDETACHED) {
10579 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10583 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10584 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10585 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10587 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10588 jclass c = (*env)->GetObjectClass(env, o);
10590 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10591 atomic_init(&calls->refcnt, 1);
10592 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10593 calls->o = (*env)->NewWeakGlobalRef(env, o);
10594 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
10595 CHECK(calls->channel_penalty_msat_meth != NULL);
10596 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10597 CHECK(calls->payment_path_failed_meth != NULL);
10598 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
10599 CHECK(calls->payment_path_successful_meth != NULL);
10600 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10601 CHECK(calls->write_meth != NULL);
10604 .this_arg = (void*) calls,
10605 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10606 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10607 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10608 .write = write_LDKScore_jcall,
10609 .free = LDKScore_JCalls_free,
10613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10614 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10615 *res_ptr = LDKScore_init(env, clz, o);
10616 return (uint64_t)res_ptr;
10618 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) {
10619 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10621 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10622 LDKNodeId source_conv;
10623 source_conv.inner = (void*)(source & (~1));
10624 source_conv.is_owned = false;
10625 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10626 LDKNodeId target_conv;
10627 target_conv.inner = (void*)(target & (~1));
10628 target_conv.is_owned = false;
10629 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10630 LDKChannelUsage usage_conv;
10631 usage_conv.inner = (void*)(usage & (~1));
10632 usage_conv.is_owned = (usage & 1) || (usage == 0);
10633 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10634 usage_conv = ChannelUsage_clone(&usage_conv);
10635 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10639 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) {
10640 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10641 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10642 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10643 LDKCVec_RouteHopZ path_constr;
10644 path_constr.datalen = (*env)->GetArrayLength(env, path);
10645 if (path_constr.datalen > 0)
10646 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10648 path_constr.data = NULL;
10649 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10650 for (size_t k = 0; k < path_constr.datalen; k++) {
10651 int64_t path_conv_10 = path_vals[k];
10652 LDKRouteHop path_conv_10_conv;
10653 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10654 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10655 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10656 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10657 path_constr.data[k] = path_conv_10_conv;
10659 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10660 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10664 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10665 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10666 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10667 LDKCVec_RouteHopZ path_constr;
10668 path_constr.datalen = (*env)->GetArrayLength(env, path);
10669 if (path_constr.datalen > 0)
10670 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10672 path_constr.data = NULL;
10673 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10674 for (size_t k = 0; k < path_constr.datalen; k++) {
10675 int64_t path_conv_10 = path_vals[k];
10676 LDKRouteHop path_conv_10_conv;
10677 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10678 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10679 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10680 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10681 path_constr.data[k] = path_conv_10_conv;
10683 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10684 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10688 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10689 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10690 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10691 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10692 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10693 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10694 CVec_u8Z_free(ret_var);
10698 typedef struct LDKPersister_JCalls {
10699 atomic_size_t refcnt;
10702 jmethodID persist_manager_meth;
10703 jmethodID persist_graph_meth;
10704 jmethodID persist_scorer_meth;
10705 } LDKPersister_JCalls;
10706 static void LDKPersister_JCalls_free(void* this_arg) {
10707 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10708 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10710 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10711 if (get_jenv_res == JNI_EDETACHED) {
10712 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10714 DO_ASSERT(get_jenv_res == JNI_OK);
10716 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10717 if (get_jenv_res == JNI_EDETACHED) {
10718 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10723 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10724 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10727 if (get_jenv_res == JNI_EDETACHED) {
10728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10730 DO_ASSERT(get_jenv_res == JNI_OK);
10732 LDKChannelManager channel_manager_var = *channel_manager;
10733 int64_t channel_manager_ref = 0;
10734 // WARNING: we may need a move here but no clone is available for LDKChannelManager
10735 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10736 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10737 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10738 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
10739 if (channel_manager_var.is_owned) {
10740 channel_manager_ref |= 1;
10742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10743 CHECK(obj != NULL);
10744 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10745 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10746 (*env)->ExceptionDescribe(env);
10747 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
10749 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10750 CHECK_ACCESS(ret_ptr);
10751 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10753 if (get_jenv_res == JNI_EDETACHED) {
10754 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10758 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10759 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10762 if (get_jenv_res == JNI_EDETACHED) {
10763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10765 DO_ASSERT(get_jenv_res == JNI_OK);
10767 LDKNetworkGraph network_graph_var = *network_graph;
10768 int64_t network_graph_ref = 0;
10769 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10770 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10771 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10772 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10773 network_graph_ref = (uintptr_t)network_graph_var.inner;
10774 if (network_graph_var.is_owned) {
10775 network_graph_ref |= 1;
10777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10778 CHECK(obj != NULL);
10779 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10780 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10781 (*env)->ExceptionDescribe(env);
10782 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10784 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10785 CHECK_ACCESS(ret_ptr);
10786 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10788 if (get_jenv_res == JNI_EDETACHED) {
10789 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10793 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
10794 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10796 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10797 if (get_jenv_res == JNI_EDETACHED) {
10798 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10800 DO_ASSERT(get_jenv_res == JNI_OK);
10802 LDKMultiThreadedLockableScore scorer_var = *scorer;
10803 int64_t scorer_ref = 0;
10804 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
10805 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10806 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10807 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
10808 scorer_ref = (uintptr_t)scorer_var.inner;
10809 if (scorer_var.is_owned) {
10812 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10813 CHECK(obj != NULL);
10814 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
10815 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10816 (*env)->ExceptionDescribe(env);
10817 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10819 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10820 CHECK_ACCESS(ret_ptr);
10821 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10823 if (get_jenv_res == JNI_EDETACHED) {
10824 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10828 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10829 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10830 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10832 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10833 jclass c = (*env)->GetObjectClass(env, o);
10835 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10836 atomic_init(&calls->refcnt, 1);
10837 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10838 calls->o = (*env)->NewWeakGlobalRef(env, o);
10839 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10840 CHECK(calls->persist_manager_meth != NULL);
10841 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10842 CHECK(calls->persist_graph_meth != NULL);
10843 calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10844 CHECK(calls->persist_scorer_meth != NULL);
10846 LDKPersister ret = {
10847 .this_arg = (void*) calls,
10848 .persist_manager = persist_manager_LDKPersister_jcall,
10849 .persist_graph = persist_graph_LDKPersister_jcall,
10850 .persist_scorer = persist_scorer_LDKPersister_jcall,
10851 .free = LDKPersister_JCalls_free,
10855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10856 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10857 *res_ptr = LDKPersister_init(env, clz, o);
10858 return (uint64_t)res_ptr;
10860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10861 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10862 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10863 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10864 LDKChannelManager channel_manager_conv;
10865 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10866 channel_manager_conv.is_owned = false;
10867 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10868 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10869 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10870 return (int64_t)ret_conv;
10873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10874 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10875 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10876 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10877 LDKNetworkGraph network_graph_conv;
10878 network_graph_conv.inner = (void*)(network_graph & (~1));
10879 network_graph_conv.is_owned = false;
10880 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10881 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10882 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10883 return (int64_t)ret_conv;
10886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10887 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10888 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10889 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10890 LDKMultiThreadedLockableScore scorer_conv;
10891 scorer_conv.inner = (void*)(scorer & (~1));
10892 scorer_conv.is_owned = false;
10893 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
10894 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10895 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
10896 return (int64_t)ret_conv;
10899 typedef struct LDKListen_JCalls {
10900 atomic_size_t refcnt;
10903 jmethodID filtered_block_connected_meth;
10904 jmethodID block_connected_meth;
10905 jmethodID block_disconnected_meth;
10906 } LDKListen_JCalls;
10907 static void LDKListen_JCalls_free(void* this_arg) {
10908 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10909 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10911 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10912 if (get_jenv_res == JNI_EDETACHED) {
10913 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10915 DO_ASSERT(get_jenv_res == JNI_OK);
10917 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10918 if (get_jenv_res == JNI_EDETACHED) {
10919 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10924 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10925 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10927 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10928 if (get_jenv_res == JNI_EDETACHED) {
10929 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10931 DO_ASSERT(get_jenv_res == JNI_OK);
10933 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10934 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10935 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10936 int64_tArray txdata_arr = NULL;
10937 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10938 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10939 for (size_t c = 0; c < txdata_var.datalen; c++) {
10940 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10941 *txdata_conv_28_conv = txdata_var.data[c];
10942 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
10944 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10945 FREE(txdata_var.data);
10946 int32_t height_conv = height;
10947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10948 CHECK(obj != NULL);
10949 (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
10950 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10951 (*env)->ExceptionDescribe(env);
10952 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
10954 if (get_jenv_res == JNI_EDETACHED) {
10955 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10958 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10959 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10961 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10962 if (get_jenv_res == JNI_EDETACHED) {
10963 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10965 DO_ASSERT(get_jenv_res == JNI_OK);
10967 LDKu8slice block_var = block;
10968 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10969 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10970 int32_t height_conv = height;
10971 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10972 CHECK(obj != NULL);
10973 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10974 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10975 (*env)->ExceptionDescribe(env);
10976 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10978 if (get_jenv_res == JNI_EDETACHED) {
10979 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10982 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10983 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10985 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10986 if (get_jenv_res == JNI_EDETACHED) {
10987 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10989 DO_ASSERT(get_jenv_res == JNI_OK);
10991 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10992 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10993 int32_t height_conv = height;
10994 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10995 CHECK(obj != NULL);
10996 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10997 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10998 (*env)->ExceptionDescribe(env);
10999 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
11001 if (get_jenv_res == JNI_EDETACHED) {
11002 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11005 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11006 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11007 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11009 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
11010 jclass c = (*env)->GetObjectClass(env, o);
11012 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11013 atomic_init(&calls->refcnt, 1);
11014 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11015 calls->o = (*env)->NewWeakGlobalRef(env, o);
11016 calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
11017 CHECK(calls->filtered_block_connected_meth != NULL);
11018 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
11019 CHECK(calls->block_connected_meth != NULL);
11020 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
11021 CHECK(calls->block_disconnected_meth != NULL);
11024 .this_arg = (void*) calls,
11025 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11026 .block_connected = block_connected_LDKListen_jcall,
11027 .block_disconnected = block_disconnected_LDKListen_jcall,
11028 .free = LDKListen_JCalls_free,
11032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
11033 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11034 *res_ptr = LDKListen_init(env, clz, o);
11035 return (uint64_t)res_ptr;
11037 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) {
11038 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11039 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11040 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11041 unsigned char header_arr[80];
11042 CHECK((*env)->GetArrayLength(env, header) == 80);
11043 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11044 unsigned char (*header_ref)[80] = &header_arr;
11045 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11046 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11047 if (txdata_constr.datalen > 0)
11048 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11050 txdata_constr.data = NULL;
11051 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11052 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11053 int64_t txdata_conv_28 = txdata_vals[c];
11054 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11055 CHECK_ACCESS(txdata_conv_28_ptr);
11056 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11057 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11058 txdata_constr.data[c] = txdata_conv_28_conv;
11060 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11061 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11064 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) {
11065 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11066 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11067 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11068 LDKu8slice block_ref;
11069 block_ref.datalen = (*env)->GetArrayLength(env, block);
11070 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
11071 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11072 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
11075 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) {
11076 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11077 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11078 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11079 unsigned char header_arr[80];
11080 CHECK((*env)->GetArrayLength(env, header) == 80);
11081 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11082 unsigned char (*header_ref)[80] = &header_arr;
11083 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11086 typedef struct LDKConfirm_JCalls {
11087 atomic_size_t refcnt;
11090 jmethodID transactions_confirmed_meth;
11091 jmethodID transaction_unconfirmed_meth;
11092 jmethodID best_block_updated_meth;
11093 jmethodID get_relevant_txids_meth;
11094 } LDKConfirm_JCalls;
11095 static void LDKConfirm_JCalls_free(void* this_arg) {
11096 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11097 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11099 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11100 if (get_jenv_res == JNI_EDETACHED) {
11101 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11103 DO_ASSERT(get_jenv_res == JNI_OK);
11105 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11106 if (get_jenv_res == JNI_EDETACHED) {
11107 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11112 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11113 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11116 if (get_jenv_res == JNI_EDETACHED) {
11117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11119 DO_ASSERT(get_jenv_res == JNI_OK);
11121 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11122 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11123 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11124 int64_tArray txdata_arr = NULL;
11125 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11126 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11127 for (size_t c = 0; c < txdata_var.datalen; c++) {
11128 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11129 *txdata_conv_28_conv = txdata_var.data[c];
11130 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11132 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11133 FREE(txdata_var.data);
11134 int32_t height_conv = height;
11135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11136 CHECK(obj != NULL);
11137 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
11138 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11139 (*env)->ExceptionDescribe(env);
11140 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
11142 if (get_jenv_res == JNI_EDETACHED) {
11143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11146 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11147 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11149 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11150 if (get_jenv_res == JNI_EDETACHED) {
11151 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11153 DO_ASSERT(get_jenv_res == JNI_OK);
11155 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11156 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11157 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11158 CHECK(obj != NULL);
11159 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
11160 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11161 (*env)->ExceptionDescribe(env);
11162 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
11164 if (get_jenv_res == JNI_EDETACHED) {
11165 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11168 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11169 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11171 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11172 if (get_jenv_res == JNI_EDETACHED) {
11173 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11175 DO_ASSERT(get_jenv_res == JNI_OK);
11177 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11178 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11179 int32_t height_conv = height;
11180 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11181 CHECK(obj != NULL);
11182 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
11183 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11184 (*env)->ExceptionDescribe(env);
11185 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
11187 if (get_jenv_res == JNI_EDETACHED) {
11188 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11191 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11192 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11194 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11195 if (get_jenv_res == JNI_EDETACHED) {
11196 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11198 DO_ASSERT(get_jenv_res == JNI_OK);
11200 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11201 CHECK(obj != NULL);
11202 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
11203 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11204 (*env)->ExceptionDescribe(env);
11205 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
11207 LDKCVec_TxidZ ret_constr;
11208 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11209 if (ret_constr.datalen > 0)
11210 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11212 ret_constr.data = NULL;
11213 for (size_t i = 0; i < ret_constr.datalen; i++) {
11214 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
11215 LDKThirtyTwoBytes ret_conv_8_ref;
11216 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
11217 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
11218 ret_constr.data[i] = ret_conv_8_ref;
11220 if (get_jenv_res == JNI_EDETACHED) {
11221 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11225 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11226 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11227 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11229 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
11230 jclass c = (*env)->GetObjectClass(env, o);
11232 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11233 atomic_init(&calls->refcnt, 1);
11234 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11235 calls->o = (*env)->NewWeakGlobalRef(env, o);
11236 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
11237 CHECK(calls->transactions_confirmed_meth != NULL);
11238 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
11239 CHECK(calls->transaction_unconfirmed_meth != NULL);
11240 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
11241 CHECK(calls->best_block_updated_meth != NULL);
11242 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
11243 CHECK(calls->get_relevant_txids_meth != NULL);
11246 .this_arg = (void*) calls,
11247 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11248 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11249 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11250 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11251 .free = LDKConfirm_JCalls_free,
11255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
11256 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11257 *res_ptr = LDKConfirm_init(env, clz, o);
11258 return (uint64_t)res_ptr;
11260 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) {
11261 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11262 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11263 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11264 unsigned char header_arr[80];
11265 CHECK((*env)->GetArrayLength(env, header) == 80);
11266 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11267 unsigned char (*header_ref)[80] = &header_arr;
11268 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11269 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11270 if (txdata_constr.datalen > 0)
11271 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11273 txdata_constr.data = NULL;
11274 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11275 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11276 int64_t txdata_conv_28 = txdata_vals[c];
11277 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11278 CHECK_ACCESS(txdata_conv_28_ptr);
11279 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11280 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11281 txdata_constr.data[c] = txdata_conv_28_conv;
11283 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11284 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
11288 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11289 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11290 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11291 unsigned char txid_arr[32];
11292 CHECK((*env)->GetArrayLength(env, txid) == 32);
11293 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11294 unsigned char (*txid_ref)[32] = &txid_arr;
11295 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11298 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) {
11299 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11300 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11301 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11302 unsigned char header_arr[80];
11303 CHECK((*env)->GetArrayLength(env, header) == 80);
11304 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11305 unsigned char (*header_ref)[80] = &header_arr;
11306 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11309 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
11310 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11312 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11313 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11314 jobjectArray ret_arr = NULL;
11315 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11317 for (size_t i = 0; i < ret_var.datalen; i++) {
11318 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
11319 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
11320 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11323 FREE(ret_var.data);
11327 typedef struct LDKPersist_JCalls {
11328 atomic_size_t refcnt;
11331 jmethodID persist_new_channel_meth;
11332 jmethodID update_persisted_channel_meth;
11333 } LDKPersist_JCalls;
11334 static void LDKPersist_JCalls_free(void* this_arg) {
11335 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11336 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11338 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11339 if (get_jenv_res == JNI_EDETACHED) {
11340 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11342 DO_ASSERT(get_jenv_res == JNI_OK);
11344 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11345 if (get_jenv_res == JNI_EDETACHED) {
11346 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11351 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11352 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11354 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11355 if (get_jenv_res == JNI_EDETACHED) {
11356 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11358 DO_ASSERT(get_jenv_res == JNI_OK);
11360 LDKOutPoint channel_id_var = channel_id;
11361 int64_t channel_id_ref = 0;
11362 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11363 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11364 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11365 channel_id_ref = (uintptr_t)channel_id_var.inner;
11366 if (channel_id_var.is_owned) {
11367 channel_id_ref |= 1;
11369 LDKChannelMonitor data_var = *data;
11370 int64_t data_ref = 0;
11371 data_var = ChannelMonitor_clone(&data_var);
11372 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11373 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11374 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11375 data_ref = (uintptr_t)data_var.inner;
11376 if (data_var.is_owned) {
11379 LDKMonitorUpdateId update_id_var = update_id;
11380 int64_t update_id_ref = 0;
11381 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11382 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11383 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11384 update_id_ref = (uintptr_t)update_id_var.inner;
11385 if (update_id_var.is_owned) {
11386 update_id_ref |= 1;
11388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11389 CHECK(obj != NULL);
11390 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
11391 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11392 (*env)->ExceptionDescribe(env);
11393 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
11395 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11396 CHECK_ACCESS(ret_ptr);
11397 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11399 if (get_jenv_res == JNI_EDETACHED) {
11400 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11404 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11405 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11407 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11408 if (get_jenv_res == JNI_EDETACHED) {
11409 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11411 DO_ASSERT(get_jenv_res == JNI_OK);
11413 LDKOutPoint channel_id_var = channel_id;
11414 int64_t channel_id_ref = 0;
11415 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11416 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11417 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11418 channel_id_ref = (uintptr_t)channel_id_var.inner;
11419 if (channel_id_var.is_owned) {
11420 channel_id_ref |= 1;
11422 LDKChannelMonitorUpdate update_var = *update;
11423 int64_t update_ref = 0;
11424 if ((uintptr_t)update_var.inner > 4096) {
11425 update_var = ChannelMonitorUpdate_clone(&update_var);
11426 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11427 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11428 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11429 update_ref = (uintptr_t)update_var.inner;
11430 if (update_var.is_owned) {
11434 LDKChannelMonitor data_var = *data;
11435 int64_t data_ref = 0;
11436 data_var = ChannelMonitor_clone(&data_var);
11437 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11438 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11439 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11440 data_ref = (uintptr_t)data_var.inner;
11441 if (data_var.is_owned) {
11444 LDKMonitorUpdateId update_id_var = update_id;
11445 int64_t update_id_ref = 0;
11446 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11447 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11448 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11449 update_id_ref = (uintptr_t)update_id_var.inner;
11450 if (update_id_var.is_owned) {
11451 update_id_ref |= 1;
11453 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11454 CHECK(obj != NULL);
11455 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
11456 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11457 (*env)->ExceptionDescribe(env);
11458 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
11460 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11461 CHECK_ACCESS(ret_ptr);
11462 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11464 if (get_jenv_res == JNI_EDETACHED) {
11465 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11469 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11470 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11473 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
11474 jclass c = (*env)->GetObjectClass(env, o);
11476 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11477 atomic_init(&calls->refcnt, 1);
11478 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11479 calls->o = (*env)->NewWeakGlobalRef(env, o);
11480 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
11481 CHECK(calls->persist_new_channel_meth != NULL);
11482 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
11483 CHECK(calls->update_persisted_channel_meth != NULL);
11486 .this_arg = (void*) calls,
11487 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11488 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11489 .free = LDKPersist_JCalls_free,
11493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
11494 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11495 *res_ptr = LDKPersist_init(env, clz, o);
11496 return (uint64_t)res_ptr;
11498 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) {
11499 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11500 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11501 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11502 LDKOutPoint channel_id_conv;
11503 channel_id_conv.inner = (void*)(channel_id & (~1));
11504 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11505 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11506 channel_id_conv = OutPoint_clone(&channel_id_conv);
11507 LDKChannelMonitor data_conv;
11508 data_conv.inner = (void*)(data & (~1));
11509 data_conv.is_owned = false;
11510 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11511 LDKMonitorUpdateId update_id_conv;
11512 update_id_conv.inner = (void*)(update_id & (~1));
11513 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11514 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11515 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11516 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11517 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
11518 return (int64_t)ret_conv;
11521 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) {
11522 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11523 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11524 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11525 LDKOutPoint channel_id_conv;
11526 channel_id_conv.inner = (void*)(channel_id & (~1));
11527 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11528 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11529 channel_id_conv = OutPoint_clone(&channel_id_conv);
11530 LDKChannelMonitorUpdate update_conv;
11531 update_conv.inner = (void*)(update & (~1));
11532 update_conv.is_owned = false;
11533 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11534 LDKChannelMonitor data_conv;
11535 data_conv.inner = (void*)(data & (~1));
11536 data_conv.is_owned = false;
11537 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11538 LDKMonitorUpdateId update_id_conv;
11539 update_id_conv.inner = (void*)(update_id & (~1));
11540 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11541 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11542 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11543 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11544 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
11545 return (int64_t)ret_conv;
11548 typedef struct LDKChannelMessageHandler_JCalls {
11549 atomic_size_t refcnt;
11552 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11553 jmethodID handle_open_channel_meth;
11554 jmethodID handle_accept_channel_meth;
11555 jmethodID handle_funding_created_meth;
11556 jmethodID handle_funding_signed_meth;
11557 jmethodID handle_channel_ready_meth;
11558 jmethodID handle_shutdown_meth;
11559 jmethodID handle_closing_signed_meth;
11560 jmethodID handle_update_add_htlc_meth;
11561 jmethodID handle_update_fulfill_htlc_meth;
11562 jmethodID handle_update_fail_htlc_meth;
11563 jmethodID handle_update_fail_malformed_htlc_meth;
11564 jmethodID handle_commitment_signed_meth;
11565 jmethodID handle_revoke_and_ack_meth;
11566 jmethodID handle_update_fee_meth;
11567 jmethodID handle_announcement_signatures_meth;
11568 jmethodID peer_disconnected_meth;
11569 jmethodID peer_connected_meth;
11570 jmethodID handle_channel_reestablish_meth;
11571 jmethodID handle_channel_update_meth;
11572 jmethodID handle_error_meth;
11573 } LDKChannelMessageHandler_JCalls;
11574 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11575 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11576 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11578 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11579 if (get_jenv_res == JNI_EDETACHED) {
11580 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11582 DO_ASSERT(get_jenv_res == JNI_OK);
11584 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11585 if (get_jenv_res == JNI_EDETACHED) {
11586 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11591 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
11592 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11594 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11595 if (get_jenv_res == JNI_EDETACHED) {
11596 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11598 DO_ASSERT(get_jenv_res == JNI_OK);
11600 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11601 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11602 LDKInitFeatures their_features_var = their_features;
11603 int64_t their_features_ref = 0;
11604 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11605 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11606 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11607 their_features_ref = (uintptr_t)their_features_var.inner;
11608 if (their_features_var.is_owned) {
11609 their_features_ref |= 1;
11611 LDKOpenChannel msg_var = *msg;
11612 int64_t msg_ref = 0;
11613 msg_var = OpenChannel_clone(&msg_var);
11614 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11615 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11616 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11617 msg_ref = (uintptr_t)msg_var.inner;
11618 if (msg_var.is_owned) {
11621 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11622 CHECK(obj != NULL);
11623 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11624 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11625 (*env)->ExceptionDescribe(env);
11626 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11628 if (get_jenv_res == JNI_EDETACHED) {
11629 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11632 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11633 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11635 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11636 if (get_jenv_res == JNI_EDETACHED) {
11637 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11639 DO_ASSERT(get_jenv_res == JNI_OK);
11641 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11642 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11643 LDKInitFeatures their_features_var = their_features;
11644 int64_t their_features_ref = 0;
11645 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11646 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11647 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11648 their_features_ref = (uintptr_t)their_features_var.inner;
11649 if (their_features_var.is_owned) {
11650 their_features_ref |= 1;
11652 LDKAcceptChannel msg_var = *msg;
11653 int64_t msg_ref = 0;
11654 msg_var = AcceptChannel_clone(&msg_var);
11655 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11656 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11657 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11658 msg_ref = (uintptr_t)msg_var.inner;
11659 if (msg_var.is_owned) {
11662 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11663 CHECK(obj != NULL);
11664 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11665 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11666 (*env)->ExceptionDescribe(env);
11667 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
11669 if (get_jenv_res == JNI_EDETACHED) {
11670 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11673 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11674 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11676 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11677 if (get_jenv_res == JNI_EDETACHED) {
11678 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11680 DO_ASSERT(get_jenv_res == JNI_OK);
11682 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11683 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11684 LDKFundingCreated msg_var = *msg;
11685 int64_t msg_ref = 0;
11686 msg_var = FundingCreated_clone(&msg_var);
11687 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11688 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11689 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11690 msg_ref = (uintptr_t)msg_var.inner;
11691 if (msg_var.is_owned) {
11694 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11695 CHECK(obj != NULL);
11696 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
11697 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11698 (*env)->ExceptionDescribe(env);
11699 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
11701 if (get_jenv_res == JNI_EDETACHED) {
11702 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11705 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11706 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11708 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11709 if (get_jenv_res == JNI_EDETACHED) {
11710 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11712 DO_ASSERT(get_jenv_res == JNI_OK);
11714 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11715 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11716 LDKFundingSigned msg_var = *msg;
11717 int64_t msg_ref = 0;
11718 msg_var = FundingSigned_clone(&msg_var);
11719 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11720 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11721 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11722 msg_ref = (uintptr_t)msg_var.inner;
11723 if (msg_var.is_owned) {
11726 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11727 CHECK(obj != NULL);
11728 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
11729 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11730 (*env)->ExceptionDescribe(env);
11731 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
11733 if (get_jenv_res == JNI_EDETACHED) {
11734 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11737 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11738 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11740 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11741 if (get_jenv_res == JNI_EDETACHED) {
11742 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11744 DO_ASSERT(get_jenv_res == JNI_OK);
11746 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11747 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11748 LDKChannelReady msg_var = *msg;
11749 int64_t msg_ref = 0;
11750 msg_var = ChannelReady_clone(&msg_var);
11751 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11752 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11753 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11754 msg_ref = (uintptr_t)msg_var.inner;
11755 if (msg_var.is_owned) {
11758 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11759 CHECK(obj != NULL);
11760 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
11761 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11762 (*env)->ExceptionDescribe(env);
11763 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
11765 if (get_jenv_res == JNI_EDETACHED) {
11766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11769 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11770 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11772 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11773 if (get_jenv_res == JNI_EDETACHED) {
11774 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11776 DO_ASSERT(get_jenv_res == JNI_OK);
11778 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11779 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11780 LDKInitFeatures their_features_var = *their_features;
11781 int64_t their_features_ref = 0;
11782 their_features_var = InitFeatures_clone(&their_features_var);
11783 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11784 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11785 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11786 their_features_ref = (uintptr_t)their_features_var.inner;
11787 if (their_features_var.is_owned) {
11788 their_features_ref |= 1;
11790 LDKShutdown msg_var = *msg;
11791 int64_t msg_ref = 0;
11792 msg_var = Shutdown_clone(&msg_var);
11793 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11794 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11795 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11796 msg_ref = (uintptr_t)msg_var.inner;
11797 if (msg_var.is_owned) {
11800 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11801 CHECK(obj != NULL);
11802 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11803 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11804 (*env)->ExceptionDescribe(env);
11805 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11807 if (get_jenv_res == JNI_EDETACHED) {
11808 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11811 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11812 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11814 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11815 if (get_jenv_res == JNI_EDETACHED) {
11816 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11818 DO_ASSERT(get_jenv_res == JNI_OK);
11820 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11821 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11822 LDKClosingSigned msg_var = *msg;
11823 int64_t msg_ref = 0;
11824 msg_var = ClosingSigned_clone(&msg_var);
11825 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11826 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11827 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11828 msg_ref = (uintptr_t)msg_var.inner;
11829 if (msg_var.is_owned) {
11832 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11833 CHECK(obj != NULL);
11834 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11835 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11836 (*env)->ExceptionDescribe(env);
11837 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11839 if (get_jenv_res == JNI_EDETACHED) {
11840 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11843 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11844 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11846 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11847 if (get_jenv_res == JNI_EDETACHED) {
11848 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11850 DO_ASSERT(get_jenv_res == JNI_OK);
11852 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11853 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11854 LDKUpdateAddHTLC msg_var = *msg;
11855 int64_t msg_ref = 0;
11856 msg_var = UpdateAddHTLC_clone(&msg_var);
11857 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11858 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11859 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11860 msg_ref = (uintptr_t)msg_var.inner;
11861 if (msg_var.is_owned) {
11864 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11865 CHECK(obj != NULL);
11866 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11867 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11868 (*env)->ExceptionDescribe(env);
11869 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11871 if (get_jenv_res == JNI_EDETACHED) {
11872 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11875 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11876 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11878 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11879 if (get_jenv_res == JNI_EDETACHED) {
11880 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11882 DO_ASSERT(get_jenv_res == JNI_OK);
11884 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11885 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11886 LDKUpdateFulfillHTLC msg_var = *msg;
11887 int64_t msg_ref = 0;
11888 msg_var = UpdateFulfillHTLC_clone(&msg_var);
11889 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11890 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11891 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11892 msg_ref = (uintptr_t)msg_var.inner;
11893 if (msg_var.is_owned) {
11896 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11897 CHECK(obj != NULL);
11898 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11899 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11900 (*env)->ExceptionDescribe(env);
11901 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11903 if (get_jenv_res == JNI_EDETACHED) {
11904 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11907 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11908 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
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 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11917 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11918 LDKUpdateFailHTLC msg_var = *msg;
11919 int64_t msg_ref = 0;
11920 msg_var = UpdateFailHTLC_clone(&msg_var);
11921 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11922 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11923 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11924 msg_ref = (uintptr_t)msg_var.inner;
11925 if (msg_var.is_owned) {
11928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11929 CHECK(obj != NULL);
11930 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11931 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11932 (*env)->ExceptionDescribe(env);
11933 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11935 if (get_jenv_res == JNI_EDETACHED) {
11936 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11939 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11940 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11942 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11943 if (get_jenv_res == JNI_EDETACHED) {
11944 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11946 DO_ASSERT(get_jenv_res == JNI_OK);
11948 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11949 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11950 LDKUpdateFailMalformedHTLC msg_var = *msg;
11951 int64_t msg_ref = 0;
11952 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11953 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11954 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11955 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11956 msg_ref = (uintptr_t)msg_var.inner;
11957 if (msg_var.is_owned) {
11960 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11961 CHECK(obj != NULL);
11962 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11963 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11964 (*env)->ExceptionDescribe(env);
11965 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11967 if (get_jenv_res == JNI_EDETACHED) {
11968 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11971 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11972 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11974 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11975 if (get_jenv_res == JNI_EDETACHED) {
11976 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11978 DO_ASSERT(get_jenv_res == JNI_OK);
11980 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11981 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11982 LDKCommitmentSigned msg_var = *msg;
11983 int64_t msg_ref = 0;
11984 msg_var = CommitmentSigned_clone(&msg_var);
11985 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11986 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11987 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11988 msg_ref = (uintptr_t)msg_var.inner;
11989 if (msg_var.is_owned) {
11992 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11993 CHECK(obj != NULL);
11994 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11995 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11996 (*env)->ExceptionDescribe(env);
11997 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11999 if (get_jenv_res == JNI_EDETACHED) {
12000 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12003 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12004 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12006 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12007 if (get_jenv_res == JNI_EDETACHED) {
12008 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12010 DO_ASSERT(get_jenv_res == JNI_OK);
12012 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12013 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12014 LDKRevokeAndACK msg_var = *msg;
12015 int64_t msg_ref = 0;
12016 msg_var = RevokeAndACK_clone(&msg_var);
12017 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12018 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12019 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12020 msg_ref = (uintptr_t)msg_var.inner;
12021 if (msg_var.is_owned) {
12024 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12025 CHECK(obj != NULL);
12026 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
12027 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12028 (*env)->ExceptionDescribe(env);
12029 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
12031 if (get_jenv_res == JNI_EDETACHED) {
12032 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12035 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12038 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12039 if (get_jenv_res == JNI_EDETACHED) {
12040 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12042 DO_ASSERT(get_jenv_res == JNI_OK);
12044 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12045 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12046 LDKUpdateFee msg_var = *msg;
12047 int64_t msg_ref = 0;
12048 msg_var = UpdateFee_clone(&msg_var);
12049 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12050 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12051 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12052 msg_ref = (uintptr_t)msg_var.inner;
12053 if (msg_var.is_owned) {
12056 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12057 CHECK(obj != NULL);
12058 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
12059 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12060 (*env)->ExceptionDescribe(env);
12061 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
12063 if (get_jenv_res == JNI_EDETACHED) {
12064 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12067 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12068 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12070 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12071 if (get_jenv_res == JNI_EDETACHED) {
12072 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12074 DO_ASSERT(get_jenv_res == JNI_OK);
12076 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12077 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12078 LDKAnnouncementSignatures msg_var = *msg;
12079 int64_t msg_ref = 0;
12080 msg_var = AnnouncementSignatures_clone(&msg_var);
12081 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12082 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12083 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12084 msg_ref = (uintptr_t)msg_var.inner;
12085 if (msg_var.is_owned) {
12088 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12089 CHECK(obj != NULL);
12090 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
12091 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12092 (*env)->ExceptionDescribe(env);
12093 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
12095 if (get_jenv_res == JNI_EDETACHED) {
12096 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12099 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
12100 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12102 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12103 if (get_jenv_res == JNI_EDETACHED) {
12104 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12106 DO_ASSERT(get_jenv_res == JNI_OK);
12108 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12109 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12110 jboolean no_connection_possible_conv = no_connection_possible;
12111 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12112 CHECK(obj != NULL);
12113 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
12114 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12115 (*env)->ExceptionDescribe(env);
12116 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
12118 if (get_jenv_res == JNI_EDETACHED) {
12119 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12122 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
12123 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12125 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12126 if (get_jenv_res == JNI_EDETACHED) {
12127 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12129 DO_ASSERT(get_jenv_res == JNI_OK);
12131 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12132 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12133 LDKInit msg_var = *msg;
12134 int64_t msg_ref = 0;
12135 msg_var = Init_clone(&msg_var);
12136 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12137 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12138 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12139 msg_ref = (uintptr_t)msg_var.inner;
12140 if (msg_var.is_owned) {
12143 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12144 CHECK(obj != NULL);
12145 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
12146 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12147 (*env)->ExceptionDescribe(env);
12148 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
12150 if (get_jenv_res == JNI_EDETACHED) {
12151 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12154 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12157 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12158 if (get_jenv_res == JNI_EDETACHED) {
12159 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12161 DO_ASSERT(get_jenv_res == JNI_OK);
12163 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12164 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12165 LDKChannelReestablish msg_var = *msg;
12166 int64_t msg_ref = 0;
12167 msg_var = ChannelReestablish_clone(&msg_var);
12168 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12169 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12170 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12171 msg_ref = (uintptr_t)msg_var.inner;
12172 if (msg_var.is_owned) {
12175 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12176 CHECK(obj != NULL);
12177 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
12178 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12179 (*env)->ExceptionDescribe(env);
12180 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
12182 if (get_jenv_res == JNI_EDETACHED) {
12183 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12186 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12189 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12190 if (get_jenv_res == JNI_EDETACHED) {
12191 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12193 DO_ASSERT(get_jenv_res == JNI_OK);
12195 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12196 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12197 LDKChannelUpdate msg_var = *msg;
12198 int64_t msg_ref = 0;
12199 msg_var = ChannelUpdate_clone(&msg_var);
12200 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12201 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12202 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12203 msg_ref = (uintptr_t)msg_var.inner;
12204 if (msg_var.is_owned) {
12207 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12208 CHECK(obj != NULL);
12209 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
12210 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12211 (*env)->ExceptionDescribe(env);
12212 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
12214 if (get_jenv_res == JNI_EDETACHED) {
12215 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12218 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12221 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12222 if (get_jenv_res == JNI_EDETACHED) {
12223 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12225 DO_ASSERT(get_jenv_res == JNI_OK);
12227 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12228 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12229 LDKErrorMessage msg_var = *msg;
12230 int64_t msg_ref = 0;
12231 msg_var = ErrorMessage_clone(&msg_var);
12232 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12233 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12234 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12235 msg_ref = (uintptr_t)msg_var.inner;
12236 if (msg_var.is_owned) {
12239 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12240 CHECK(obj != NULL);
12241 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
12242 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12243 (*env)->ExceptionDescribe(env);
12244 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
12246 if (get_jenv_res == JNI_EDETACHED) {
12247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12250 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12251 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12252 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12253 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12255 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12256 jclass c = (*env)->GetObjectClass(env, o);
12258 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12259 atomic_init(&calls->refcnt, 1);
12260 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12261 calls->o = (*env)->NewWeakGlobalRef(env, o);
12262 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
12263 CHECK(calls->handle_open_channel_meth != NULL);
12264 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
12265 CHECK(calls->handle_accept_channel_meth != NULL);
12266 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
12267 CHECK(calls->handle_funding_created_meth != NULL);
12268 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
12269 CHECK(calls->handle_funding_signed_meth != NULL);
12270 calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
12271 CHECK(calls->handle_channel_ready_meth != NULL);
12272 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
12273 CHECK(calls->handle_shutdown_meth != NULL);
12274 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
12275 CHECK(calls->handle_closing_signed_meth != NULL);
12276 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
12277 CHECK(calls->handle_update_add_htlc_meth != NULL);
12278 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
12279 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
12280 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
12281 CHECK(calls->handle_update_fail_htlc_meth != NULL);
12282 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
12283 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
12284 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
12285 CHECK(calls->handle_commitment_signed_meth != NULL);
12286 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
12287 CHECK(calls->handle_revoke_and_ack_meth != NULL);
12288 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
12289 CHECK(calls->handle_update_fee_meth != NULL);
12290 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
12291 CHECK(calls->handle_announcement_signatures_meth != NULL);
12292 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
12293 CHECK(calls->peer_disconnected_meth != NULL);
12294 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12295 CHECK(calls->peer_connected_meth != NULL);
12296 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
12297 CHECK(calls->handle_channel_reestablish_meth != NULL);
12298 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
12299 CHECK(calls->handle_channel_update_meth != NULL);
12300 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
12301 CHECK(calls->handle_error_meth != NULL);
12303 LDKChannelMessageHandler ret = {
12304 .this_arg = (void*) calls,
12305 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12306 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12307 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12308 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12309 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12310 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12311 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12312 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12313 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12314 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12315 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12316 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12317 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12318 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12319 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12320 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12321 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12322 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12323 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12324 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12325 .free = LDKChannelMessageHandler_JCalls_free,
12326 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12328 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12332 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12333 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12334 return (uint64_t)res_ptr;
12336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12337 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
12338 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12339 DO_ASSERT((res_ptr & 1) == 0);
12340 return (int64_t)(res_ptr | 1);
12342 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) {
12343 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12344 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12345 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12346 LDKPublicKey their_node_id_ref;
12347 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12348 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12349 LDKInitFeatures their_features_conv;
12350 their_features_conv.inner = (void*)(their_features & (~1));
12351 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12352 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12353 their_features_conv = InitFeatures_clone(&their_features_conv);
12354 LDKOpenChannel msg_conv;
12355 msg_conv.inner = (void*)(msg & (~1));
12356 msg_conv.is_owned = false;
12357 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12358 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12361 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) {
12362 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12363 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12364 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12365 LDKPublicKey their_node_id_ref;
12366 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12367 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12368 LDKInitFeatures their_features_conv;
12369 their_features_conv.inner = (void*)(their_features & (~1));
12370 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12371 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12372 their_features_conv = InitFeatures_clone(&their_features_conv);
12373 LDKAcceptChannel msg_conv;
12374 msg_conv.inner = (void*)(msg & (~1));
12375 msg_conv.is_owned = false;
12376 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12377 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12380 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) {
12381 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12382 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12383 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12384 LDKPublicKey their_node_id_ref;
12385 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12386 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12387 LDKFundingCreated msg_conv;
12388 msg_conv.inner = (void*)(msg & (~1));
12389 msg_conv.is_owned = false;
12390 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12391 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12394 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) {
12395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12397 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12398 LDKPublicKey their_node_id_ref;
12399 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12400 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12401 LDKFundingSigned msg_conv;
12402 msg_conv.inner = (void*)(msg & (~1));
12403 msg_conv.is_owned = false;
12404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12405 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12408 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) {
12409 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12410 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12411 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12412 LDKPublicKey their_node_id_ref;
12413 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12414 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12415 LDKChannelReady msg_conv;
12416 msg_conv.inner = (void*)(msg & (~1));
12417 msg_conv.is_owned = false;
12418 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12419 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12422 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) {
12423 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12424 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12425 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12426 LDKPublicKey their_node_id_ref;
12427 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12428 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12429 LDKInitFeatures their_features_conv;
12430 their_features_conv.inner = (void*)(their_features & (~1));
12431 their_features_conv.is_owned = false;
12432 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12433 LDKShutdown msg_conv;
12434 msg_conv.inner = (void*)(msg & (~1));
12435 msg_conv.is_owned = false;
12436 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12437 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
12440 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) {
12441 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12442 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12443 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12444 LDKPublicKey their_node_id_ref;
12445 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12446 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12447 LDKClosingSigned msg_conv;
12448 msg_conv.inner = (void*)(msg & (~1));
12449 msg_conv.is_owned = false;
12450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12451 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12454 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) {
12455 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12457 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12458 LDKPublicKey their_node_id_ref;
12459 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12460 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12461 LDKUpdateAddHTLC msg_conv;
12462 msg_conv.inner = (void*)(msg & (~1));
12463 msg_conv.is_owned = false;
12464 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12465 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12468 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) {
12469 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12470 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12471 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12472 LDKPublicKey their_node_id_ref;
12473 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12474 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12475 LDKUpdateFulfillHTLC msg_conv;
12476 msg_conv.inner = (void*)(msg & (~1));
12477 msg_conv.is_owned = false;
12478 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12479 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12482 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) {
12483 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12484 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12485 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12486 LDKPublicKey their_node_id_ref;
12487 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12488 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12489 LDKUpdateFailHTLC msg_conv;
12490 msg_conv.inner = (void*)(msg & (~1));
12491 msg_conv.is_owned = false;
12492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12493 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12496 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) {
12497 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12498 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12500 LDKPublicKey their_node_id_ref;
12501 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12502 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12503 LDKUpdateFailMalformedHTLC msg_conv;
12504 msg_conv.inner = (void*)(msg & (~1));
12505 msg_conv.is_owned = false;
12506 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12507 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12510 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) {
12511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12513 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12514 LDKPublicKey their_node_id_ref;
12515 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12516 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12517 LDKCommitmentSigned msg_conv;
12518 msg_conv.inner = (void*)(msg & (~1));
12519 msg_conv.is_owned = false;
12520 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12521 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12524 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) {
12525 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12526 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12528 LDKPublicKey their_node_id_ref;
12529 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12530 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12531 LDKRevokeAndACK msg_conv;
12532 msg_conv.inner = (void*)(msg & (~1));
12533 msg_conv.is_owned = false;
12534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12535 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12538 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) {
12539 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12542 LDKPublicKey their_node_id_ref;
12543 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12544 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12545 LDKUpdateFee msg_conv;
12546 msg_conv.inner = (void*)(msg & (~1));
12547 msg_conv.is_owned = false;
12548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12549 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12552 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) {
12553 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12554 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12555 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12556 LDKPublicKey their_node_id_ref;
12557 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12558 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12559 LDKAnnouncementSignatures msg_conv;
12560 msg_conv.inner = (void*)(msg & (~1));
12561 msg_conv.is_owned = false;
12562 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12563 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12566 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) {
12567 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12568 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12569 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12570 LDKPublicKey their_node_id_ref;
12571 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12572 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12573 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
12576 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) {
12577 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12578 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12579 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12580 LDKPublicKey their_node_id_ref;
12581 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12582 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12584 msg_conv.inner = (void*)(msg & (~1));
12585 msg_conv.is_owned = false;
12586 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12587 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12590 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) {
12591 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12592 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12593 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12594 LDKPublicKey their_node_id_ref;
12595 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12596 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12597 LDKChannelReestablish msg_conv;
12598 msg_conv.inner = (void*)(msg & (~1));
12599 msg_conv.is_owned = false;
12600 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12601 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12604 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) {
12605 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12606 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12607 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12608 LDKPublicKey their_node_id_ref;
12609 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12610 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12611 LDKChannelUpdate msg_conv;
12612 msg_conv.inner = (void*)(msg & (~1));
12613 msg_conv.is_owned = false;
12614 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12615 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12618 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) {
12619 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12621 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12622 LDKPublicKey their_node_id_ref;
12623 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12624 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12625 LDKErrorMessage msg_conv;
12626 msg_conv.inner = (void*)(msg & (~1));
12627 msg_conv.is_owned = false;
12628 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12629 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12632 typedef struct LDKRoutingMessageHandler_JCalls {
12633 atomic_size_t refcnt;
12636 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12637 jmethodID handle_node_announcement_meth;
12638 jmethodID handle_channel_announcement_meth;
12639 jmethodID handle_channel_update_meth;
12640 jmethodID get_next_channel_announcements_meth;
12641 jmethodID get_next_node_announcements_meth;
12642 jmethodID peer_connected_meth;
12643 jmethodID handle_reply_channel_range_meth;
12644 jmethodID handle_reply_short_channel_ids_end_meth;
12645 jmethodID handle_query_channel_range_meth;
12646 jmethodID handle_query_short_channel_ids_meth;
12647 } LDKRoutingMessageHandler_JCalls;
12648 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12649 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12650 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12652 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12653 if (get_jenv_res == JNI_EDETACHED) {
12654 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12656 DO_ASSERT(get_jenv_res == JNI_OK);
12658 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12659 if (get_jenv_res == JNI_EDETACHED) {
12660 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12665 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12666 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12668 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12669 if (get_jenv_res == JNI_EDETACHED) {
12670 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12672 DO_ASSERT(get_jenv_res == JNI_OK);
12674 LDKNodeAnnouncement msg_var = *msg;
12675 int64_t msg_ref = 0;
12676 msg_var = NodeAnnouncement_clone(&msg_var);
12677 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12678 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12679 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12680 msg_ref = (uintptr_t)msg_var.inner;
12681 if (msg_var.is_owned) {
12684 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12685 CHECK(obj != NULL);
12686 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
12687 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12688 (*env)->ExceptionDescribe(env);
12689 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12691 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12692 CHECK_ACCESS(ret_ptr);
12693 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12695 if (get_jenv_res == JNI_EDETACHED) {
12696 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12700 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12701 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12703 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12704 if (get_jenv_res == JNI_EDETACHED) {
12705 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12707 DO_ASSERT(get_jenv_res == JNI_OK);
12709 LDKChannelAnnouncement msg_var = *msg;
12710 int64_t msg_ref = 0;
12711 msg_var = ChannelAnnouncement_clone(&msg_var);
12712 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12713 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12714 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12715 msg_ref = (uintptr_t)msg_var.inner;
12716 if (msg_var.is_owned) {
12719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12720 CHECK(obj != NULL);
12721 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
12722 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12723 (*env)->ExceptionDescribe(env);
12724 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12726 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12727 CHECK_ACCESS(ret_ptr);
12728 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12730 if (get_jenv_res == JNI_EDETACHED) {
12731 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12735 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12736 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12738 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12739 if (get_jenv_res == JNI_EDETACHED) {
12740 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12742 DO_ASSERT(get_jenv_res == JNI_OK);
12744 LDKChannelUpdate msg_var = *msg;
12745 int64_t msg_ref = 0;
12746 msg_var = ChannelUpdate_clone(&msg_var);
12747 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12748 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12750 msg_ref = (uintptr_t)msg_var.inner;
12751 if (msg_var.is_owned) {
12754 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12755 CHECK(obj != NULL);
12756 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12757 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12758 (*env)->ExceptionDescribe(env);
12759 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12761 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12762 CHECK_ACCESS(ret_ptr);
12763 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12765 if (get_jenv_res == JNI_EDETACHED) {
12766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12770 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
12771 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12773 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12774 if (get_jenv_res == JNI_EDETACHED) {
12775 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12777 DO_ASSERT(get_jenv_res == JNI_OK);
12779 int64_t starting_point_conv = starting_point;
12780 int8_t batch_amount_conv = batch_amount;
12781 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12782 CHECK(obj != NULL);
12783 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
12784 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12785 (*env)->ExceptionDescribe(env);
12786 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12788 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
12789 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12790 if (ret_constr.datalen > 0)
12791 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12793 ret_constr.data = NULL;
12794 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12795 for (size_t h = 0; h < ret_constr.datalen; h++) {
12796 int64_t ret_conv_59 = ret_vals[h];
12797 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
12798 CHECK_ACCESS(ret_conv_59_ptr);
12799 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
12800 FREE((void*)ret_conv_59);
12801 ret_constr.data[h] = ret_conv_59_conv;
12803 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12804 if (get_jenv_res == JNI_EDETACHED) {
12805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12809 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12810 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12812 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12813 if (get_jenv_res == JNI_EDETACHED) {
12814 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12816 DO_ASSERT(get_jenv_res == JNI_OK);
12818 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12819 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12820 int8_t batch_amount_conv = batch_amount;
12821 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12822 CHECK(obj != NULL);
12823 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
12824 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12825 (*env)->ExceptionDescribe(env);
12826 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12828 LDKCVec_NodeAnnouncementZ ret_constr;
12829 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12830 if (ret_constr.datalen > 0)
12831 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12833 ret_constr.data = NULL;
12834 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12835 for (size_t s = 0; s < ret_constr.datalen; s++) {
12836 int64_t ret_conv_18 = ret_vals[s];
12837 LDKNodeAnnouncement ret_conv_18_conv;
12838 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
12839 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
12840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12841 ret_constr.data[s] = ret_conv_18_conv;
12843 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12844 if (get_jenv_res == JNI_EDETACHED) {
12845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12849 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12850 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12852 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12853 if (get_jenv_res == JNI_EDETACHED) {
12854 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12856 DO_ASSERT(get_jenv_res == JNI_OK);
12858 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12859 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12860 LDKInit init_var = *init;
12861 int64_t init_ref = 0;
12862 init_var = Init_clone(&init_var);
12863 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12864 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12865 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12866 init_ref = (uintptr_t)init_var.inner;
12867 if (init_var.is_owned) {
12870 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12871 CHECK(obj != NULL);
12872 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12873 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12874 (*env)->ExceptionDescribe(env);
12875 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12877 if (get_jenv_res == JNI_EDETACHED) {
12878 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12881 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12882 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12884 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12885 if (get_jenv_res == JNI_EDETACHED) {
12886 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12888 DO_ASSERT(get_jenv_res == JNI_OK);
12890 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12891 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12892 LDKReplyChannelRange msg_var = msg;
12893 int64_t msg_ref = 0;
12894 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12895 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12896 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12897 msg_ref = (uintptr_t)msg_var.inner;
12898 if (msg_var.is_owned) {
12901 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12902 CHECK(obj != NULL);
12903 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12904 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12905 (*env)->ExceptionDescribe(env);
12906 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12908 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12909 CHECK_ACCESS(ret_ptr);
12910 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12912 if (get_jenv_res == JNI_EDETACHED) {
12913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12917 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12918 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12921 if (get_jenv_res == JNI_EDETACHED) {
12922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12924 DO_ASSERT(get_jenv_res == JNI_OK);
12926 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12927 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12928 LDKReplyShortChannelIdsEnd msg_var = msg;
12929 int64_t msg_ref = 0;
12930 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12931 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12933 msg_ref = (uintptr_t)msg_var.inner;
12934 if (msg_var.is_owned) {
12937 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12938 CHECK(obj != NULL);
12939 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12940 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12941 (*env)->ExceptionDescribe(env);
12942 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12944 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12945 CHECK_ACCESS(ret_ptr);
12946 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12948 if (get_jenv_res == JNI_EDETACHED) {
12949 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12953 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12954 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12956 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12957 if (get_jenv_res == JNI_EDETACHED) {
12958 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12960 DO_ASSERT(get_jenv_res == JNI_OK);
12962 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12963 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12964 LDKQueryChannelRange msg_var = msg;
12965 int64_t msg_ref = 0;
12966 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12967 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12968 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12969 msg_ref = (uintptr_t)msg_var.inner;
12970 if (msg_var.is_owned) {
12973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12974 CHECK(obj != NULL);
12975 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12976 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12977 (*env)->ExceptionDescribe(env);
12978 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12980 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12981 CHECK_ACCESS(ret_ptr);
12982 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12984 if (get_jenv_res == JNI_EDETACHED) {
12985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12989 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12990 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12992 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12993 if (get_jenv_res == JNI_EDETACHED) {
12994 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12996 DO_ASSERT(get_jenv_res == JNI_OK);
12998 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12999 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13000 LDKQueryShortChannelIds msg_var = msg;
13001 int64_t msg_ref = 0;
13002 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13003 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13004 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13005 msg_ref = (uintptr_t)msg_var.inner;
13006 if (msg_var.is_owned) {
13009 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13010 CHECK(obj != NULL);
13011 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
13012 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13013 (*env)->ExceptionDescribe(env);
13014 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
13016 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13017 CHECK_ACCESS(ret_ptr);
13018 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13020 if (get_jenv_res == JNI_EDETACHED) {
13021 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13025 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13026 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13027 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13028 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13030 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13031 jclass c = (*env)->GetObjectClass(env, o);
13033 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13034 atomic_init(&calls->refcnt, 1);
13035 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13036 calls->o = (*env)->NewWeakGlobalRef(env, o);
13037 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
13038 CHECK(calls->handle_node_announcement_meth != NULL);
13039 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
13040 CHECK(calls->handle_channel_announcement_meth != NULL);
13041 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
13042 CHECK(calls->handle_channel_update_meth != NULL);
13043 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
13044 CHECK(calls->get_next_channel_announcements_meth != NULL);
13045 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
13046 CHECK(calls->get_next_node_announcements_meth != NULL);
13047 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
13048 CHECK(calls->peer_connected_meth != NULL);
13049 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
13050 CHECK(calls->handle_reply_channel_range_meth != NULL);
13051 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
13052 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
13053 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
13054 CHECK(calls->handle_query_channel_range_meth != NULL);
13055 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
13056 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
13058 LDKRoutingMessageHandler ret = {
13059 .this_arg = (void*) calls,
13060 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13061 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13062 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13063 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
13064 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
13065 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13066 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13067 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13068 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13069 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13070 .free = LDKRoutingMessageHandler_JCalls_free,
13071 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
13073 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13077 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13078 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
13079 return (uint64_t)res_ptr;
13081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
13082 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
13083 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
13084 DO_ASSERT((res_ptr & 1) == 0);
13085 return (int64_t)(res_ptr | 1);
13087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13088 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13089 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13090 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13091 LDKNodeAnnouncement msg_conv;
13092 msg_conv.inner = (void*)(msg & (~1));
13093 msg_conv.is_owned = false;
13094 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13095 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13096 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13097 return (int64_t)ret_conv;
13100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13101 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13102 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13103 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13104 LDKChannelAnnouncement msg_conv;
13105 msg_conv.inner = (void*)(msg & (~1));
13106 msg_conv.is_owned = false;
13107 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13108 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13109 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13110 return (int64_t)ret_conv;
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13114 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13115 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13116 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13117 LDKChannelUpdate msg_conv;
13118 msg_conv.inner = (void*)(msg & (~1));
13119 msg_conv.is_owned = false;
13120 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13121 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13122 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13123 return (int64_t)ret_conv;
13126 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) {
13127 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13128 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13129 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13130 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
13131 int64_tArray ret_arr = NULL;
13132 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13133 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13134 for (size_t h = 0; h < ret_var.datalen; h++) {
13135 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13136 *ret_conv_59_conv = ret_var.data[h];
13137 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
13139 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13140 FREE(ret_var.data);
13144 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) {
13145 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13146 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13147 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13148 LDKPublicKey starting_point_ref;
13149 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
13150 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
13151 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
13152 int64_tArray ret_arr = NULL;
13153 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13154 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13155 for (size_t s = 0; s < ret_var.datalen; s++) {
13156 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
13157 int64_t ret_conv_18_ref = 0;
13158 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13159 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
13161 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
13162 if (ret_conv_18_var.is_owned) {
13163 ret_conv_18_ref |= 1;
13165 ret_arr_ptr[s] = ret_conv_18_ref;
13167 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13168 FREE(ret_var.data);
13172 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) {
13173 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13174 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13175 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13176 LDKPublicKey their_node_id_ref;
13177 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13178 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13180 init_conv.inner = (void*)(init & (~1));
13181 init_conv.is_owned = false;
13182 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13183 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13186 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) {
13187 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13188 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13189 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13190 LDKPublicKey their_node_id_ref;
13191 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13192 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13193 LDKReplyChannelRange msg_conv;
13194 msg_conv.inner = (void*)(msg & (~1));
13195 msg_conv.is_owned = (msg & 1) || (msg == 0);
13196 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13197 msg_conv = ReplyChannelRange_clone(&msg_conv);
13198 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13199 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13200 return (int64_t)ret_conv;
13203 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) {
13204 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13205 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13206 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13207 LDKPublicKey their_node_id_ref;
13208 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13209 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13210 LDKReplyShortChannelIdsEnd msg_conv;
13211 msg_conv.inner = (void*)(msg & (~1));
13212 msg_conv.is_owned = (msg & 1) || (msg == 0);
13213 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13214 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13215 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13216 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13217 return (int64_t)ret_conv;
13220 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) {
13221 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13222 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13223 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13224 LDKPublicKey their_node_id_ref;
13225 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13226 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13227 LDKQueryChannelRange msg_conv;
13228 msg_conv.inner = (void*)(msg & (~1));
13229 msg_conv.is_owned = (msg & 1) || (msg == 0);
13230 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13231 msg_conv = QueryChannelRange_clone(&msg_conv);
13232 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13233 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13234 return (int64_t)ret_conv;
13237 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) {
13238 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13239 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13240 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13241 LDKPublicKey their_node_id_ref;
13242 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13243 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13244 LDKQueryShortChannelIds msg_conv;
13245 msg_conv.inner = (void*)(msg & (~1));
13246 msg_conv.is_owned = (msg & 1) || (msg == 0);
13247 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13248 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13249 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13250 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13251 return (int64_t)ret_conv;
13254 typedef struct LDKCustomMessageReader_JCalls {
13255 atomic_size_t refcnt;
13258 jmethodID read_meth;
13259 } LDKCustomMessageReader_JCalls;
13260 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13261 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13262 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13264 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13265 if (get_jenv_res == JNI_EDETACHED) {
13266 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13268 DO_ASSERT(get_jenv_res == JNI_OK);
13270 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13271 if (get_jenv_res == JNI_EDETACHED) {
13272 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13277 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13278 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13280 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13281 if (get_jenv_res == JNI_EDETACHED) {
13282 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13284 DO_ASSERT(get_jenv_res == JNI_OK);
13286 int16_t message_type_conv = message_type;
13287 LDKu8slice buffer_var = buffer;
13288 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
13289 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
13290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13291 CHECK(obj != NULL);
13292 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
13293 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13294 (*env)->ExceptionDescribe(env);
13295 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
13297 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13298 CHECK_ACCESS(ret_ptr);
13299 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13301 if (get_jenv_res == JNI_EDETACHED) {
13302 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13306 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13307 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13308 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13310 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
13311 jclass c = (*env)->GetObjectClass(env, o);
13313 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13314 atomic_init(&calls->refcnt, 1);
13315 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13316 calls->o = (*env)->NewWeakGlobalRef(env, o);
13317 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
13318 CHECK(calls->read_meth != NULL);
13320 LDKCustomMessageReader ret = {
13321 .this_arg = (void*) calls,
13322 .read = read_LDKCustomMessageReader_jcall,
13323 .free = LDKCustomMessageReader_JCalls_free,
13327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
13328 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13329 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
13330 return (uint64_t)res_ptr;
13332 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) {
13333 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13334 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13335 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13336 LDKu8slice buffer_ref;
13337 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
13338 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
13339 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13340 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13341 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
13342 return (int64_t)ret_conv;
13345 typedef struct LDKCustomMessageHandler_JCalls {
13346 atomic_size_t refcnt;
13349 LDKCustomMessageReader_JCalls* CustomMessageReader;
13350 jmethodID handle_custom_message_meth;
13351 jmethodID get_and_clear_pending_msg_meth;
13352 } LDKCustomMessageHandler_JCalls;
13353 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13354 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13355 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13357 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13358 if (get_jenv_res == JNI_EDETACHED) {
13359 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13361 DO_ASSERT(get_jenv_res == JNI_OK);
13363 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13364 if (get_jenv_res == JNI_EDETACHED) {
13365 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13370 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13371 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13373 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13374 if (get_jenv_res == JNI_EDETACHED) {
13375 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13377 DO_ASSERT(get_jenv_res == JNI_OK);
13379 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13381 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
13382 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
13383 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13384 CHECK(obj != NULL);
13385 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
13386 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13387 (*env)->ExceptionDescribe(env);
13388 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
13390 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13391 CHECK_ACCESS(ret_ptr);
13392 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13394 if (get_jenv_res == JNI_EDETACHED) {
13395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13399 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13400 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13402 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13403 if (get_jenv_res == JNI_EDETACHED) {
13404 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13406 DO_ASSERT(get_jenv_res == JNI_OK);
13408 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13409 CHECK(obj != NULL);
13410 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
13411 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13412 (*env)->ExceptionDescribe(env);
13413 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
13415 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13416 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13417 if (ret_constr.datalen > 0)
13418 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13420 ret_constr.data = NULL;
13421 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13422 for (size_t z = 0; z < ret_constr.datalen; z++) {
13423 int64_t ret_conv_25 = ret_vals[z];
13424 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
13425 CHECK_ACCESS(ret_conv_25_ptr);
13426 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13427 FREE((void*)ret_conv_25);
13428 ret_constr.data[z] = ret_conv_25_conv;
13430 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13431 if (get_jenv_res == JNI_EDETACHED) {
13432 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13436 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13437 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13438 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13439 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13441 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13442 jclass c = (*env)->GetObjectClass(env, o);
13444 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13445 atomic_init(&calls->refcnt, 1);
13446 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13447 calls->o = (*env)->NewWeakGlobalRef(env, o);
13448 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
13449 CHECK(calls->handle_custom_message_meth != NULL);
13450 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
13451 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
13453 LDKCustomMessageHandler ret = {
13454 .this_arg = (void*) calls,
13455 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13456 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13457 .free = LDKCustomMessageHandler_JCalls_free,
13458 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
13460 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13464 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13465 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
13466 return (uint64_t)res_ptr;
13468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
13469 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
13470 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
13471 DO_ASSERT((res_ptr & 1) == 0);
13472 return (int64_t)(res_ptr | 1);
13474 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) {
13475 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13476 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13477 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13478 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
13479 CHECK_ACCESS(msg_ptr);
13480 LDKType msg_conv = *(LDKType*)(msg_ptr);
13481 if (msg_conv.free == LDKType_JCalls_free) {
13482 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13483 LDKType_JCalls_cloned(&msg_conv);
13485 LDKPublicKey sender_node_id_ref;
13486 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
13487 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
13488 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13489 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13490 return (int64_t)ret_conv;
13493 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
13494 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13495 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13496 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13497 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13498 int64_tArray ret_arr = NULL;
13499 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13500 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13501 for (size_t z = 0; z < ret_var.datalen; z++) {
13502 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13503 *ret_conv_25_conv = ret_var.data[z];
13504 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
13506 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13507 FREE(ret_var.data);
13511 typedef struct LDKSocketDescriptor_JCalls {
13512 atomic_size_t refcnt;
13515 jmethodID send_data_meth;
13516 jmethodID disconnect_socket_meth;
13518 jmethodID hash_meth;
13519 } LDKSocketDescriptor_JCalls;
13520 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13521 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13522 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13524 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13525 if (get_jenv_res == JNI_EDETACHED) {
13526 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13528 DO_ASSERT(get_jenv_res == JNI_OK);
13530 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13531 if (get_jenv_res == JNI_EDETACHED) {
13532 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13537 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13538 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13540 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13541 if (get_jenv_res == JNI_EDETACHED) {
13542 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13544 DO_ASSERT(get_jenv_res == JNI_OK);
13546 LDKu8slice data_var = data;
13547 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
13548 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
13549 jboolean resume_read_conv = resume_read;
13550 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13551 CHECK(obj != NULL);
13552 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
13553 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13554 (*env)->ExceptionDescribe(env);
13555 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
13557 if (get_jenv_res == JNI_EDETACHED) {
13558 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13562 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13563 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13565 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13566 if (get_jenv_res == JNI_EDETACHED) {
13567 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13569 DO_ASSERT(get_jenv_res == JNI_OK);
13571 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13572 CHECK(obj != NULL);
13573 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
13574 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13575 (*env)->ExceptionDescribe(env);
13576 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
13578 if (get_jenv_res == JNI_EDETACHED) {
13579 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13582 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13583 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13585 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13586 if (get_jenv_res == JNI_EDETACHED) {
13587 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13589 DO_ASSERT(get_jenv_res == JNI_OK);
13591 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13592 *other_arg_clone = SocketDescriptor_clone(other_arg);
13593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13594 CHECK(obj != NULL);
13595 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
13596 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13597 (*env)->ExceptionDescribe(env);
13598 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
13600 if (get_jenv_res == JNI_EDETACHED) {
13601 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13605 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13606 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13608 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13609 if (get_jenv_res == JNI_EDETACHED) {
13610 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13612 DO_ASSERT(get_jenv_res == JNI_OK);
13614 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13615 CHECK(obj != NULL);
13616 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
13617 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13618 (*env)->ExceptionDescribe(env);
13619 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
13621 if (get_jenv_res == JNI_EDETACHED) {
13622 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13626 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13627 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13628 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13630 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
13631 jclass c = (*env)->GetObjectClass(env, o);
13633 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13634 atomic_init(&calls->refcnt, 1);
13635 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13636 calls->o = (*env)->NewWeakGlobalRef(env, o);
13637 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
13638 CHECK(calls->send_data_meth != NULL);
13639 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
13640 CHECK(calls->disconnect_socket_meth != NULL);
13641 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
13642 CHECK(calls->eq_meth != NULL);
13643 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
13644 CHECK(calls->hash_meth != NULL);
13646 LDKSocketDescriptor ret = {
13647 .this_arg = (void*) calls,
13648 .send_data = send_data_LDKSocketDescriptor_jcall,
13649 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13650 .eq = eq_LDKSocketDescriptor_jcall,
13651 .hash = hash_LDKSocketDescriptor_jcall,
13652 .cloned = LDKSocketDescriptor_JCalls_cloned,
13653 .free = LDKSocketDescriptor_JCalls_free,
13657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
13658 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13659 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
13660 return (uint64_t)res_ptr;
13662 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) {
13663 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13664 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13665 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13666 LDKu8slice data_ref;
13667 data_ref.datalen = (*env)->GetArrayLength(env, data);
13668 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
13669 int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
13670 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
13674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
13675 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13676 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13677 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13678 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
13681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
13682 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13683 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13684 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13685 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
13689 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
13690 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
13691 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
13692 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
13693 static jclass LDKEffectiveCapacity_Total_class = NULL;
13694 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
13695 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
13696 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
13697 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
13698 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
13699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
13700 LDKEffectiveCapacity_ExactLiquidity_class =
13701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
13702 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
13703 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
13704 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
13705 LDKEffectiveCapacity_MaximumHTLC_class =
13706 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
13707 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
13708 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
13709 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
13710 LDKEffectiveCapacity_Total_class =
13711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
13712 CHECK(LDKEffectiveCapacity_Total_class != NULL);
13713 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
13714 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
13715 LDKEffectiveCapacity_Infinite_class =
13716 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
13717 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
13718 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
13719 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
13720 LDKEffectiveCapacity_Unknown_class =
13721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
13722 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
13723 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
13724 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
13726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13727 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
13729 case LDKEffectiveCapacity_ExactLiquidity: {
13730 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
13731 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
13733 case LDKEffectiveCapacity_MaximumHTLC: {
13734 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
13735 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
13737 case LDKEffectiveCapacity_Total: {
13738 int64_t capacity_msat_conv = obj->total.capacity_msat;
13739 int64_t htlc_maximum_msat_ref = ((uintptr_t)&obj->total.htlc_maximum_msat) | 1;
13740 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
13742 case LDKEffectiveCapacity_Infinite: {
13743 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
13745 case LDKEffectiveCapacity_Unknown: {
13746 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
13751 typedef struct LDKLockableScore_JCalls {
13752 atomic_size_t refcnt;
13755 jmethodID lock_meth;
13756 } LDKLockableScore_JCalls;
13757 static void LDKLockableScore_JCalls_free(void* this_arg) {
13758 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13759 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13762 if (get_jenv_res == JNI_EDETACHED) {
13763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13765 DO_ASSERT(get_jenv_res == JNI_OK);
13767 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13768 if (get_jenv_res == JNI_EDETACHED) {
13769 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13774 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13775 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13777 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13778 if (get_jenv_res == JNI_EDETACHED) {
13779 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13781 DO_ASSERT(get_jenv_res == JNI_OK);
13783 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13784 CHECK(obj != NULL);
13785 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13786 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13787 (*env)->ExceptionDescribe(env);
13788 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13790 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13791 CHECK_ACCESS(ret_ptr);
13792 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13793 if (ret_conv.free == LDKScore_JCalls_free) {
13794 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13795 LDKScore_JCalls_cloned(&ret_conv);
13796 }// WARNING: we may need a move here but no clone is available for LDKScore
13798 if (get_jenv_res == JNI_EDETACHED) {
13799 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13803 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13804 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13805 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13807 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13808 jclass c = (*env)->GetObjectClass(env, o);
13810 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13811 atomic_init(&calls->refcnt, 1);
13812 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13813 calls->o = (*env)->NewWeakGlobalRef(env, o);
13814 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13815 CHECK(calls->lock_meth != NULL);
13817 LDKLockableScore ret = {
13818 .this_arg = (void*) calls,
13819 .lock = lock_LDKLockableScore_jcall,
13820 .free = LDKLockableScore_JCalls_free,
13824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13825 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13826 *res_ptr = LDKLockableScore_init(env, clz, o);
13827 return (uint64_t)res_ptr;
13829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13830 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13831 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13832 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13833 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13834 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13835 return (int64_t)ret_ret;
13838 static jclass LDKGossipSync_P2P_class = NULL;
13839 static jmethodID LDKGossipSync_P2P_meth = NULL;
13840 static jclass LDKGossipSync_Rapid_class = NULL;
13841 static jmethodID LDKGossipSync_Rapid_meth = NULL;
13842 static jclass LDKGossipSync_None_class = NULL;
13843 static jmethodID LDKGossipSync_None_meth = NULL;
13844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
13845 LDKGossipSync_P2P_class =
13846 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
13847 CHECK(LDKGossipSync_P2P_class != NULL);
13848 LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
13849 CHECK(LDKGossipSync_P2P_meth != NULL);
13850 LDKGossipSync_Rapid_class =
13851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
13852 CHECK(LDKGossipSync_Rapid_class != NULL);
13853 LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
13854 CHECK(LDKGossipSync_Rapid_meth != NULL);
13855 LDKGossipSync_None_class =
13856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
13857 CHECK(LDKGossipSync_None_class != NULL);
13858 LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
13859 CHECK(LDKGossipSync_None_meth != NULL);
13861 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13862 LDKGossipSync *obj = (LDKGossipSync*)(ptr & ~1);
13864 case LDKGossipSync_P2P: {
13865 LDKP2PGossipSync p2p_var = obj->p2p;
13866 int64_t p2p_ref = 0;
13867 CHECK((((uintptr_t)p2p_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13868 CHECK((((uintptr_t)&p2p_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13869 CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
13870 p2p_ref = (uintptr_t)p2p_var.inner & ~1;
13871 return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
13873 case LDKGossipSync_Rapid: {
13874 LDKRapidGossipSync rapid_var = obj->rapid;
13875 int64_t rapid_ref = 0;
13876 CHECK((((uintptr_t)rapid_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13877 CHECK((((uintptr_t)&rapid_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13878 CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
13879 rapid_ref = (uintptr_t)rapid_var.inner & ~1;
13880 return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
13882 case LDKGossipSync_None: {
13883 return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
13888 static jclass LDKFallback_SegWitProgram_class = NULL;
13889 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13890 static jclass LDKFallback_PubKeyHash_class = NULL;
13891 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13892 static jclass LDKFallback_ScriptHash_class = NULL;
13893 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13895 LDKFallback_SegWitProgram_class =
13896 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13897 CHECK(LDKFallback_SegWitProgram_class != NULL);
13898 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13899 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13900 LDKFallback_PubKeyHash_class =
13901 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13902 CHECK(LDKFallback_PubKeyHash_class != NULL);
13903 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13904 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13905 LDKFallback_ScriptHash_class =
13906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13907 CHECK(LDKFallback_ScriptHash_class != NULL);
13908 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13909 CHECK(LDKFallback_ScriptHash_meth != NULL);
13911 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13912 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13914 case LDKFallback_SegWitProgram: {
13915 uint8_t version_val = obj->seg_wit_program.version._0;
13916 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13917 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13918 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13919 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13921 case LDKFallback_PubKeyHash: {
13922 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13923 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13924 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13926 case LDKFallback_ScriptHash: {
13927 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13928 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13929 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13934 typedef struct LDKPayer_JCalls {
13935 atomic_size_t refcnt;
13938 jmethodID node_id_meth;
13939 jmethodID first_hops_meth;
13940 jmethodID send_payment_meth;
13941 jmethodID send_spontaneous_payment_meth;
13942 jmethodID retry_payment_meth;
13943 jmethodID abandon_payment_meth;
13945 static void LDKPayer_JCalls_free(void* this_arg) {
13946 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13947 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13950 if (get_jenv_res == JNI_EDETACHED) {
13951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13953 DO_ASSERT(get_jenv_res == JNI_OK);
13955 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13956 if (get_jenv_res == JNI_EDETACHED) {
13957 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13962 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13963 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13965 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13966 if (get_jenv_res == JNI_EDETACHED) {
13967 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13969 DO_ASSERT(get_jenv_res == JNI_OK);
13971 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13972 CHECK(obj != NULL);
13973 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13974 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13975 (*env)->ExceptionDescribe(env);
13976 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13978 LDKPublicKey ret_ref;
13979 CHECK((*env)->GetArrayLength(env, ret) == 33);
13980 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13981 if (get_jenv_res == JNI_EDETACHED) {
13982 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13986 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13987 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13989 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13990 if (get_jenv_res == JNI_EDETACHED) {
13991 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13993 DO_ASSERT(get_jenv_res == JNI_OK);
13995 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13996 CHECK(obj != NULL);
13997 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13998 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13999 (*env)->ExceptionDescribe(env);
14000 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
14002 LDKCVec_ChannelDetailsZ ret_constr;
14003 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14004 if (ret_constr.datalen > 0)
14005 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14007 ret_constr.data = NULL;
14008 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14009 for (size_t q = 0; q < ret_constr.datalen; q++) {
14010 int64_t ret_conv_16 = ret_vals[q];
14011 LDKChannelDetails ret_conv_16_conv;
14012 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
14013 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
14014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
14015 ret_constr.data[q] = ret_conv_16_conv;
14017 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14018 if (get_jenv_res == JNI_EDETACHED) {
14019 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14023 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
14024 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14026 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14027 if (get_jenv_res == JNI_EDETACHED) {
14028 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14030 DO_ASSERT(get_jenv_res == JNI_OK);
14032 LDKRoute route_var = *route;
14033 int64_t route_ref = 0;
14034 route_var = Route_clone(&route_var);
14035 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14036 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14037 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14038 route_ref = (uintptr_t)route_var.inner;
14039 if (route_var.is_owned) {
14042 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14043 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
14044 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14045 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
14046 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14047 CHECK(obj != NULL);
14048 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
14049 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14050 (*env)->ExceptionDescribe(env);
14051 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
14053 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14054 CHECK_ACCESS(ret_ptr);
14055 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14057 if (get_jenv_res == JNI_EDETACHED) {
14058 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14062 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
14063 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14065 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14066 if (get_jenv_res == JNI_EDETACHED) {
14067 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14069 DO_ASSERT(get_jenv_res == JNI_OK);
14071 LDKRoute route_var = *route;
14072 int64_t route_ref = 0;
14073 route_var = Route_clone(&route_var);
14074 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14075 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14076 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14077 route_ref = (uintptr_t)route_var.inner;
14078 if (route_var.is_owned) {
14081 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14082 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
14083 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14084 CHECK(obj != NULL);
14085 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
14086 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14087 (*env)->ExceptionDescribe(env);
14088 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
14090 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14091 CHECK_ACCESS(ret_ptr);
14092 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14094 if (get_jenv_res == JNI_EDETACHED) {
14095 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14099 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
14100 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14102 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14103 if (get_jenv_res == JNI_EDETACHED) {
14104 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14106 DO_ASSERT(get_jenv_res == JNI_OK);
14108 LDKRoute route_var = *route;
14109 int64_t route_ref = 0;
14110 route_var = Route_clone(&route_var);
14111 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14112 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14113 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14114 route_ref = (uintptr_t)route_var.inner;
14115 if (route_var.is_owned) {
14118 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14119 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14120 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14121 CHECK(obj != NULL);
14122 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
14123 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14124 (*env)->ExceptionDescribe(env);
14125 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
14127 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14128 CHECK_ACCESS(ret_ptr);
14129 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
14131 if (get_jenv_res == JNI_EDETACHED) {
14132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14136 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
14137 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14139 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14140 if (get_jenv_res == JNI_EDETACHED) {
14141 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14143 DO_ASSERT(get_jenv_res == JNI_OK);
14145 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14146 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14147 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14148 CHECK(obj != NULL);
14149 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
14150 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14151 (*env)->ExceptionDescribe(env);
14152 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
14154 if (get_jenv_res == JNI_EDETACHED) {
14155 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14158 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
14159 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
14160 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14162 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
14163 jclass c = (*env)->GetObjectClass(env, o);
14165 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
14166 atomic_init(&calls->refcnt, 1);
14167 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14168 calls->o = (*env)->NewWeakGlobalRef(env, o);
14169 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
14170 CHECK(calls->node_id_meth != NULL);
14171 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
14172 CHECK(calls->first_hops_meth != NULL);
14173 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
14174 CHECK(calls->send_payment_meth != NULL);
14175 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
14176 CHECK(calls->send_spontaneous_payment_meth != NULL);
14177 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
14178 CHECK(calls->retry_payment_meth != NULL);
14179 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
14180 CHECK(calls->abandon_payment_meth != NULL);
14183 .this_arg = (void*) calls,
14184 .node_id = node_id_LDKPayer_jcall,
14185 .first_hops = first_hops_LDKPayer_jcall,
14186 .send_payment = send_payment_LDKPayer_jcall,
14187 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
14188 .retry_payment = retry_payment_LDKPayer_jcall,
14189 .abandon_payment = abandon_payment_LDKPayer_jcall,
14190 .free = LDKPayer_JCalls_free,
14194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
14195 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
14196 *res_ptr = LDKPayer_init(env, clz, o);
14197 return (uint64_t)res_ptr;
14199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14200 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14201 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14202 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14203 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
14208 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
14209 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14210 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14211 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14212 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
14213 int64_tArray ret_arr = NULL;
14214 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14215 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14216 for (size_t q = 0; q < ret_var.datalen; q++) {
14217 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14218 int64_t ret_conv_16_ref = 0;
14219 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14220 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
14222 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
14223 if (ret_conv_16_var.is_owned) {
14224 ret_conv_16_ref |= 1;
14226 ret_arr_ptr[q] = ret_conv_16_ref;
14228 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14229 FREE(ret_var.data);
14233 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) {
14234 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14235 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14236 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14237 LDKRoute route_conv;
14238 route_conv.inner = (void*)(route & (~1));
14239 route_conv.is_owned = false;
14240 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14241 LDKThirtyTwoBytes payment_hash_ref;
14242 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14243 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14244 LDKThirtyTwoBytes payment_secret_ref;
14245 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14246 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14247 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14248 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
14249 return (int64_t)ret_conv;
14252 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) {
14253 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14254 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14255 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14256 LDKRoute route_conv;
14257 route_conv.inner = (void*)(route & (~1));
14258 route_conv.is_owned = false;
14259 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14260 LDKThirtyTwoBytes payment_preimage_ref;
14261 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14262 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14263 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14264 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
14265 return (int64_t)ret_conv;
14268 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) {
14269 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14270 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14271 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14272 LDKRoute route_conv;
14273 route_conv.inner = (void*)(route & (~1));
14274 route_conv.is_owned = false;
14275 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14276 LDKThirtyTwoBytes payment_id_ref;
14277 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14278 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14279 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14280 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
14281 return (int64_t)ret_conv;
14284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
14285 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14286 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14287 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14288 LDKThirtyTwoBytes payment_id_ref;
14289 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14290 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14291 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
14294 typedef struct LDKRouter_JCalls {
14295 atomic_size_t refcnt;
14298 jmethodID find_route_meth;
14299 } LDKRouter_JCalls;
14300 static void LDKRouter_JCalls_free(void* this_arg) {
14301 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14302 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14304 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14305 if (get_jenv_res == JNI_EDETACHED) {
14306 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14308 DO_ASSERT(get_jenv_res == JNI_OK);
14310 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14311 if (get_jenv_res == JNI_EDETACHED) {
14312 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14317 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) {
14318 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14320 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14321 if (get_jenv_res == JNI_EDETACHED) {
14322 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14324 DO_ASSERT(get_jenv_res == JNI_OK);
14326 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
14327 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
14328 LDKRouteParameters route_params_var = *route_params;
14329 int64_t route_params_ref = 0;
14330 route_params_var = RouteParameters_clone(&route_params_var);
14331 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14332 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14333 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
14334 route_params_ref = (uintptr_t)route_params_var.inner;
14335 if (route_params_var.is_owned) {
14336 route_params_ref |= 1;
14338 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14339 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
14340 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
14341 int64_tArray first_hops_arr = NULL;
14342 if (first_hops != NULL) {
14343 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
14344 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
14345 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
14346 for (size_t q = 0; q < first_hops_var.datalen; q++) {
14347 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
14348 int64_t first_hops_conv_16_ref = 0;
14349 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14350 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14351 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
14352 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
14353 if (first_hops_conv_16_var.is_owned) {
14354 first_hops_conv_16_ref |= 1;
14356 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
14358 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
14360 // WARNING: This object doesn't live past this scope, needs clone!
14361 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
14362 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14363 CHECK(obj != NULL);
14364 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);
14365 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14366 (*env)->ExceptionDescribe(env);
14367 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
14369 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14370 CHECK_ACCESS(ret_ptr);
14371 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
14373 if (get_jenv_res == JNI_EDETACHED) {
14374 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14378 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14379 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14380 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14382 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14383 jclass c = (*env)->GetObjectClass(env, o);
14385 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14386 atomic_init(&calls->refcnt, 1);
14387 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14388 calls->o = (*env)->NewWeakGlobalRef(env, o);
14389 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14390 CHECK(calls->find_route_meth != NULL);
14393 .this_arg = (void*) calls,
14394 .find_route = find_route_LDKRouter_jcall,
14395 .free = LDKRouter_JCalls_free,
14399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14400 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14401 *res_ptr = LDKRouter_init(env, clz, o);
14402 return (uint64_t)res_ptr;
14404 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) {
14405 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14406 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14407 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14408 LDKPublicKey payer_ref;
14409 CHECK((*env)->GetArrayLength(env, payer) == 33);
14410 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14411 LDKRouteParameters route_params_conv;
14412 route_params_conv.inner = (void*)(route_params & (~1));
14413 route_params_conv.is_owned = false;
14414 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14415 unsigned char payment_hash_arr[32];
14416 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14417 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14418 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14419 LDKCVec_ChannelDetailsZ first_hops_constr;
14420 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14421 if (first_hops != NULL) {
14422 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14423 if (first_hops_constr.datalen > 0)
14424 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14426 first_hops_constr.data = NULL;
14427 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14428 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14429 int64_t first_hops_conv_16 = first_hops_vals[q];
14430 LDKChannelDetails first_hops_conv_16_conv;
14431 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
14432 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
14433 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14434 first_hops_constr.data[q] = first_hops_conv_16_conv;
14436 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14437 first_hops_ptr = &first_hops_constr;
14439 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14440 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14441 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14442 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14443 *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);
14444 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14445 return (int64_t)ret_conv;
14448 static jclass LDKRetry_Attempts_class = NULL;
14449 static jmethodID LDKRetry_Attempts_meth = NULL;
14450 static jclass LDKRetry_Timeout_class = NULL;
14451 static jmethodID LDKRetry_Timeout_meth = NULL;
14452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14453 LDKRetry_Attempts_class =
14454 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14455 CHECK(LDKRetry_Attempts_class != NULL);
14456 LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14457 CHECK(LDKRetry_Attempts_meth != NULL);
14458 LDKRetry_Timeout_class =
14459 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14460 CHECK(LDKRetry_Timeout_class != NULL);
14461 LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14462 CHECK(LDKRetry_Timeout_meth != NULL);
14464 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14465 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
14467 case LDKRetry_Attempts: {
14468 int64_t attempts_conv = obj->attempts;
14469 return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14471 case LDKRetry_Timeout: {
14472 int64_t timeout_conv = obj->timeout;
14473 return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14478 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14479 LDKStr ret_str = _ldk_get_compiled_version();
14480 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14485 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14486 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14487 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14492 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14493 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14494 *ret_copy = Bech32Error_clone(arg);
14495 int64_t ret_ref = (uintptr_t)ret_copy;
14498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14499 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14500 int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14505 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14506 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14507 *ret_copy = Bech32Error_clone(orig_conv);
14508 int64_t ret_ref = (uintptr_t)ret_copy;
14512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14513 if ((o & 1) != 0) return;
14514 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14515 CHECK_ACCESS(o_ptr);
14516 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14518 Bech32Error_free(o_conv);
14521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14522 LDKTransaction _res_ref;
14523 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14524 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14525 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14526 _res_ref.data_is_owned = true;
14527 Transaction_free(_res_ref);
14530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14531 LDKCVec_u8Z script_pubkey_ref;
14532 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14533 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14534 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14535 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14536 *ret_ref = TxOut_new(script_pubkey_ref, value);
14537 return (int64_t)ret_ref;
14540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14541 if ((_res & 1) != 0) return;
14542 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14543 CHECK_ACCESS(_res_ptr);
14544 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14546 TxOut_free(_res_conv);
14549 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14550 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14551 *ret_ref = TxOut_clone(arg);
14552 return (int64_t)ret_ref;
14554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14555 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14556 int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14561 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14562 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14563 *ret_ref = TxOut_clone(orig_conv);
14564 return (int64_t)ret_ref;
14567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14568 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14573 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14574 *ret_conv = CResult_NoneNoneZ_ok();
14575 return (int64_t)ret_conv;
14578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14579 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14580 *ret_conv = CResult_NoneNoneZ_err();
14581 return (int64_t)ret_conv;
14584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14585 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14586 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14591 if ((_res & 1) != 0) return;
14592 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14593 CHECK_ACCESS(_res_ptr);
14594 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14596 CResult_NoneNoneZ_free(_res_conv);
14599 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14600 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14601 *ret_conv = CResult_NoneNoneZ_clone(arg);
14602 return (int64_t)ret_conv;
14604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14605 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14606 int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14611 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14612 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14613 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14614 return (int64_t)ret_conv;
14617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14618 LDKCounterpartyCommitmentSecrets o_conv;
14619 o_conv.inner = (void*)(o & (~1));
14620 o_conv.is_owned = (o & 1) || (o == 0);
14621 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14622 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14623 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14624 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14625 return (int64_t)ret_conv;
14628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14629 LDKDecodeError e_conv;
14630 e_conv.inner = (void*)(e & (~1));
14631 e_conv.is_owned = (e & 1) || (e == 0);
14632 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14633 e_conv = DecodeError_clone(&e_conv);
14634 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14635 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14636 return (int64_t)ret_conv;
14639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14640 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14641 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14646 if ((_res & 1) != 0) return;
14647 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14648 CHECK_ACCESS(_res_ptr);
14649 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14651 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14654 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14655 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14656 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14657 return (int64_t)ret_conv;
14659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14660 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14661 int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14666 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
14667 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14668 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14669 return (int64_t)ret_conv;
14672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14673 LDKSecretKey o_ref;
14674 CHECK((*env)->GetArrayLength(env, o) == 32);
14675 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
14676 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14677 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
14678 return (int64_t)ret_conv;
14681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14682 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14683 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14684 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
14685 return (int64_t)ret_conv;
14688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14689 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
14690 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
14694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14695 if ((_res & 1) != 0) return;
14696 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14697 CHECK_ACCESS(_res_ptr);
14698 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
14700 CResult_SecretKeyErrorZ_free(_res_conv);
14703 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
14704 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14705 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
14706 return (int64_t)ret_conv;
14708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14709 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
14710 int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
14714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14715 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
14716 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14717 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
14718 return (int64_t)ret_conv;
14721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14722 LDKPublicKey o_ref;
14723 CHECK((*env)->GetArrayLength(env, o) == 33);
14724 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
14725 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14726 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
14727 return (int64_t)ret_conv;
14730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14731 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14732 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14733 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
14734 return (int64_t)ret_conv;
14737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14738 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
14739 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
14743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14744 if ((_res & 1) != 0) return;
14745 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14746 CHECK_ACCESS(_res_ptr);
14747 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
14749 CResult_PublicKeyErrorZ_free(_res_conv);
14752 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
14753 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14754 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
14755 return (int64_t)ret_conv;
14757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14758 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
14759 int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
14763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14764 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
14765 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14766 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14767 return (int64_t)ret_conv;
14770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14771 LDKTxCreationKeys o_conv;
14772 o_conv.inner = (void*)(o & (~1));
14773 o_conv.is_owned = (o & 1) || (o == 0);
14774 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14775 o_conv = TxCreationKeys_clone(&o_conv);
14776 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14777 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14778 return (int64_t)ret_conv;
14781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14782 LDKDecodeError e_conv;
14783 e_conv.inner = (void*)(e & (~1));
14784 e_conv.is_owned = (e & 1) || (e == 0);
14785 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14786 e_conv = DecodeError_clone(&e_conv);
14787 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14788 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14789 return (int64_t)ret_conv;
14792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14793 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
14794 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14799 if ((_res & 1) != 0) return;
14800 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14801 CHECK_ACCESS(_res_ptr);
14802 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14804 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14807 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14808 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14809 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14810 return (int64_t)ret_conv;
14812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14813 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
14814 int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14819 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
14820 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14821 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14822 return (int64_t)ret_conv;
14825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14826 LDKChannelPublicKeys o_conv;
14827 o_conv.inner = (void*)(o & (~1));
14828 o_conv.is_owned = (o & 1) || (o == 0);
14829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14830 o_conv = ChannelPublicKeys_clone(&o_conv);
14831 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14832 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14833 return (int64_t)ret_conv;
14836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14837 LDKDecodeError e_conv;
14838 e_conv.inner = (void*)(e & (~1));
14839 e_conv.is_owned = (e & 1) || (e == 0);
14840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14841 e_conv = DecodeError_clone(&e_conv);
14842 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14843 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14844 return (int64_t)ret_conv;
14847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14848 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
14849 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14854 if ((_res & 1) != 0) return;
14855 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14856 CHECK_ACCESS(_res_ptr);
14857 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14859 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14862 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14863 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14864 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14865 return (int64_t)ret_conv;
14867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14868 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
14869 int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14874 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
14875 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14876 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14877 return (int64_t)ret_conv;
14880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14881 LDKTxCreationKeys o_conv;
14882 o_conv.inner = (void*)(o & (~1));
14883 o_conv.is_owned = (o & 1) || (o == 0);
14884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14885 o_conv = TxCreationKeys_clone(&o_conv);
14886 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14887 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14888 return (int64_t)ret_conv;
14891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14892 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14893 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14894 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14895 return (int64_t)ret_conv;
14898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14899 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
14900 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14905 if ((_res & 1) != 0) return;
14906 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14907 CHECK_ACCESS(_res_ptr);
14908 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14910 CResult_TxCreationKeysErrorZ_free(_res_conv);
14913 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14914 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14915 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14916 return (int64_t)ret_conv;
14918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14919 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14920 int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14925 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14926 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14927 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14928 return (int64_t)ret_conv;
14931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14932 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14933 *ret_copy = COption_u32Z_some(o);
14934 int64_t ret_ref = (uintptr_t)ret_copy;
14938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14939 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14940 *ret_copy = COption_u32Z_none();
14941 int64_t ret_ref = (uintptr_t)ret_copy;
14945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14946 if ((_res & 1) != 0) return;
14947 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14948 CHECK_ACCESS(_res_ptr);
14949 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14951 COption_u32Z_free(_res_conv);
14954 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14955 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14956 *ret_copy = COption_u32Z_clone(arg);
14957 int64_t ret_ref = (uintptr_t)ret_copy;
14960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14961 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14962 int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
14966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14967 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14968 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14969 *ret_copy = COption_u32Z_clone(orig_conv);
14970 int64_t ret_ref = (uintptr_t)ret_copy;
14974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14975 LDKHTLCOutputInCommitment o_conv;
14976 o_conv.inner = (void*)(o & (~1));
14977 o_conv.is_owned = (o & 1) || (o == 0);
14978 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14979 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14980 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14981 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14982 return (int64_t)ret_conv;
14985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14986 LDKDecodeError e_conv;
14987 e_conv.inner = (void*)(e & (~1));
14988 e_conv.is_owned = (e & 1) || (e == 0);
14989 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14990 e_conv = DecodeError_clone(&e_conv);
14991 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14992 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14993 return (int64_t)ret_conv;
14996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14997 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14998 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15003 if ((_res & 1) != 0) return;
15004 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15005 CHECK_ACCESS(_res_ptr);
15006 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15008 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15011 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15012 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15013 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15014 return (int64_t)ret_conv;
15016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15017 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
15018 int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15023 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
15024 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15025 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15026 return (int64_t)ret_conv;
15029 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
15030 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
15034 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
15035 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
15039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
15040 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
15041 COption_NoneZ_free(_res_conv);
15044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15045 LDKCounterpartyChannelTransactionParameters o_conv;
15046 o_conv.inner = (void*)(o & (~1));
15047 o_conv.is_owned = (o & 1) || (o == 0);
15048 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15049 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15050 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15051 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15052 return (int64_t)ret_conv;
15055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15056 LDKDecodeError e_conv;
15057 e_conv.inner = (void*)(e & (~1));
15058 e_conv.is_owned = (e & 1) || (e == 0);
15059 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15060 e_conv = DecodeError_clone(&e_conv);
15061 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15062 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15063 return (int64_t)ret_conv;
15066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15067 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15068 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15073 if ((_res & 1) != 0) return;
15074 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15075 CHECK_ACCESS(_res_ptr);
15076 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15078 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15081 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15082 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15083 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15084 return (int64_t)ret_conv;
15086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15087 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15088 int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15093 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15094 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15095 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15096 return (int64_t)ret_conv;
15099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15100 LDKChannelTransactionParameters o_conv;
15101 o_conv.inner = (void*)(o & (~1));
15102 o_conv.is_owned = (o & 1) || (o == 0);
15103 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15104 o_conv = ChannelTransactionParameters_clone(&o_conv);
15105 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15106 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15107 return (int64_t)ret_conv;
15110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15111 LDKDecodeError e_conv;
15112 e_conv.inner = (void*)(e & (~1));
15113 e_conv.is_owned = (e & 1) || (e == 0);
15114 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15115 e_conv = DecodeError_clone(&e_conv);
15116 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15117 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15118 return (int64_t)ret_conv;
15121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15122 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15123 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15128 if ((_res & 1) != 0) return;
15129 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15130 CHECK_ACCESS(_res_ptr);
15131 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15133 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15136 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15137 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15138 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15139 return (int64_t)ret_conv;
15141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15142 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15143 int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15148 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15149 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15150 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15151 return (int64_t)ret_conv;
15154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15155 LDKCVec_SignatureZ _res_constr;
15156 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15157 if (_res_constr.datalen > 0)
15158 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15160 _res_constr.data = NULL;
15161 for (size_t i = 0; i < _res_constr.datalen; i++) {
15162 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15163 LDKSignature _res_conv_8_ref;
15164 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
15165 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
15166 _res_constr.data[i] = _res_conv_8_ref;
15168 CVec_SignatureZ_free(_res_constr);
15171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15172 LDKHolderCommitmentTransaction o_conv;
15173 o_conv.inner = (void*)(o & (~1));
15174 o_conv.is_owned = (o & 1) || (o == 0);
15175 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15176 o_conv = HolderCommitmentTransaction_clone(&o_conv);
15177 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15178 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15179 return (int64_t)ret_conv;
15182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15183 LDKDecodeError e_conv;
15184 e_conv.inner = (void*)(e & (~1));
15185 e_conv.is_owned = (e & 1) || (e == 0);
15186 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15187 e_conv = DecodeError_clone(&e_conv);
15188 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15189 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15190 return (int64_t)ret_conv;
15193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15194 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
15195 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15200 if ((_res & 1) != 0) return;
15201 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15202 CHECK_ACCESS(_res_ptr);
15203 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15205 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15208 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15209 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15210 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15211 return (int64_t)ret_conv;
15213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15214 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15215 int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15220 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15221 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15222 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15223 return (int64_t)ret_conv;
15226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15227 LDKBuiltCommitmentTransaction o_conv;
15228 o_conv.inner = (void*)(o & (~1));
15229 o_conv.is_owned = (o & 1) || (o == 0);
15230 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15231 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15232 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15233 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15234 return (int64_t)ret_conv;
15237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15238 LDKDecodeError e_conv;
15239 e_conv.inner = (void*)(e & (~1));
15240 e_conv.is_owned = (e & 1) || (e == 0);
15241 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15242 e_conv = DecodeError_clone(&e_conv);
15243 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15244 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15245 return (int64_t)ret_conv;
15248 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15249 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
15250 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15255 if ((_res & 1) != 0) return;
15256 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15257 CHECK_ACCESS(_res_ptr);
15258 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15260 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15263 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15264 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15265 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15266 return (int64_t)ret_conv;
15268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15269 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15270 int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15275 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15276 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15277 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15278 return (int64_t)ret_conv;
15281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15282 LDKTrustedClosingTransaction o_conv;
15283 o_conv.inner = (void*)(o & (~1));
15284 o_conv.is_owned = (o & 1) || (o == 0);
15285 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15286 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15287 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15288 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15289 return (int64_t)ret_conv;
15292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15293 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15294 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15295 return (int64_t)ret_conv;
15298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15299 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
15300 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15305 if ((_res & 1) != 0) return;
15306 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15307 CHECK_ACCESS(_res_ptr);
15308 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15310 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15314 LDKCommitmentTransaction o_conv;
15315 o_conv.inner = (void*)(o & (~1));
15316 o_conv.is_owned = (o & 1) || (o == 0);
15317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15318 o_conv = CommitmentTransaction_clone(&o_conv);
15319 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15320 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15321 return (int64_t)ret_conv;
15324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15325 LDKDecodeError e_conv;
15326 e_conv.inner = (void*)(e & (~1));
15327 e_conv.is_owned = (e & 1) || (e == 0);
15328 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15329 e_conv = DecodeError_clone(&e_conv);
15330 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15331 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15332 return (int64_t)ret_conv;
15335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15336 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
15337 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15342 if ((_res & 1) != 0) return;
15343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15344 CHECK_ACCESS(_res_ptr);
15345 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15347 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15350 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15351 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15352 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15353 return (int64_t)ret_conv;
15355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15356 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
15357 int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15362 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
15363 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15364 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15365 return (int64_t)ret_conv;
15368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15369 LDKTrustedCommitmentTransaction o_conv;
15370 o_conv.inner = (void*)(o & (~1));
15371 o_conv.is_owned = (o & 1) || (o == 0);
15372 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15373 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15374 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15375 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15376 return (int64_t)ret_conv;
15379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15380 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15381 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15382 return (int64_t)ret_conv;
15385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15386 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
15387 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15392 if ((_res & 1) != 0) return;
15393 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15394 CHECK_ACCESS(_res_ptr);
15395 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15397 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
15401 LDKCVec_SignatureZ o_constr;
15402 o_constr.datalen = (*env)->GetArrayLength(env, o);
15403 if (o_constr.datalen > 0)
15404 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15406 o_constr.data = NULL;
15407 for (size_t i = 0; i < o_constr.datalen; i++) {
15408 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15409 LDKSignature o_conv_8_ref;
15410 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
15411 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
15412 o_constr.data[i] = o_conv_8_ref;
15414 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15415 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15416 return (int64_t)ret_conv;
15419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
15420 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15421 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15422 return (int64_t)ret_conv;
15425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15426 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
15427 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15432 if ((_res & 1) != 0) return;
15433 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15434 CHECK_ACCESS(_res_ptr);
15435 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15437 CResult_CVec_SignatureZNoneZ_free(_res_conv);
15440 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15441 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15442 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15443 return (int64_t)ret_conv;
15445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15446 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
15447 int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15452 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
15453 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15454 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15455 return (int64_t)ret_conv;
15458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15459 LDKShutdownScript o_conv;
15460 o_conv.inner = (void*)(o & (~1));
15461 o_conv.is_owned = (o & 1) || (o == 0);
15462 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15463 o_conv = ShutdownScript_clone(&o_conv);
15464 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15465 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15466 return (int64_t)ret_conv;
15469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15470 LDKDecodeError e_conv;
15471 e_conv.inner = (void*)(e & (~1));
15472 e_conv.is_owned = (e & 1) || (e == 0);
15473 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15474 e_conv = DecodeError_clone(&e_conv);
15475 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15476 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15477 return (int64_t)ret_conv;
15480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15481 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15482 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15487 if ((_res & 1) != 0) return;
15488 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15489 CHECK_ACCESS(_res_ptr);
15490 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15492 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15495 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15496 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15497 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15498 return (int64_t)ret_conv;
15500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15501 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15502 int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15507 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15508 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15509 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15510 return (int64_t)ret_conv;
15513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15514 LDKShutdownScript o_conv;
15515 o_conv.inner = (void*)(o & (~1));
15516 o_conv.is_owned = (o & 1) || (o == 0);
15517 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15518 o_conv = ShutdownScript_clone(&o_conv);
15519 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15520 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15521 return (int64_t)ret_conv;
15524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15525 LDKInvalidShutdownScript e_conv;
15526 e_conv.inner = (void*)(e & (~1));
15527 e_conv.is_owned = (e & 1) || (e == 0);
15528 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15529 e_conv = InvalidShutdownScript_clone(&e_conv);
15530 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15531 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15532 return (int64_t)ret_conv;
15535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15536 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15537 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15542 if ((_res & 1) != 0) return;
15543 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15544 CHECK_ACCESS(_res_ptr);
15545 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15547 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15550 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15551 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15552 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15553 return (int64_t)ret_conv;
15555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15556 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15557 int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15562 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15563 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15564 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15565 return (int64_t)ret_conv;
15568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15569 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15570 *ret_conv = CResult_NoneErrorZ_ok();
15571 return (int64_t)ret_conv;
15574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15575 LDKIOError e_conv = LDKIOError_from_java(env, e);
15576 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15577 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15578 return (int64_t)ret_conv;
15581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15582 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15583 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
15587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15588 if ((_res & 1) != 0) return;
15589 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15590 CHECK_ACCESS(_res_ptr);
15591 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15593 CResult_NoneErrorZ_free(_res_conv);
15596 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15597 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15598 *ret_conv = CResult_NoneErrorZ_clone(arg);
15599 return (int64_t)ret_conv;
15601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15602 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15603 int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
15607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15608 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15609 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15610 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15611 return (int64_t)ret_conv;
15614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15615 LDKRouteHop o_conv;
15616 o_conv.inner = (void*)(o & (~1));
15617 o_conv.is_owned = (o & 1) || (o == 0);
15618 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15619 o_conv = RouteHop_clone(&o_conv);
15620 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15621 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15622 return (int64_t)ret_conv;
15625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15626 LDKDecodeError e_conv;
15627 e_conv.inner = (void*)(e & (~1));
15628 e_conv.is_owned = (e & 1) || (e == 0);
15629 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15630 e_conv = DecodeError_clone(&e_conv);
15631 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15632 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15633 return (int64_t)ret_conv;
15636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15637 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15638 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15643 if ((_res & 1) != 0) return;
15644 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15645 CHECK_ACCESS(_res_ptr);
15646 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15648 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15651 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15652 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15653 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15654 return (int64_t)ret_conv;
15656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15657 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15658 int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15663 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15664 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15665 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
15666 return (int64_t)ret_conv;
15669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15670 LDKCVec_RouteHopZ _res_constr;
15671 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15672 if (_res_constr.datalen > 0)
15673 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15675 _res_constr.data = NULL;
15676 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15677 for (size_t k = 0; k < _res_constr.datalen; k++) {
15678 int64_t _res_conv_10 = _res_vals[k];
15679 LDKRouteHop _res_conv_10_conv;
15680 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15681 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15682 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15683 _res_constr.data[k] = _res_conv_10_conv;
15685 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15686 CVec_RouteHopZ_free(_res_constr);
15689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15690 LDKCVec_CVec_RouteHopZZ _res_constr;
15691 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15692 if (_res_constr.datalen > 0)
15693 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15695 _res_constr.data = NULL;
15696 for (size_t m = 0; m < _res_constr.datalen; m++) {
15697 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
15698 LDKCVec_RouteHopZ _res_conv_12_constr;
15699 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
15700 if (_res_conv_12_constr.datalen > 0)
15701 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15703 _res_conv_12_constr.data = NULL;
15704 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
15705 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
15706 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
15707 LDKRouteHop _res_conv_12_conv_10_conv;
15708 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
15709 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
15710 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
15711 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
15713 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
15714 _res_constr.data[m] = _res_conv_12_constr;
15716 CVec_CVec_RouteHopZZ_free(_res_constr);
15719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15721 o_conv.inner = (void*)(o & (~1));
15722 o_conv.is_owned = (o & 1) || (o == 0);
15723 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15724 o_conv = Route_clone(&o_conv);
15725 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15726 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
15727 return (int64_t)ret_conv;
15730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15731 LDKDecodeError e_conv;
15732 e_conv.inner = (void*)(e & (~1));
15733 e_conv.is_owned = (e & 1) || (e == 0);
15734 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15735 e_conv = DecodeError_clone(&e_conv);
15736 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15737 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
15738 return (int64_t)ret_conv;
15741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15742 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
15743 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
15747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15748 if ((_res & 1) != 0) return;
15749 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15750 CHECK_ACCESS(_res_ptr);
15751 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
15753 CResult_RouteDecodeErrorZ_free(_res_conv);
15756 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
15757 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15758 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
15759 return (int64_t)ret_conv;
15761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15762 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
15763 int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15768 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
15769 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15770 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15771 return (int64_t)ret_conv;
15774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15775 LDKRouteParameters o_conv;
15776 o_conv.inner = (void*)(o & (~1));
15777 o_conv.is_owned = (o & 1) || (o == 0);
15778 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15779 o_conv = RouteParameters_clone(&o_conv);
15780 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15781 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15782 return (int64_t)ret_conv;
15785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15786 LDKDecodeError e_conv;
15787 e_conv.inner = (void*)(e & (~1));
15788 e_conv.is_owned = (e & 1) || (e == 0);
15789 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15790 e_conv = DecodeError_clone(&e_conv);
15791 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15792 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15793 return (int64_t)ret_conv;
15796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15797 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
15798 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15803 if ((_res & 1) != 0) return;
15804 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15805 CHECK_ACCESS(_res_ptr);
15806 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15808 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15811 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15812 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15813 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15814 return (int64_t)ret_conv;
15816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15817 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
15818 int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15823 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
15824 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15825 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15826 return (int64_t)ret_conv;
15829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15830 LDKCVec_RouteHintZ _res_constr;
15831 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15832 if (_res_constr.datalen > 0)
15833 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15835 _res_constr.data = NULL;
15836 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15837 for (size_t l = 0; l < _res_constr.datalen; l++) {
15838 int64_t _res_conv_11 = _res_vals[l];
15839 LDKRouteHint _res_conv_11_conv;
15840 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
15841 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
15842 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15843 _res_constr.data[l] = _res_conv_11_conv;
15845 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15846 CVec_RouteHintZ_free(_res_constr);
15849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15850 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15851 *ret_copy = COption_u64Z_some(o);
15852 int64_t ret_ref = (uintptr_t)ret_copy;
15856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15857 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15858 *ret_copy = COption_u64Z_none();
15859 int64_t ret_ref = (uintptr_t)ret_copy;
15863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15864 if ((_res & 1) != 0) return;
15865 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15866 CHECK_ACCESS(_res_ptr);
15867 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15869 COption_u64Z_free(_res_conv);
15872 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15873 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15874 *ret_copy = COption_u64Z_clone(arg);
15875 int64_t ret_ref = (uintptr_t)ret_copy;
15878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15879 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
15880 int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15885 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
15886 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15887 *ret_copy = COption_u64Z_clone(orig_conv);
15888 int64_t ret_ref = (uintptr_t)ret_copy;
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15893 LDKPaymentParameters o_conv;
15894 o_conv.inner = (void*)(o & (~1));
15895 o_conv.is_owned = (o & 1) || (o == 0);
15896 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15897 o_conv = PaymentParameters_clone(&o_conv);
15898 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15899 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15900 return (int64_t)ret_conv;
15903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15904 LDKDecodeError e_conv;
15905 e_conv.inner = (void*)(e & (~1));
15906 e_conv.is_owned = (e & 1) || (e == 0);
15907 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15908 e_conv = DecodeError_clone(&e_conv);
15909 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15910 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15911 return (int64_t)ret_conv;
15914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15915 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15916 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15921 if ((_res & 1) != 0) return;
15922 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15923 CHECK_ACCESS(_res_ptr);
15924 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15926 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15929 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15930 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15931 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15932 return (int64_t)ret_conv;
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15935 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15936 int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15941 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15942 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15943 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15944 return (int64_t)ret_conv;
15947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15948 LDKCVec_RouteHintHopZ _res_constr;
15949 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15950 if (_res_constr.datalen > 0)
15951 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15953 _res_constr.data = NULL;
15954 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15955 for (size_t o = 0; o < _res_constr.datalen; o++) {
15956 int64_t _res_conv_14 = _res_vals[o];
15957 LDKRouteHintHop _res_conv_14_conv;
15958 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15959 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15960 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15961 _res_constr.data[o] = _res_conv_14_conv;
15963 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15964 CVec_RouteHintHopZ_free(_res_constr);
15967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15968 LDKRouteHint o_conv;
15969 o_conv.inner = (void*)(o & (~1));
15970 o_conv.is_owned = (o & 1) || (o == 0);
15971 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15972 o_conv = RouteHint_clone(&o_conv);
15973 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15974 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15975 return (int64_t)ret_conv;
15978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15979 LDKDecodeError e_conv;
15980 e_conv.inner = (void*)(e & (~1));
15981 e_conv.is_owned = (e & 1) || (e == 0);
15982 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15983 e_conv = DecodeError_clone(&e_conv);
15984 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15985 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15986 return (int64_t)ret_conv;
15989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15990 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15991 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15996 if ((_res & 1) != 0) return;
15997 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15998 CHECK_ACCESS(_res_ptr);
15999 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
16001 CResult_RouteHintDecodeErrorZ_free(_res_conv);
16004 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
16005 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16006 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
16007 return (int64_t)ret_conv;
16009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16010 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
16011 int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
16015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16016 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
16017 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16018 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
16019 return (int64_t)ret_conv;
16022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16023 LDKRouteHintHop o_conv;
16024 o_conv.inner = (void*)(o & (~1));
16025 o_conv.is_owned = (o & 1) || (o == 0);
16026 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16027 o_conv = RouteHintHop_clone(&o_conv);
16028 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16029 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
16030 return (int64_t)ret_conv;
16033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16034 LDKDecodeError e_conv;
16035 e_conv.inner = (void*)(e & (~1));
16036 e_conv.is_owned = (e & 1) || (e == 0);
16037 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16038 e_conv = DecodeError_clone(&e_conv);
16039 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16040 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
16041 return (int64_t)ret_conv;
16044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16045 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
16046 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
16050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16051 if ((_res & 1) != 0) return;
16052 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16053 CHECK_ACCESS(_res_ptr);
16054 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
16056 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
16059 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
16060 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16061 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
16062 return (int64_t)ret_conv;
16064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16065 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
16066 int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
16070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16071 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
16072 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16073 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
16074 return (int64_t)ret_conv;
16077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16078 LDKCVec_ChannelDetailsZ _res_constr;
16079 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16080 if (_res_constr.datalen > 0)
16081 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16083 _res_constr.data = NULL;
16084 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16085 for (size_t q = 0; q < _res_constr.datalen; q++) {
16086 int64_t _res_conv_16 = _res_vals[q];
16087 LDKChannelDetails _res_conv_16_conv;
16088 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16089 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16090 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16091 _res_constr.data[q] = _res_conv_16_conv;
16093 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16094 CVec_ChannelDetailsZ_free(_res_constr);
16097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16099 o_conv.inner = (void*)(o & (~1));
16100 o_conv.is_owned = (o & 1) || (o == 0);
16101 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16102 o_conv = Route_clone(&o_conv);
16103 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16104 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16105 return (int64_t)ret_conv;
16108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16109 LDKLightningError e_conv;
16110 e_conv.inner = (void*)(e & (~1));
16111 e_conv.is_owned = (e & 1) || (e == 0);
16112 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16113 e_conv = LightningError_clone(&e_conv);
16114 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16115 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16116 return (int64_t)ret_conv;
16119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16120 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
16121 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16126 if ((_res & 1) != 0) return;
16127 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16128 CHECK_ACCESS(_res_ptr);
16129 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16131 CResult_RouteLightningErrorZ_free(_res_conv);
16134 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16135 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16136 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16137 return (int64_t)ret_conv;
16139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16140 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
16141 int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16146 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
16147 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16148 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16149 return (int64_t)ret_conv;
16152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16153 LDKCVec_PublicKeyZ _res_constr;
16154 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16155 if (_res_constr.datalen > 0)
16156 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16158 _res_constr.data = NULL;
16159 for (size_t i = 0; i < _res_constr.datalen; i++) {
16160 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16161 LDKPublicKey _res_conv_8_ref;
16162 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
16163 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
16164 _res_constr.data[i] = _res_conv_8_ref;
16166 CVec_PublicKeyZ_free(_res_constr);
16169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16170 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16171 CHECK_ACCESS(o_ptr);
16172 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
16173 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
16174 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16175 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
16176 return (int64_t)ret_conv;
16179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16180 LDKDecodeError e_conv;
16181 e_conv.inner = (void*)(e & (~1));
16182 e_conv.is_owned = (e & 1) || (e == 0);
16183 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16184 e_conv = DecodeError_clone(&e_conv);
16185 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16186 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
16187 return (int64_t)ret_conv;
16190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16191 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
16192 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
16196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16197 if ((_res & 1) != 0) return;
16198 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16199 CHECK_ACCESS(_res_ptr);
16200 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
16202 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
16205 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
16206 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16207 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
16208 return (int64_t)ret_conv;
16210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16211 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
16212 int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
16216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16217 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
16218 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16219 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
16220 return (int64_t)ret_conv;
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16224 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16225 CHECK_ACCESS(o_ptr);
16226 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
16227 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
16228 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16229 *ret_copy = COption_ClosureReasonZ_some(o_conv);
16230 int64_t ret_ref = (uintptr_t)ret_copy;
16234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
16235 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16236 *ret_copy = COption_ClosureReasonZ_none();
16237 int64_t ret_ref = (uintptr_t)ret_copy;
16241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16242 if ((_res & 1) != 0) return;
16243 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16244 CHECK_ACCESS(_res_ptr);
16245 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16247 COption_ClosureReasonZ_free(_res_conv);
16250 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16251 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16252 *ret_copy = COption_ClosureReasonZ_clone(arg);
16253 int64_t ret_ref = (uintptr_t)ret_copy;
16256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16257 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
16258 int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16263 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
16264 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16265 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16266 int64_t ret_ref = (uintptr_t)ret_copy;
16270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16271 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16272 CHECK_ACCESS(o_ptr);
16273 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16274 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
16275 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16276 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16277 return (int64_t)ret_conv;
16280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16281 LDKDecodeError e_conv;
16282 e_conv.inner = (void*)(e & (~1));
16283 e_conv.is_owned = (e & 1) || (e == 0);
16284 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16285 e_conv = DecodeError_clone(&e_conv);
16286 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16287 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
16288 return (int64_t)ret_conv;
16291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16292 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
16293 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
16297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16298 if ((_res & 1) != 0) return;
16299 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16300 CHECK_ACCESS(_res_ptr);
16301 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16303 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16306 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16307 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16308 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16309 return (int64_t)ret_conv;
16311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16312 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16313 int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16318 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16319 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16320 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16321 return (int64_t)ret_conv;
16324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16325 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16326 CHECK_ACCESS(o_ptr);
16327 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16328 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16329 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16330 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16331 int64_t ret_ref = (uintptr_t)ret_copy;
16335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16336 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16337 *ret_copy = COption_NetworkUpdateZ_none();
16338 int64_t ret_ref = (uintptr_t)ret_copy;
16342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16343 if ((_res & 1) != 0) return;
16344 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16345 CHECK_ACCESS(_res_ptr);
16346 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16348 COption_NetworkUpdateZ_free(_res_conv);
16351 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16352 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16353 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16354 int64_t ret_ref = (uintptr_t)ret_copy;
16357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16358 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16359 int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16364 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16365 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16366 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16367 int64_t ret_ref = (uintptr_t)ret_copy;
16371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16372 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16373 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16374 if (_res_constr.datalen > 0)
16375 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16377 _res_constr.data = NULL;
16378 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16379 for (size_t b = 0; b < _res_constr.datalen; b++) {
16380 int64_t _res_conv_27 = _res_vals[b];
16381 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16382 CHECK_ACCESS(_res_conv_27_ptr);
16383 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16384 FREE((void*)_res_conv_27);
16385 _res_constr.data[b] = _res_conv_27_conv;
16387 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16388 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16392 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16393 CHECK_ACCESS(o_ptr);
16394 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16395 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16396 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16397 *ret_copy = COption_EventZ_some(o_conv);
16398 int64_t ret_ref = (uintptr_t)ret_copy;
16402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16403 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16404 *ret_copy = COption_EventZ_none();
16405 int64_t ret_ref = (uintptr_t)ret_copy;
16409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16410 if ((_res & 1) != 0) return;
16411 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16412 CHECK_ACCESS(_res_ptr);
16413 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16415 COption_EventZ_free(_res_conv);
16418 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16419 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16420 *ret_copy = COption_EventZ_clone(arg);
16421 int64_t ret_ref = (uintptr_t)ret_copy;
16424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16425 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16426 int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
16430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16431 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16432 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16433 *ret_copy = COption_EventZ_clone(orig_conv);
16434 int64_t ret_ref = (uintptr_t)ret_copy;
16438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16439 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16440 CHECK_ACCESS(o_ptr);
16441 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16442 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16443 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16444 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16445 return (int64_t)ret_conv;
16448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16449 LDKDecodeError e_conv;
16450 e_conv.inner = (void*)(e & (~1));
16451 e_conv.is_owned = (e & 1) || (e == 0);
16452 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16453 e_conv = DecodeError_clone(&e_conv);
16454 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16455 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16456 return (int64_t)ret_conv;
16459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16460 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16461 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16466 if ((_res & 1) != 0) return;
16467 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16468 CHECK_ACCESS(_res_ptr);
16469 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16471 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16474 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16475 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16476 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16477 return (int64_t)ret_conv;
16479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16480 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16481 int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16486 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16487 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16488 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16489 return (int64_t)ret_conv;
16492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16493 LDKCVec_MessageSendEventZ _res_constr;
16494 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16495 if (_res_constr.datalen > 0)
16496 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16498 _res_constr.data = NULL;
16499 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16500 for (size_t s = 0; s < _res_constr.datalen; s++) {
16501 int64_t _res_conv_18 = _res_vals[s];
16502 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16503 CHECK_ACCESS(_res_conv_18_ptr);
16504 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16505 FREE((void*)_res_conv_18);
16506 _res_constr.data[s] = _res_conv_18_conv;
16508 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16509 CVec_MessageSendEventZ_free(_res_constr);
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16513 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16514 CHECK_ACCESS(o_ptr);
16515 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
16516 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
16517 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16518 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
16519 return (int64_t)ret_conv;
16522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16523 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
16524 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16525 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
16526 return (int64_t)ret_conv;
16529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16530 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
16531 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
16535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16536 if ((_res & 1) != 0) return;
16537 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16538 CHECK_ACCESS(_res_ptr);
16539 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
16541 CResult_TxOutAccessErrorZ_free(_res_conv);
16544 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
16545 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16546 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
16547 return (int64_t)ret_conv;
16549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16550 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
16551 int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
16555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16556 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
16557 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16558 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
16559 return (int64_t)ret_conv;
16562 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
16563 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16564 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
16565 return ((int64_t)ret_conv);
16567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16568 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
16569 int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
16573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16574 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
16575 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16576 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
16577 return ((int64_t)ret_conv);
16580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
16581 LDKTransaction b_ref;
16582 b_ref.datalen = (*env)->GetArrayLength(env, b);
16583 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
16584 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
16585 b_ref.data_is_owned = true;
16586 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16587 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
16588 return ((int64_t)ret_conv);
16591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16592 if ((_res & 1) != 0) return;
16593 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16594 CHECK_ACCESS(_res_ptr);
16595 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
16597 C2Tuple_usizeTransactionZ_free(_res_conv);
16600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16601 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
16602 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16603 if (_res_constr.datalen > 0)
16604 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16606 _res_constr.data = NULL;
16607 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16608 for (size_t c = 0; c < _res_constr.datalen; c++) {
16609 int64_t _res_conv_28 = _res_vals[c];
16610 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
16611 CHECK_ACCESS(_res_conv_28_ptr);
16612 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
16613 FREE((void*)_res_conv_28);
16614 _res_constr.data[c] = _res_conv_28_conv;
16616 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16617 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
16620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16621 LDKCVec_TxidZ _res_constr;
16622 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16623 if (_res_constr.datalen > 0)
16624 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
16626 _res_constr.data = NULL;
16627 for (size_t i = 0; i < _res_constr.datalen; i++) {
16628 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16629 LDKThirtyTwoBytes _res_conv_8_ref;
16630 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16631 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16632 _res_constr.data[i] = _res_conv_8_ref;
16634 CVec_TxidZ_free(_res_constr);
16637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
16638 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16639 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
16640 return (int64_t)ret_conv;
16643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
16644 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
16645 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16646 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
16647 return (int64_t)ret_conv;
16650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16651 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
16652 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
16656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16657 if ((_res & 1) != 0) return;
16658 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16659 CHECK_ACCESS(_res_ptr);
16660 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
16662 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
16665 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
16666 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16667 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
16668 return (int64_t)ret_conv;
16670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16671 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
16672 int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
16676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16677 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
16678 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16679 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
16680 return (int64_t)ret_conv;
16683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16684 LDKCVec_MonitorEventZ _res_constr;
16685 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16686 if (_res_constr.datalen > 0)
16687 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16689 _res_constr.data = NULL;
16690 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16691 for (size_t o = 0; o < _res_constr.datalen; o++) {
16692 int64_t _res_conv_14 = _res_vals[o];
16693 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
16694 CHECK_ACCESS(_res_conv_14_ptr);
16695 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
16696 FREE((void*)_res_conv_14);
16697 _res_constr.data[o] = _res_conv_14_conv;
16699 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16700 CVec_MonitorEventZ_free(_res_constr);
16703 static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) {
16704 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16705 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg);
16706 return ((int64_t)ret_conv);
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16709 LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1);
16710 int64_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv);
16714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16715 LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1);
16716 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16717 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv);
16718 return ((int64_t)ret_conv);
16721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
16722 LDKOutPoint a_conv;
16723 a_conv.inner = (void*)(a & (~1));
16724 a_conv.is_owned = (a & 1) || (a == 0);
16725 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16726 a_conv = OutPoint_clone(&a_conv);
16727 LDKCVec_MonitorEventZ b_constr;
16728 b_constr.datalen = (*env)->GetArrayLength(env, b);
16729 if (b_constr.datalen > 0)
16730 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16732 b_constr.data = NULL;
16733 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16734 for (size_t o = 0; o < b_constr.datalen; o++) {
16735 int64_t b_conv_14 = b_vals[o];
16736 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
16737 CHECK_ACCESS(b_conv_14_ptr);
16738 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
16739 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
16740 b_constr.data[o] = b_conv_14_conv;
16742 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16743 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16744 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr);
16745 return ((int64_t)ret_conv);
16748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16749 if ((_res & 1) != 0) return;
16750 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16751 CHECK_ACCESS(_res_ptr);
16752 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr);
16754 C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv);
16757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorEventZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16758 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr;
16759 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16760 if (_res_constr.datalen > 0)
16761 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
16763 _res_constr.data = NULL;
16764 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16765 for (size_t m = 0; m < _res_constr.datalen; m++) {
16766 int64_t _res_conv_38 = _res_vals[m];
16767 void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1);
16768 CHECK_ACCESS(_res_conv_38_ptr);
16769 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr);
16770 FREE((void*)_res_conv_38);
16771 _res_constr.data[m] = _res_conv_38_conv;
16773 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16774 CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr);
16777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16778 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16779 CHECK_ACCESS(o_ptr);
16780 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
16781 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
16782 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16783 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
16784 int64_t ret_ref = (uintptr_t)ret_copy;
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
16789 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16790 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
16791 int64_t ret_ref = (uintptr_t)ret_copy;
16795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16796 if ((_res & 1) != 0) return;
16797 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16798 CHECK_ACCESS(_res_ptr);
16799 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
16801 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
16804 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
16805 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16806 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
16807 int64_t ret_ref = (uintptr_t)ret_copy;
16810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16811 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
16812 int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
16816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16817 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
16818 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16819 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
16820 int64_t ret_ref = (uintptr_t)ret_copy;
16824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16825 LDKFixedPenaltyScorer o_conv;
16826 o_conv.inner = (void*)(o & (~1));
16827 o_conv.is_owned = (o & 1) || (o == 0);
16828 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16829 o_conv = FixedPenaltyScorer_clone(&o_conv);
16830 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16831 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16832 return (int64_t)ret_conv;
16835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16836 LDKDecodeError e_conv;
16837 e_conv.inner = (void*)(e & (~1));
16838 e_conv.is_owned = (e & 1) || (e == 0);
16839 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16840 e_conv = DecodeError_clone(&e_conv);
16841 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16842 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16843 return (int64_t)ret_conv;
16846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16847 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
16848 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16853 if ((_res & 1) != 0) return;
16854 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16855 CHECK_ACCESS(_res_ptr);
16856 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16858 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16861 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16862 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16863 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16864 return (int64_t)ret_conv;
16866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16867 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
16868 int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16873 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
16874 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16875 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16876 return (int64_t)ret_conv;
16879 static inline uintptr_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
16880 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16881 *ret_conv = C2Tuple_u64u64Z_clone(arg);
16882 return ((int64_t)ret_conv);
16884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16885 LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)(arg & ~1);
16886 int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
16890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16891 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
16892 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16893 *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
16894 return ((int64_t)ret_conv);
16897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16898 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16899 *ret_conv = C2Tuple_u64u64Z_new(a, b);
16900 return ((int64_t)ret_conv);
16903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16904 if ((_res & 1) != 0) return;
16905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16906 CHECK_ACCESS(_res_ptr);
16907 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
16909 C2Tuple_u64u64Z_free(_res_conv);
16912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16913 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16914 CHECK_ACCESS(o_ptr);
16915 LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
16916 o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)(((uintptr_t)o) & ~1));
16917 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16918 *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
16919 int64_t ret_ref = (uintptr_t)ret_copy;
16923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
16924 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16925 *ret_copy = COption_C2Tuple_u64u64ZZ_none();
16926 int64_t ret_ref = (uintptr_t)ret_copy;
16930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16931 if ((_res & 1) != 0) return;
16932 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16933 CHECK_ACCESS(_res_ptr);
16934 LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
16936 COption_C2Tuple_u64u64ZZ_free(_res_conv);
16939 static inline uintptr_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
16940 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16941 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
16942 int64_t ret_ref = (uintptr_t)ret_copy;
16945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16946 LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)arg;
16947 int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
16951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16952 LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)orig;
16953 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16954 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
16955 int64_t ret_ref = (uintptr_t)ret_copy;
16959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16960 LDKCVec_NodeIdZ _res_constr;
16961 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16962 if (_res_constr.datalen > 0)
16963 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
16965 _res_constr.data = NULL;
16966 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16967 for (size_t i = 0; i < _res_constr.datalen; i++) {
16968 int64_t _res_conv_8 = _res_vals[i];
16969 LDKNodeId _res_conv_8_conv;
16970 _res_conv_8_conv.inner = (void*)(_res_conv_8 & (~1));
16971 _res_conv_8_conv.is_owned = (_res_conv_8 & 1) || (_res_conv_8 == 0);
16972 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
16973 _res_constr.data[i] = _res_conv_8_conv;
16975 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16976 CVec_NodeIdZ_free(_res_constr);
16979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16980 LDKProbabilisticScorer o_conv;
16981 o_conv.inner = (void*)(o & (~1));
16982 o_conv.is_owned = (o & 1) || (o == 0);
16983 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16984 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16985 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16986 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16987 return (int64_t)ret_conv;
16990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16991 LDKDecodeError e_conv;
16992 e_conv.inner = (void*)(e & (~1));
16993 e_conv.is_owned = (e & 1) || (e == 0);
16994 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16995 e_conv = DecodeError_clone(&e_conv);
16996 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16997 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16998 return (int64_t)ret_conv;
17001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17002 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
17003 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
17007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17008 if ((_res & 1) != 0) return;
17009 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17010 CHECK_ACCESS(_res_ptr);
17011 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
17013 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
17016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17017 LDKInitFeatures o_conv;
17018 o_conv.inner = (void*)(o & (~1));
17019 o_conv.is_owned = (o & 1) || (o == 0);
17020 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17021 o_conv = InitFeatures_clone(&o_conv);
17022 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17023 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
17024 return (int64_t)ret_conv;
17027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17028 LDKDecodeError e_conv;
17029 e_conv.inner = (void*)(e & (~1));
17030 e_conv.is_owned = (e & 1) || (e == 0);
17031 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17032 e_conv = DecodeError_clone(&e_conv);
17033 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17034 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
17035 return (int64_t)ret_conv;
17038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17039 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
17040 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
17044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17045 if ((_res & 1) != 0) return;
17046 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17047 CHECK_ACCESS(_res_ptr);
17048 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
17050 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
17053 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17054 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17055 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
17056 return (int64_t)ret_conv;
17058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17059 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
17060 int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17065 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
17066 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17067 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
17068 return (int64_t)ret_conv;
17071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17072 LDKChannelFeatures o_conv;
17073 o_conv.inner = (void*)(o & (~1));
17074 o_conv.is_owned = (o & 1) || (o == 0);
17075 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17076 o_conv = ChannelFeatures_clone(&o_conv);
17077 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17078 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
17079 return (int64_t)ret_conv;
17082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17083 LDKDecodeError e_conv;
17084 e_conv.inner = (void*)(e & (~1));
17085 e_conv.is_owned = (e & 1) || (e == 0);
17086 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17087 e_conv = DecodeError_clone(&e_conv);
17088 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17089 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
17090 return (int64_t)ret_conv;
17093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17094 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
17095 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
17099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17100 if ((_res & 1) != 0) return;
17101 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17102 CHECK_ACCESS(_res_ptr);
17103 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
17105 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
17108 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17109 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17110 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
17111 return (int64_t)ret_conv;
17113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17114 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
17115 int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17120 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
17121 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17122 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
17123 return (int64_t)ret_conv;
17126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17127 LDKNodeFeatures o_conv;
17128 o_conv.inner = (void*)(o & (~1));
17129 o_conv.is_owned = (o & 1) || (o == 0);
17130 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17131 o_conv = NodeFeatures_clone(&o_conv);
17132 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17133 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
17134 return (int64_t)ret_conv;
17137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17138 LDKDecodeError e_conv;
17139 e_conv.inner = (void*)(e & (~1));
17140 e_conv.is_owned = (e & 1) || (e == 0);
17141 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17142 e_conv = DecodeError_clone(&e_conv);
17143 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17144 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
17145 return (int64_t)ret_conv;
17148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17149 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
17150 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
17154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17155 if ((_res & 1) != 0) return;
17156 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17157 CHECK_ACCESS(_res_ptr);
17158 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
17160 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
17163 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17164 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17165 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
17166 return (int64_t)ret_conv;
17168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17169 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
17170 int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17175 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
17176 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17177 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
17178 return (int64_t)ret_conv;
17181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17182 LDKInvoiceFeatures o_conv;
17183 o_conv.inner = (void*)(o & (~1));
17184 o_conv.is_owned = (o & 1) || (o == 0);
17185 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17186 o_conv = InvoiceFeatures_clone(&o_conv);
17187 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17188 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
17189 return (int64_t)ret_conv;
17192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17193 LDKDecodeError e_conv;
17194 e_conv.inner = (void*)(e & (~1));
17195 e_conv.is_owned = (e & 1) || (e == 0);
17196 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17197 e_conv = DecodeError_clone(&e_conv);
17198 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17199 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
17200 return (int64_t)ret_conv;
17203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17204 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
17205 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
17209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17210 if ((_res & 1) != 0) return;
17211 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17212 CHECK_ACCESS(_res_ptr);
17213 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
17215 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
17218 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17219 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17220 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
17221 return (int64_t)ret_conv;
17223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17224 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
17225 int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17230 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
17231 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17232 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
17233 return (int64_t)ret_conv;
17236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17237 LDKChannelTypeFeatures o_conv;
17238 o_conv.inner = (void*)(o & (~1));
17239 o_conv.is_owned = (o & 1) || (o == 0);
17240 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17241 o_conv = ChannelTypeFeatures_clone(&o_conv);
17242 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17243 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
17244 return (int64_t)ret_conv;
17247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17248 LDKDecodeError e_conv;
17249 e_conv.inner = (void*)(e & (~1));
17250 e_conv.is_owned = (e & 1) || (e == 0);
17251 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17252 e_conv = DecodeError_clone(&e_conv);
17253 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17254 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
17255 return (int64_t)ret_conv;
17258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17259 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
17260 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
17264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17265 if ((_res & 1) != 0) return;
17266 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17267 CHECK_ACCESS(_res_ptr);
17268 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
17270 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
17273 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17274 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17275 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
17276 return (int64_t)ret_conv;
17278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17279 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
17280 int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17285 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
17286 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17287 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
17288 return (int64_t)ret_conv;
17291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17293 o_conv.inner = (void*)(o & (~1));
17294 o_conv.is_owned = (o & 1) || (o == 0);
17295 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17296 o_conv = NodeId_clone(&o_conv);
17297 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17298 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
17299 return (int64_t)ret_conv;
17302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17303 LDKDecodeError e_conv;
17304 e_conv.inner = (void*)(e & (~1));
17305 e_conv.is_owned = (e & 1) || (e == 0);
17306 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17307 e_conv = DecodeError_clone(&e_conv);
17308 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17309 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
17310 return (int64_t)ret_conv;
17313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17314 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
17315 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
17319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17320 if ((_res & 1) != 0) return;
17321 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17322 CHECK_ACCESS(_res_ptr);
17323 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
17325 CResult_NodeIdDecodeErrorZ_free(_res_conv);
17328 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
17329 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17330 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
17331 return (int64_t)ret_conv;
17333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17334 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
17335 int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
17339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17340 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
17341 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17342 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
17343 return (int64_t)ret_conv;
17346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17347 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17348 CHECK_ACCESS(o_ptr);
17349 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
17350 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
17351 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17352 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
17353 return (int64_t)ret_conv;
17356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17357 LDKDecodeError e_conv;
17358 e_conv.inner = (void*)(e & (~1));
17359 e_conv.is_owned = (e & 1) || (e == 0);
17360 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17361 e_conv = DecodeError_clone(&e_conv);
17362 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17363 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
17364 return (int64_t)ret_conv;
17367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17368 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
17369 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
17373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17374 if ((_res & 1) != 0) return;
17375 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17376 CHECK_ACCESS(_res_ptr);
17377 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
17379 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
17382 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
17383 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17384 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
17385 return (int64_t)ret_conv;
17387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17388 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
17389 int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
17393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17394 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
17395 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17396 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
17397 return (int64_t)ret_conv;
17400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17401 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17402 CHECK_ACCESS(o_ptr);
17403 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
17404 if (o_conv.free == LDKAccess_JCalls_free) {
17405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17406 LDKAccess_JCalls_cloned(&o_conv);
17408 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17409 *ret_copy = COption_AccessZ_some(o_conv);
17410 int64_t ret_ref = (uintptr_t)ret_copy;
17414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
17415 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17416 *ret_copy = COption_AccessZ_none();
17417 int64_t ret_ref = (uintptr_t)ret_copy;
17421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17422 if ((_res & 1) != 0) return;
17423 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17424 CHECK_ACCESS(_res_ptr);
17425 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
17427 COption_AccessZ_free(_res_conv);
17430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17431 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17432 *ret_conv = CResult_boolLightningErrorZ_ok(o);
17433 return (int64_t)ret_conv;
17436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17437 LDKLightningError e_conv;
17438 e_conv.inner = (void*)(e & (~1));
17439 e_conv.is_owned = (e & 1) || (e == 0);
17440 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17441 e_conv = LightningError_clone(&e_conv);
17442 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17443 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
17444 return (int64_t)ret_conv;
17447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17448 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
17449 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
17453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17454 if ((_res & 1) != 0) return;
17455 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17456 CHECK_ACCESS(_res_ptr);
17457 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
17459 CResult_boolLightningErrorZ_free(_res_conv);
17462 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
17463 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17464 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
17465 return (int64_t)ret_conv;
17467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17468 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
17469 int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
17473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17474 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
17475 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17476 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
17477 return (int64_t)ret_conv;
17480 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
17481 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17482 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
17483 return ((int64_t)ret_conv);
17485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17486 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
17487 int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
17491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17492 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
17493 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17494 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
17495 return ((int64_t)ret_conv);
17498 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) {
17499 LDKChannelAnnouncement a_conv;
17500 a_conv.inner = (void*)(a & (~1));
17501 a_conv.is_owned = (a & 1) || (a == 0);
17502 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17503 a_conv = ChannelAnnouncement_clone(&a_conv);
17504 LDKChannelUpdate b_conv;
17505 b_conv.inner = (void*)(b & (~1));
17506 b_conv.is_owned = (b & 1) || (b == 0);
17507 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17508 b_conv = ChannelUpdate_clone(&b_conv);
17509 LDKChannelUpdate c_conv;
17510 c_conv.inner = (void*)(c & (~1));
17511 c_conv.is_owned = (c & 1) || (c == 0);
17512 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17513 c_conv = ChannelUpdate_clone(&c_conv);
17514 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17515 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
17516 return ((int64_t)ret_conv);
17519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17520 if ((_res & 1) != 0) return;
17521 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17522 CHECK_ACCESS(_res_ptr);
17523 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
17525 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
17528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17529 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
17530 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17531 if (_res_constr.datalen > 0)
17532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
17534 _res_constr.data = NULL;
17535 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17536 for (size_t h = 0; h < _res_constr.datalen; h++) {
17537 int64_t _res_conv_59 = _res_vals[h];
17538 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
17539 CHECK_ACCESS(_res_conv_59_ptr);
17540 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
17541 FREE((void*)_res_conv_59);
17542 _res_constr.data[h] = _res_conv_59_conv;
17544 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17545 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
17548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17549 LDKCVec_NodeAnnouncementZ _res_constr;
17550 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17551 if (_res_constr.datalen > 0)
17552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
17554 _res_constr.data = NULL;
17555 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17556 for (size_t s = 0; s < _res_constr.datalen; s++) {
17557 int64_t _res_conv_18 = _res_vals[s];
17558 LDKNodeAnnouncement _res_conv_18_conv;
17559 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
17560 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
17561 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
17562 _res_constr.data[s] = _res_conv_18_conv;
17564 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17565 CVec_NodeAnnouncementZ_free(_res_constr);
17568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
17569 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17570 *ret_conv = CResult_NoneLightningErrorZ_ok();
17571 return (int64_t)ret_conv;
17574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17575 LDKLightningError e_conv;
17576 e_conv.inner = (void*)(e & (~1));
17577 e_conv.is_owned = (e & 1) || (e == 0);
17578 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17579 e_conv = LightningError_clone(&e_conv);
17580 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17581 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
17582 return (int64_t)ret_conv;
17585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17586 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
17587 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
17591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17592 if ((_res & 1) != 0) return;
17593 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17594 CHECK_ACCESS(_res_ptr);
17595 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
17597 CResult_NoneLightningErrorZ_free(_res_conv);
17600 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
17601 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17602 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
17603 return (int64_t)ret_conv;
17605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17606 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
17607 int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
17611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17612 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
17613 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17614 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
17615 return (int64_t)ret_conv;
17618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17619 LDKChannelUpdateInfo o_conv;
17620 o_conv.inner = (void*)(o & (~1));
17621 o_conv.is_owned = (o & 1) || (o == 0);
17622 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17623 o_conv = ChannelUpdateInfo_clone(&o_conv);
17624 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17625 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
17626 return (int64_t)ret_conv;
17629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17630 LDKDecodeError e_conv;
17631 e_conv.inner = (void*)(e & (~1));
17632 e_conv.is_owned = (e & 1) || (e == 0);
17633 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17634 e_conv = DecodeError_clone(&e_conv);
17635 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17636 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
17637 return (int64_t)ret_conv;
17640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17641 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
17642 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
17646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17647 if ((_res & 1) != 0) return;
17648 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17649 CHECK_ACCESS(_res_ptr);
17650 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
17652 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
17655 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
17656 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17657 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
17658 return (int64_t)ret_conv;
17660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17661 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
17662 int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
17666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17667 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
17668 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17669 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
17670 return (int64_t)ret_conv;
17673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17674 LDKChannelInfo o_conv;
17675 o_conv.inner = (void*)(o & (~1));
17676 o_conv.is_owned = (o & 1) || (o == 0);
17677 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17678 o_conv = ChannelInfo_clone(&o_conv);
17679 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17680 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
17681 return (int64_t)ret_conv;
17684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17685 LDKDecodeError e_conv;
17686 e_conv.inner = (void*)(e & (~1));
17687 e_conv.is_owned = (e & 1) || (e == 0);
17688 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17689 e_conv = DecodeError_clone(&e_conv);
17690 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17691 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
17692 return (int64_t)ret_conv;
17695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17696 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
17697 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
17701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17702 if ((_res & 1) != 0) return;
17703 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17704 CHECK_ACCESS(_res_ptr);
17705 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
17707 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
17710 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17711 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17712 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
17713 return (int64_t)ret_conv;
17715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17716 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
17717 int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17722 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
17723 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17724 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
17725 return (int64_t)ret_conv;
17728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17729 LDKRoutingFees o_conv;
17730 o_conv.inner = (void*)(o & (~1));
17731 o_conv.is_owned = (o & 1) || (o == 0);
17732 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17733 o_conv = RoutingFees_clone(&o_conv);
17734 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17735 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
17736 return (int64_t)ret_conv;
17739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17740 LDKDecodeError e_conv;
17741 e_conv.inner = (void*)(e & (~1));
17742 e_conv.is_owned = (e & 1) || (e == 0);
17743 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17744 e_conv = DecodeError_clone(&e_conv);
17745 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17746 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
17747 return (int64_t)ret_conv;
17750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17751 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
17752 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
17756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17757 if ((_res & 1) != 0) return;
17758 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17759 CHECK_ACCESS(_res_ptr);
17760 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
17762 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
17765 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
17766 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17767 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
17768 return (int64_t)ret_conv;
17770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17771 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
17772 int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
17776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17777 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
17778 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17779 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
17780 return (int64_t)ret_conv;
17783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17784 LDKCVec_NetAddressZ _res_constr;
17785 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17786 if (_res_constr.datalen > 0)
17787 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17789 _res_constr.data = NULL;
17790 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17791 for (size_t m = 0; m < _res_constr.datalen; m++) {
17792 int64_t _res_conv_12 = _res_vals[m];
17793 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17794 CHECK_ACCESS(_res_conv_12_ptr);
17795 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17796 FREE((void*)_res_conv_12);
17797 _res_constr.data[m] = _res_conv_12_conv;
17799 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17800 CVec_NetAddressZ_free(_res_constr);
17803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17804 LDKNodeAnnouncementInfo o_conv;
17805 o_conv.inner = (void*)(o & (~1));
17806 o_conv.is_owned = (o & 1) || (o == 0);
17807 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17808 o_conv = NodeAnnouncementInfo_clone(&o_conv);
17809 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17810 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
17811 return (int64_t)ret_conv;
17814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17815 LDKDecodeError e_conv;
17816 e_conv.inner = (void*)(e & (~1));
17817 e_conv.is_owned = (e & 1) || (e == 0);
17818 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17819 e_conv = DecodeError_clone(&e_conv);
17820 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17821 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
17822 return (int64_t)ret_conv;
17825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17826 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
17827 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
17831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17832 if ((_res & 1) != 0) return;
17833 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17834 CHECK_ACCESS(_res_ptr);
17835 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
17837 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
17840 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17841 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17842 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17843 return (int64_t)ret_conv;
17845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17846 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
17847 int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17852 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
17853 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17854 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17855 return (int64_t)ret_conv;
17858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17859 LDKNodeAlias o_conv;
17860 o_conv.inner = (void*)(o & (~1));
17861 o_conv.is_owned = (o & 1) || (o == 0);
17862 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17863 o_conv = NodeAlias_clone(&o_conv);
17864 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17865 *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
17866 return (int64_t)ret_conv;
17869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17870 LDKDecodeError e_conv;
17871 e_conv.inner = (void*)(e & (~1));
17872 e_conv.is_owned = (e & 1) || (e == 0);
17873 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17874 e_conv = DecodeError_clone(&e_conv);
17875 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17876 *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
17877 return (int64_t)ret_conv;
17880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17881 LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(o & ~1);
17882 jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
17886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17887 if ((_res & 1) != 0) return;
17888 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17889 CHECK_ACCESS(_res_ptr);
17890 LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
17892 CResult_NodeAliasDecodeErrorZ_free(_res_conv);
17895 static inline uintptr_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
17896 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17897 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
17898 return (int64_t)ret_conv;
17900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17901 LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(arg & ~1);
17902 int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
17906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17907 LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(orig & ~1);
17908 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17909 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
17910 return (int64_t)ret_conv;
17913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17914 LDKCVec_u64Z _res_constr;
17915 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17916 if (_res_constr.datalen > 0)
17917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17919 _res_constr.data = NULL;
17920 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17921 for (size_t g = 0; g < _res_constr.datalen; g++) {
17922 int64_t _res_conv_6 = _res_vals[g];
17923 _res_constr.data[g] = _res_conv_6;
17925 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17926 CVec_u64Z_free(_res_constr);
17929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17930 LDKNodeInfo o_conv;
17931 o_conv.inner = (void*)(o & (~1));
17932 o_conv.is_owned = (o & 1) || (o == 0);
17933 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17934 o_conv = NodeInfo_clone(&o_conv);
17935 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17936 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17937 return (int64_t)ret_conv;
17940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17941 LDKDecodeError e_conv;
17942 e_conv.inner = (void*)(e & (~1));
17943 e_conv.is_owned = (e & 1) || (e == 0);
17944 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17945 e_conv = DecodeError_clone(&e_conv);
17946 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17947 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17948 return (int64_t)ret_conv;
17951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17952 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
17953 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17958 if ((_res & 1) != 0) return;
17959 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17960 CHECK_ACCESS(_res_ptr);
17961 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17963 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17966 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17967 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17968 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17969 return (int64_t)ret_conv;
17971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17972 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
17973 int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17978 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
17979 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17980 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17981 return (int64_t)ret_conv;
17984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17985 LDKNetworkGraph o_conv;
17986 o_conv.inner = (void*)(o & (~1));
17987 o_conv.is_owned = (o & 1) || (o == 0);
17988 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17989 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
17990 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17991 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17992 return (int64_t)ret_conv;
17995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17996 LDKDecodeError e_conv;
17997 e_conv.inner = (void*)(e & (~1));
17998 e_conv.is_owned = (e & 1) || (e == 0);
17999 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18000 e_conv = DecodeError_clone(&e_conv);
18001 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18002 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
18003 return (int64_t)ret_conv;
18006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18007 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
18008 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
18012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18013 if ((_res & 1) != 0) return;
18014 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18015 CHECK_ACCESS(_res_ptr);
18016 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
18018 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
18022 LDKCVec_NetAddressZ o_constr;
18023 o_constr.datalen = (*env)->GetArrayLength(env, o);
18024 if (o_constr.datalen > 0)
18025 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18027 o_constr.data = NULL;
18028 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18029 for (size_t m = 0; m < o_constr.datalen; m++) {
18030 int64_t o_conv_12 = o_vals[m];
18031 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
18032 CHECK_ACCESS(o_conv_12_ptr);
18033 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
18034 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
18035 o_constr.data[m] = o_conv_12_conv;
18037 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18038 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18039 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
18040 int64_t ret_ref = (uintptr_t)ret_copy;
18044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
18045 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18046 *ret_copy = COption_CVec_NetAddressZZ_none();
18047 int64_t ret_ref = (uintptr_t)ret_copy;
18051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18052 if ((_res & 1) != 0) return;
18053 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18054 CHECK_ACCESS(_res_ptr);
18055 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
18057 COption_CVec_NetAddressZZ_free(_res_conv);
18060 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
18061 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18062 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
18063 int64_t ret_ref = (uintptr_t)ret_copy;
18066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18067 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
18068 int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
18072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18073 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
18074 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18075 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
18076 int64_t ret_ref = (uintptr_t)ret_copy;
18080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18081 LDKDelayedPaymentOutputDescriptor o_conv;
18082 o_conv.inner = (void*)(o & (~1));
18083 o_conv.is_owned = (o & 1) || (o == 0);
18084 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18085 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
18086 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18087 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18088 return (int64_t)ret_conv;
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18092 LDKDecodeError e_conv;
18093 e_conv.inner = (void*)(e & (~1));
18094 e_conv.is_owned = (e & 1) || (e == 0);
18095 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18096 e_conv = DecodeError_clone(&e_conv);
18097 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18098 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18099 return (int64_t)ret_conv;
18102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18103 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18104 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18109 if ((_res & 1) != 0) return;
18110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18111 CHECK_ACCESS(_res_ptr);
18112 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18114 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18117 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18118 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18119 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18120 return (int64_t)ret_conv;
18122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18123 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18124 int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18129 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18130 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18131 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18132 return (int64_t)ret_conv;
18135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18136 LDKStaticPaymentOutputDescriptor o_conv;
18137 o_conv.inner = (void*)(o & (~1));
18138 o_conv.is_owned = (o & 1) || (o == 0);
18139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18140 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
18141 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18142 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18143 return (int64_t)ret_conv;
18146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18147 LDKDecodeError e_conv;
18148 e_conv.inner = (void*)(e & (~1));
18149 e_conv.is_owned = (e & 1) || (e == 0);
18150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18151 e_conv = DecodeError_clone(&e_conv);
18152 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18153 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18154 return (int64_t)ret_conv;
18157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18158 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18159 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18164 if ((_res & 1) != 0) return;
18165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18166 CHECK_ACCESS(_res_ptr);
18167 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18169 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18172 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18173 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18174 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18175 return (int64_t)ret_conv;
18177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18178 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18179 int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18184 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18185 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18186 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18187 return (int64_t)ret_conv;
18190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18191 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18192 CHECK_ACCESS(o_ptr);
18193 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
18194 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
18195 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18196 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
18197 return (int64_t)ret_conv;
18200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18201 LDKDecodeError e_conv;
18202 e_conv.inner = (void*)(e & (~1));
18203 e_conv.is_owned = (e & 1) || (e == 0);
18204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18205 e_conv = DecodeError_clone(&e_conv);
18206 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18207 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
18208 return (int64_t)ret_conv;
18211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18212 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
18213 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18218 if ((_res & 1) != 0) return;
18219 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18220 CHECK_ACCESS(_res_ptr);
18221 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
18223 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
18226 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18227 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18228 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
18229 return (int64_t)ret_conv;
18231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18232 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
18233 int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18238 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
18239 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18240 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
18241 return (int64_t)ret_conv;
18244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18245 LDKCVec_PaymentPreimageZ _res_constr;
18246 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18247 if (_res_constr.datalen > 0)
18248 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
18250 _res_constr.data = NULL;
18251 for (size_t i = 0; i < _res_constr.datalen; i++) {
18252 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18253 LDKThirtyTwoBytes _res_conv_8_ref;
18254 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18255 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18256 _res_constr.data[i] = _res_conv_8_ref;
18258 CVec_PaymentPreimageZ_free(_res_constr);
18261 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
18262 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18263 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
18264 return ((int64_t)ret_conv);
18266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18267 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
18268 int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
18272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18273 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
18274 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18275 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
18276 return ((int64_t)ret_conv);
18279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
18280 LDKSignature a_ref;
18281 CHECK((*env)->GetArrayLength(env, a) == 64);
18282 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18283 LDKCVec_SignatureZ b_constr;
18284 b_constr.datalen = (*env)->GetArrayLength(env, b);
18285 if (b_constr.datalen > 0)
18286 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18288 b_constr.data = NULL;
18289 for (size_t i = 0; i < b_constr.datalen; i++) {
18290 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
18291 LDKSignature b_conv_8_ref;
18292 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
18293 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
18294 b_constr.data[i] = b_conv_8_ref;
18296 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18297 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
18298 return ((int64_t)ret_conv);
18301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18302 if ((_res & 1) != 0) return;
18303 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18304 CHECK_ACCESS(_res_ptr);
18305 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
18307 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
18310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18311 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18312 CHECK_ACCESS(o_ptr);
18313 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
18314 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
18315 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18316 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
18317 return (int64_t)ret_conv;
18320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
18321 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18322 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
18323 return (int64_t)ret_conv;
18326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18327 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
18328 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
18332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18333 if ((_res & 1) != 0) return;
18334 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18335 CHECK_ACCESS(_res_ptr);
18336 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
18338 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
18341 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
18342 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18343 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
18344 return (int64_t)ret_conv;
18346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18347 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
18348 int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
18352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18353 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
18354 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18355 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
18356 return (int64_t)ret_conv;
18359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18360 LDKSignature o_ref;
18361 CHECK((*env)->GetArrayLength(env, o) == 64);
18362 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
18363 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18364 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
18365 return (int64_t)ret_conv;
18368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18369 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18370 *ret_conv = CResult_SignatureNoneZ_err();
18371 return (int64_t)ret_conv;
18374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18375 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
18376 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
18380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18381 if ((_res & 1) != 0) return;
18382 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18383 CHECK_ACCESS(_res_ptr);
18384 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
18386 CResult_SignatureNoneZ_free(_res_conv);
18389 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
18390 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18391 *ret_conv = CResult_SignatureNoneZ_clone(arg);
18392 return (int64_t)ret_conv;
18394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18395 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
18396 int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
18400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18401 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
18402 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18403 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
18404 return (int64_t)ret_conv;
18407 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
18408 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18409 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
18410 return ((int64_t)ret_conv);
18412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18413 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
18414 int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
18418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18419 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
18420 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18421 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
18422 return ((int64_t)ret_conv);
18425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18426 LDKSignature a_ref;
18427 CHECK((*env)->GetArrayLength(env, a) == 64);
18428 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18429 LDKSignature b_ref;
18430 CHECK((*env)->GetArrayLength(env, b) == 64);
18431 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
18432 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18433 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
18434 return ((int64_t)ret_conv);
18437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18438 if ((_res & 1) != 0) return;
18439 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18440 CHECK_ACCESS(_res_ptr);
18441 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
18443 C2Tuple_SignatureSignatureZ_free(_res_conv);
18446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18447 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18448 CHECK_ACCESS(o_ptr);
18449 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
18450 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
18451 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18452 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
18453 return (int64_t)ret_conv;
18456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
18457 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18458 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
18459 return (int64_t)ret_conv;
18462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18463 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
18464 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
18468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18469 if ((_res & 1) != 0) return;
18470 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18471 CHECK_ACCESS(_res_ptr);
18472 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
18474 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
18477 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
18478 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18479 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
18480 return (int64_t)ret_conv;
18482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18483 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
18484 int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
18488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18489 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
18490 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18491 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
18492 return (int64_t)ret_conv;
18495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18496 LDKSecretKey o_ref;
18497 CHECK((*env)->GetArrayLength(env, o) == 32);
18498 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
18499 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18500 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
18501 return (int64_t)ret_conv;
18504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
18505 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18506 *ret_conv = CResult_SecretKeyNoneZ_err();
18507 return (int64_t)ret_conv;
18510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18511 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
18512 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
18516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18517 if ((_res & 1) != 0) return;
18518 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18519 CHECK_ACCESS(_res_ptr);
18520 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
18522 CResult_SecretKeyNoneZ_free(_res_conv);
18525 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
18526 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18527 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
18528 return (int64_t)ret_conv;
18530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18531 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
18532 int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
18536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18537 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
18538 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18539 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
18540 return (int64_t)ret_conv;
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18544 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18545 CHECK_ACCESS(o_ptr);
18546 LDKSign o_conv = *(LDKSign*)(o_ptr);
18547 if (o_conv.free == LDKSign_JCalls_free) {
18548 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18549 LDKSign_JCalls_cloned(&o_conv);
18551 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18552 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
18553 return (int64_t)ret_conv;
18556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18557 LDKDecodeError e_conv;
18558 e_conv.inner = (void*)(e & (~1));
18559 e_conv.is_owned = (e & 1) || (e == 0);
18560 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18561 e_conv = DecodeError_clone(&e_conv);
18562 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18563 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
18564 return (int64_t)ret_conv;
18567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18568 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
18569 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
18573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18574 if ((_res & 1) != 0) return;
18575 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18576 CHECK_ACCESS(_res_ptr);
18577 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
18579 CResult_SignDecodeErrorZ_free(_res_conv);
18582 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
18583 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18584 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
18585 return (int64_t)ret_conv;
18587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18588 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
18589 int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
18593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18594 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
18595 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18596 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
18597 return (int64_t)ret_conv;
18600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18601 LDKCVec_u5Z _res_constr;
18602 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18603 if (_res_constr.datalen > 0)
18604 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
18606 _res_constr.data = NULL;
18607 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
18608 for (size_t h = 0; h < _res_constr.datalen; h++) {
18609 int8_t _res_conv_7 = _res_vals[h];
18611 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
18613 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
18614 CVec_u5Z_free(_res_constr);
18617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18618 LDKRecoverableSignature o_ref;
18619 CHECK((*env)->GetArrayLength(env, o) == 68);
18620 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
18621 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18622 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
18623 return (int64_t)ret_conv;
18626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18627 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18628 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
18629 return (int64_t)ret_conv;
18632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18633 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
18634 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
18638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18639 if ((_res & 1) != 0) return;
18640 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18641 CHECK_ACCESS(_res_ptr);
18642 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
18644 CResult_RecoverableSignatureNoneZ_free(_res_conv);
18647 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
18648 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18649 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
18650 return (int64_t)ret_conv;
18652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18653 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
18654 int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18659 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
18660 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18661 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18662 return (int64_t)ret_conv;
18665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
18666 LDKCVec_u8Z _res_ref;
18667 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
18668 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18669 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
18670 CVec_u8Z_free(_res_ref);
18673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18674 LDKCVec_CVec_u8ZZ _res_constr;
18675 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18676 if (_res_constr.datalen > 0)
18677 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18679 _res_constr.data = NULL;
18680 for (size_t i = 0; i < _res_constr.datalen; i++) {
18681 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18682 LDKCVec_u8Z _res_conv_8_ref;
18683 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
18684 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18685 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
18686 _res_constr.data[i] = _res_conv_8_ref;
18688 CVec_CVec_u8ZZ_free(_res_constr);
18691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
18692 LDKCVec_CVec_u8ZZ o_constr;
18693 o_constr.datalen = (*env)->GetArrayLength(env, o);
18694 if (o_constr.datalen > 0)
18695 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18697 o_constr.data = NULL;
18698 for (size_t i = 0; i < o_constr.datalen; i++) {
18699 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
18700 LDKCVec_u8Z o_conv_8_ref;
18701 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
18702 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18703 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
18704 o_constr.data[i] = o_conv_8_ref;
18706 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18707 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
18708 return (int64_t)ret_conv;
18711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
18712 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18713 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
18714 return (int64_t)ret_conv;
18717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18718 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
18719 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
18723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18724 if ((_res & 1) != 0) return;
18725 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18726 CHECK_ACCESS(_res_ptr);
18727 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
18729 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
18732 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
18733 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18734 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
18735 return (int64_t)ret_conv;
18737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18738 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
18739 int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
18743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18744 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
18745 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18746 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
18747 return (int64_t)ret_conv;
18750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18751 LDKInMemorySigner o_conv;
18752 o_conv.inner = (void*)(o & (~1));
18753 o_conv.is_owned = (o & 1) || (o == 0);
18754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18755 o_conv = InMemorySigner_clone(&o_conv);
18756 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18757 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18758 return (int64_t)ret_conv;
18761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18762 LDKDecodeError e_conv;
18763 e_conv.inner = (void*)(e & (~1));
18764 e_conv.is_owned = (e & 1) || (e == 0);
18765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18766 e_conv = DecodeError_clone(&e_conv);
18767 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18768 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18769 return (int64_t)ret_conv;
18772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18773 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
18774 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18779 if ((_res & 1) != 0) return;
18780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18781 CHECK_ACCESS(_res_ptr);
18782 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18784 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18787 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18788 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18789 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18790 return (int64_t)ret_conv;
18792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18793 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
18794 int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18799 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
18800 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18801 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18802 return (int64_t)ret_conv;
18805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18806 LDKCVec_TxOutZ _res_constr;
18807 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18808 if (_res_constr.datalen > 0)
18809 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18811 _res_constr.data = NULL;
18812 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18813 for (size_t h = 0; h < _res_constr.datalen; h++) {
18814 int64_t _res_conv_7 = _res_vals[h];
18815 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
18816 CHECK_ACCESS(_res_conv_7_ptr);
18817 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
18818 FREE((void*)_res_conv_7);
18819 _res_constr.data[h] = _res_conv_7_conv;
18821 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18822 CVec_TxOutZ_free(_res_constr);
18825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18826 LDKTransaction o_ref;
18827 o_ref.datalen = (*env)->GetArrayLength(env, o);
18828 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18829 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
18830 o_ref.data_is_owned = true;
18831 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18832 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18833 return (int64_t)ret_conv;
18836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
18837 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18838 *ret_conv = CResult_TransactionNoneZ_err();
18839 return (int64_t)ret_conv;
18842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18843 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
18844 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18849 if ((_res & 1) != 0) return;
18850 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18851 CHECK_ACCESS(_res_ptr);
18852 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18854 CResult_TransactionNoneZ_free(_res_conv);
18857 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18858 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18859 *ret_conv = CResult_TransactionNoneZ_clone(arg);
18860 return (int64_t)ret_conv;
18862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18863 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
18864 int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18869 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
18870 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18871 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18872 return (int64_t)ret_conv;
18875 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18876 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18877 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18878 return ((int64_t)ret_conv);
18880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18881 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
18882 int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18887 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
18888 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18889 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18890 return ((int64_t)ret_conv);
18893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18894 LDKThirtyTwoBytes a_ref;
18895 CHECK((*env)->GetArrayLength(env, a) == 32);
18896 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18897 LDKChannelMonitor b_conv;
18898 b_conv.inner = (void*)(b & (~1));
18899 b_conv.is_owned = (b & 1) || (b == 0);
18900 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18901 b_conv = ChannelMonitor_clone(&b_conv);
18902 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18903 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18904 return ((int64_t)ret_conv);
18907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18908 if ((_res & 1) != 0) return;
18909 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18910 CHECK_ACCESS(_res_ptr);
18911 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18913 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18917 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
18918 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18919 if (_res_constr.datalen > 0)
18920 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18922 _res_constr.data = NULL;
18923 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18924 for (size_t j = 0; j < _res_constr.datalen; j++) {
18925 int64_t _res_conv_35 = _res_vals[j];
18926 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
18927 CHECK_ACCESS(_res_conv_35_ptr);
18928 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
18929 FREE((void*)_res_conv_35);
18930 _res_constr.data[j] = _res_conv_35_conv;
18932 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18933 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
18936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
18937 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
18938 o_constr.datalen = (*env)->GetArrayLength(env, o);
18939 if (o_constr.datalen > 0)
18940 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18942 o_constr.data = NULL;
18943 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18944 for (size_t j = 0; j < o_constr.datalen; j++) {
18945 int64_t o_conv_35 = o_vals[j];
18946 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
18947 CHECK_ACCESS(o_conv_35_ptr);
18948 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
18949 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
18950 o_constr.data[j] = o_conv_35_conv;
18952 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18953 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18954 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
18955 return (int64_t)ret_conv;
18958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18959 LDKIOError e_conv = LDKIOError_from_java(env, e);
18960 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18961 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
18962 return (int64_t)ret_conv;
18965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18966 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
18967 jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
18971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18972 if ((_res & 1) != 0) return;
18973 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18974 CHECK_ACCESS(_res_ptr);
18975 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
18977 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
18980 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
18981 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18982 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
18983 return (int64_t)ret_conv;
18985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18986 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
18987 int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
18991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18992 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
18993 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18994 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
18995 return (int64_t)ret_conv;
18998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
18999 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19000 *ret_copy = COption_u16Z_some(o);
19001 int64_t ret_ref = (uintptr_t)ret_copy;
19005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
19006 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19007 *ret_copy = COption_u16Z_none();
19008 int64_t ret_ref = (uintptr_t)ret_copy;
19012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19013 if ((_res & 1) != 0) return;
19014 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19015 CHECK_ACCESS(_res_ptr);
19016 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
19018 COption_u16Z_free(_res_conv);
19021 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
19022 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19023 *ret_copy = COption_u16Z_clone(arg);
19024 int64_t ret_ref = (uintptr_t)ret_copy;
19027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19028 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
19029 int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19034 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
19035 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19036 *ret_copy = COption_u16Z_clone(orig_conv);
19037 int64_t ret_ref = (uintptr_t)ret_copy;
19041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19042 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19043 *ret_conv = CResult_NoneAPIErrorZ_ok();
19044 return (int64_t)ret_conv;
19047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19048 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19049 CHECK_ACCESS(e_ptr);
19050 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19051 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19052 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19053 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19054 return (int64_t)ret_conv;
19057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19058 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
19059 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19064 if ((_res & 1) != 0) return;
19065 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19066 CHECK_ACCESS(_res_ptr);
19067 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19069 CResult_NoneAPIErrorZ_free(_res_conv);
19072 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19073 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19074 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19075 return (int64_t)ret_conv;
19077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19078 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
19079 int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19084 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
19085 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19086 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19087 return (int64_t)ret_conv;
19090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19091 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19092 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19093 if (_res_constr.datalen > 0)
19094 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19096 _res_constr.data = NULL;
19097 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19098 for (size_t w = 0; w < _res_constr.datalen; w++) {
19099 int64_t _res_conv_22 = _res_vals[w];
19100 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
19101 CHECK_ACCESS(_res_conv_22_ptr);
19102 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19103 FREE((void*)_res_conv_22);
19104 _res_constr.data[w] = _res_conv_22_conv;
19106 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19107 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19111 LDKCVec_APIErrorZ _res_constr;
19112 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19113 if (_res_constr.datalen > 0)
19114 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19116 _res_constr.data = NULL;
19117 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19118 for (size_t k = 0; k < _res_constr.datalen; k++) {
19119 int64_t _res_conv_10 = _res_vals[k];
19120 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
19121 CHECK_ACCESS(_res_conv_10_ptr);
19122 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19123 FREE((void*)_res_conv_10);
19124 _res_constr.data[k] = _res_conv_10_conv;
19126 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19127 CVec_APIErrorZ_free(_res_constr);
19130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19131 LDKThirtyTwoBytes o_ref;
19132 CHECK((*env)->GetArrayLength(env, o) == 32);
19133 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19134 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19135 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
19136 return (int64_t)ret_conv;
19139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19140 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19141 CHECK_ACCESS(e_ptr);
19142 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19143 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19144 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19145 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
19146 return (int64_t)ret_conv;
19149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19150 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
19151 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
19155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19156 if ((_res & 1) != 0) return;
19157 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19158 CHECK_ACCESS(_res_ptr);
19159 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
19161 CResult__u832APIErrorZ_free(_res_conv);
19164 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
19165 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19166 *ret_conv = CResult__u832APIErrorZ_clone(arg);
19167 return (int64_t)ret_conv;
19169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19170 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
19171 int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
19175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19176 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
19177 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19178 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
19179 return (int64_t)ret_conv;
19182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19183 LDKThirtyTwoBytes o_ref;
19184 CHECK((*env)->GetArrayLength(env, o) == 32);
19185 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19186 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19187 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
19188 return (int64_t)ret_conv;
19191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19192 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19193 CHECK_ACCESS(e_ptr);
19194 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19195 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19196 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19197 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
19198 return (int64_t)ret_conv;
19201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19202 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
19203 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
19207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19208 if ((_res & 1) != 0) return;
19209 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19210 CHECK_ACCESS(_res_ptr);
19211 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
19213 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
19216 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
19217 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19218 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
19219 return (int64_t)ret_conv;
19221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19222 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
19223 int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
19227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19228 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
19229 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19230 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
19231 return (int64_t)ret_conv;
19234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
19235 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19236 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
19237 return (int64_t)ret_conv;
19240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19241 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19242 CHECK_ACCESS(e_ptr);
19243 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19244 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19245 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19246 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
19247 return (int64_t)ret_conv;
19250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19251 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
19252 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
19256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19257 if ((_res & 1) != 0) return;
19258 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19259 CHECK_ACCESS(_res_ptr);
19260 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
19262 CResult_NonePaymentSendFailureZ_free(_res_conv);
19265 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
19266 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19267 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
19268 return (int64_t)ret_conv;
19270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19271 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
19272 int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
19276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19277 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
19278 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19279 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
19280 return (int64_t)ret_conv;
19283 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
19284 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19285 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
19286 return ((int64_t)ret_conv);
19288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19289 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
19290 int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
19294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19295 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
19296 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19297 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
19298 return ((int64_t)ret_conv);
19301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19302 LDKThirtyTwoBytes a_ref;
19303 CHECK((*env)->GetArrayLength(env, a) == 32);
19304 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19305 LDKThirtyTwoBytes b_ref;
19306 CHECK((*env)->GetArrayLength(env, b) == 32);
19307 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19308 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19309 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
19310 return ((int64_t)ret_conv);
19313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19314 if ((_res & 1) != 0) return;
19315 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19316 CHECK_ACCESS(_res_ptr);
19317 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
19319 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
19322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19323 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19324 CHECK_ACCESS(o_ptr);
19325 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
19326 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
19327 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19328 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
19329 return (int64_t)ret_conv;
19332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19333 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19334 CHECK_ACCESS(e_ptr);
19335 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19336 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19337 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19338 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
19339 return (int64_t)ret_conv;
19342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19343 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
19344 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
19348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19349 if ((_res & 1) != 0) return;
19350 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19351 CHECK_ACCESS(_res_ptr);
19352 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
19354 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
19357 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
19358 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19359 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
19360 return (int64_t)ret_conv;
19362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19363 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
19364 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
19368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19369 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
19370 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19371 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
19372 return (int64_t)ret_conv;
19375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19376 LDKCVec_ThirtyTwoBytesZ _res_constr;
19377 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19378 if (_res_constr.datalen > 0)
19379 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19381 _res_constr.data = NULL;
19382 for (size_t i = 0; i < _res_constr.datalen; i++) {
19383 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19384 LDKThirtyTwoBytes _res_conv_8_ref;
19385 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
19386 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
19387 _res_constr.data[i] = _res_conv_8_ref;
19389 CVec_ThirtyTwoBytesZ_free(_res_constr);
19392 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
19393 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19394 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
19395 return ((int64_t)ret_conv);
19397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19398 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
19399 int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
19403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19404 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
19405 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19406 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
19407 return ((int64_t)ret_conv);
19410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19411 LDKThirtyTwoBytes a_ref;
19412 CHECK((*env)->GetArrayLength(env, a) == 32);
19413 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19414 LDKThirtyTwoBytes b_ref;
19415 CHECK((*env)->GetArrayLength(env, b) == 32);
19416 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19417 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19418 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
19419 return ((int64_t)ret_conv);
19422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19423 if ((_res & 1) != 0) return;
19424 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19425 CHECK_ACCESS(_res_ptr);
19426 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
19428 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
19431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19432 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19433 CHECK_ACCESS(o_ptr);
19434 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19435 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19436 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19437 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
19438 return (int64_t)ret_conv;
19441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
19442 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19443 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
19444 return (int64_t)ret_conv;
19447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19448 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
19449 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
19453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19454 if ((_res & 1) != 0) return;
19455 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19456 CHECK_ACCESS(_res_ptr);
19457 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
19459 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
19462 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
19463 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19464 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
19465 return (int64_t)ret_conv;
19467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19468 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
19469 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
19473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19474 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
19475 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19476 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
19477 return (int64_t)ret_conv;
19480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19481 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19482 CHECK_ACCESS(o_ptr);
19483 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19484 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19485 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19486 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
19487 return (int64_t)ret_conv;
19490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19491 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19492 CHECK_ACCESS(e_ptr);
19493 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19494 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19495 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19496 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
19497 return (int64_t)ret_conv;
19500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19501 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
19502 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
19506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19507 if ((_res & 1) != 0) return;
19508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19509 CHECK_ACCESS(_res_ptr);
19510 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
19512 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
19515 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
19516 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19517 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
19518 return (int64_t)ret_conv;
19520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19521 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
19522 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
19526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19527 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
19528 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19529 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
19530 return (int64_t)ret_conv;
19533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19534 LDKThirtyTwoBytes o_ref;
19535 CHECK((*env)->GetArrayLength(env, o) == 32);
19536 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19537 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19538 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
19539 return (int64_t)ret_conv;
19542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
19543 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19544 *ret_conv = CResult_PaymentSecretNoneZ_err();
19545 return (int64_t)ret_conv;
19548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19549 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
19550 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
19554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19555 if ((_res & 1) != 0) return;
19556 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19557 CHECK_ACCESS(_res_ptr);
19558 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
19560 CResult_PaymentSecretNoneZ_free(_res_conv);
19563 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
19564 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19565 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
19566 return (int64_t)ret_conv;
19568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19569 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
19570 int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
19574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19575 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
19576 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19577 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
19578 return (int64_t)ret_conv;
19581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19582 LDKThirtyTwoBytes o_ref;
19583 CHECK((*env)->GetArrayLength(env, o) == 32);
19584 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19585 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19586 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
19587 return (int64_t)ret_conv;
19590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19591 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19592 CHECK_ACCESS(e_ptr);
19593 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19594 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19595 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19596 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
19597 return (int64_t)ret_conv;
19600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19601 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
19602 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
19606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19607 if ((_res & 1) != 0) return;
19608 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19609 CHECK_ACCESS(_res_ptr);
19610 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
19612 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
19615 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
19616 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19617 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
19618 return (int64_t)ret_conv;
19620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19621 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
19622 int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
19626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19627 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
19628 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19629 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
19630 return (int64_t)ret_conv;
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19634 LDKThirtyTwoBytes o_ref;
19635 CHECK((*env)->GetArrayLength(env, o) == 32);
19636 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19637 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19638 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
19639 return (int64_t)ret_conv;
19642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19643 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19644 CHECK_ACCESS(e_ptr);
19645 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19646 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19647 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19648 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
19649 return (int64_t)ret_conv;
19652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19653 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
19654 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
19658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19659 if ((_res & 1) != 0) return;
19660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19661 CHECK_ACCESS(_res_ptr);
19662 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
19664 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
19667 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
19668 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19669 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
19670 return (int64_t)ret_conv;
19672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19673 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
19674 int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
19678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19679 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
19680 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19681 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
19682 return (int64_t)ret_conv;
19685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19686 LDKCounterpartyForwardingInfo o_conv;
19687 o_conv.inner = (void*)(o & (~1));
19688 o_conv.is_owned = (o & 1) || (o == 0);
19689 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19690 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
19691 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19692 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
19693 return (int64_t)ret_conv;
19696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19697 LDKDecodeError e_conv;
19698 e_conv.inner = (void*)(e & (~1));
19699 e_conv.is_owned = (e & 1) || (e == 0);
19700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19701 e_conv = DecodeError_clone(&e_conv);
19702 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19703 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
19704 return (int64_t)ret_conv;
19707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19708 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
19709 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
19713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19714 if ((_res & 1) != 0) return;
19715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19716 CHECK_ACCESS(_res_ptr);
19717 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
19719 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
19722 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
19723 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19724 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
19725 return (int64_t)ret_conv;
19727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19728 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
19729 int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
19733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19734 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
19735 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19736 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
19737 return (int64_t)ret_conv;
19740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19741 LDKChannelCounterparty o_conv;
19742 o_conv.inner = (void*)(o & (~1));
19743 o_conv.is_owned = (o & 1) || (o == 0);
19744 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19745 o_conv = ChannelCounterparty_clone(&o_conv);
19746 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19747 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
19748 return (int64_t)ret_conv;
19751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19752 LDKDecodeError e_conv;
19753 e_conv.inner = (void*)(e & (~1));
19754 e_conv.is_owned = (e & 1) || (e == 0);
19755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19756 e_conv = DecodeError_clone(&e_conv);
19757 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19758 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
19759 return (int64_t)ret_conv;
19762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19763 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
19764 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
19768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19769 if ((_res & 1) != 0) return;
19770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19771 CHECK_ACCESS(_res_ptr);
19772 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
19774 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
19777 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
19778 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19779 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
19780 return (int64_t)ret_conv;
19782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19783 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
19784 int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
19788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19789 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
19790 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19791 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
19792 return (int64_t)ret_conv;
19795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19796 LDKChannelDetails o_conv;
19797 o_conv.inner = (void*)(o & (~1));
19798 o_conv.is_owned = (o & 1) || (o == 0);
19799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19800 o_conv = ChannelDetails_clone(&o_conv);
19801 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19802 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
19803 return (int64_t)ret_conv;
19806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19807 LDKDecodeError e_conv;
19808 e_conv.inner = (void*)(e & (~1));
19809 e_conv.is_owned = (e & 1) || (e == 0);
19810 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19811 e_conv = DecodeError_clone(&e_conv);
19812 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19813 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
19814 return (int64_t)ret_conv;
19817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19818 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
19819 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
19823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19824 if ((_res & 1) != 0) return;
19825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19826 CHECK_ACCESS(_res_ptr);
19827 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
19829 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
19832 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
19833 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19834 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
19835 return (int64_t)ret_conv;
19837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19838 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
19839 int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
19843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19844 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
19845 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19846 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
19847 return (int64_t)ret_conv;
19850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19851 LDKPhantomRouteHints o_conv;
19852 o_conv.inner = (void*)(o & (~1));
19853 o_conv.is_owned = (o & 1) || (o == 0);
19854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19855 o_conv = PhantomRouteHints_clone(&o_conv);
19856 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19857 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
19858 return (int64_t)ret_conv;
19861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19862 LDKDecodeError e_conv;
19863 e_conv.inner = (void*)(e & (~1));
19864 e_conv.is_owned = (e & 1) || (e == 0);
19865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19866 e_conv = DecodeError_clone(&e_conv);
19867 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19868 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
19869 return (int64_t)ret_conv;
19872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19873 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
19874 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
19878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19879 if ((_res & 1) != 0) return;
19880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19881 CHECK_ACCESS(_res_ptr);
19882 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
19884 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
19887 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
19888 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19889 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
19890 return (int64_t)ret_conv;
19892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19893 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
19894 int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
19898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19899 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
19900 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19901 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
19902 return (int64_t)ret_conv;
19905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19906 LDKCVec_ChannelMonitorZ _res_constr;
19907 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19908 if (_res_constr.datalen > 0)
19909 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19911 _res_constr.data = NULL;
19912 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19913 for (size_t q = 0; q < _res_constr.datalen; q++) {
19914 int64_t _res_conv_16 = _res_vals[q];
19915 LDKChannelMonitor _res_conv_16_conv;
19916 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
19917 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
19918 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19919 _res_constr.data[q] = _res_conv_16_conv;
19921 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19922 CVec_ChannelMonitorZ_free(_res_constr);
19925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19926 LDKThirtyTwoBytes a_ref;
19927 CHECK((*env)->GetArrayLength(env, a) == 32);
19928 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19929 LDKChannelManager b_conv;
19930 b_conv.inner = (void*)(b & (~1));
19931 b_conv.is_owned = (b & 1) || (b == 0);
19932 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19933 // WARNING: we need a move here but no clone is available for LDKChannelManager
19934 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
19935 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
19936 return ((int64_t)ret_conv);
19939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19940 if ((_res & 1) != 0) return;
19941 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19942 CHECK_ACCESS(_res_ptr);
19943 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
19945 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
19948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19949 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19950 CHECK_ACCESS(o_ptr);
19951 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
19952 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
19953 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19954 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
19955 return (int64_t)ret_conv;
19958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19959 LDKDecodeError e_conv;
19960 e_conv.inner = (void*)(e & (~1));
19961 e_conv.is_owned = (e & 1) || (e == 0);
19962 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19963 e_conv = DecodeError_clone(&e_conv);
19964 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19965 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
19966 return (int64_t)ret_conv;
19969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19970 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
19971 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
19975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19976 if ((_res & 1) != 0) return;
19977 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19978 CHECK_ACCESS(_res_ptr);
19979 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
19981 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
19984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19985 LDKChannelConfig o_conv;
19986 o_conv.inner = (void*)(o & (~1));
19987 o_conv.is_owned = (o & 1) || (o == 0);
19988 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19989 o_conv = ChannelConfig_clone(&o_conv);
19990 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19991 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
19992 return (int64_t)ret_conv;
19995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19996 LDKDecodeError e_conv;
19997 e_conv.inner = (void*)(e & (~1));
19998 e_conv.is_owned = (e & 1) || (e == 0);
19999 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20000 e_conv = DecodeError_clone(&e_conv);
20001 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20002 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
20003 return (int64_t)ret_conv;
20006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20007 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
20008 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
20012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20013 if ((_res & 1) != 0) return;
20014 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20015 CHECK_ACCESS(_res_ptr);
20016 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
20018 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
20021 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
20022 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20023 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
20024 return (int64_t)ret_conv;
20026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20027 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
20028 int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
20032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20033 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
20034 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20035 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
20036 return (int64_t)ret_conv;
20039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20040 LDKOutPoint o_conv;
20041 o_conv.inner = (void*)(o & (~1));
20042 o_conv.is_owned = (o & 1) || (o == 0);
20043 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20044 o_conv = OutPoint_clone(&o_conv);
20045 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20046 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
20047 return (int64_t)ret_conv;
20050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20051 LDKDecodeError e_conv;
20052 e_conv.inner = (void*)(e & (~1));
20053 e_conv.is_owned = (e & 1) || (e == 0);
20054 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20055 e_conv = DecodeError_clone(&e_conv);
20056 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20057 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
20058 return (int64_t)ret_conv;
20061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20062 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
20063 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
20067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20068 if ((_res & 1) != 0) return;
20069 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20070 CHECK_ACCESS(_res_ptr);
20071 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
20073 CResult_OutPointDecodeErrorZ_free(_res_conv);
20076 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
20077 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20078 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
20079 return (int64_t)ret_conv;
20081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20082 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
20083 int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
20087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20088 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
20089 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20090 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
20091 return (int64_t)ret_conv;
20094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20095 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20096 CHECK_ACCESS(o_ptr);
20097 LDKType o_conv = *(LDKType*)(o_ptr);
20098 if (o_conv.free == LDKType_JCalls_free) {
20099 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20100 LDKType_JCalls_cloned(&o_conv);
20102 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20103 *ret_copy = COption_TypeZ_some(o_conv);
20104 int64_t ret_ref = (uintptr_t)ret_copy;
20108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
20109 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20110 *ret_copy = COption_TypeZ_none();
20111 int64_t ret_ref = (uintptr_t)ret_copy;
20115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20116 if ((_res & 1) != 0) return;
20117 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20118 CHECK_ACCESS(_res_ptr);
20119 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
20121 COption_TypeZ_free(_res_conv);
20124 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
20125 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20126 *ret_copy = COption_TypeZ_clone(arg);
20127 int64_t ret_ref = (uintptr_t)ret_copy;
20130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20131 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
20132 int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
20136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20137 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
20138 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20139 *ret_copy = COption_TypeZ_clone(orig_conv);
20140 int64_t ret_ref = (uintptr_t)ret_copy;
20144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20145 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20146 CHECK_ACCESS(o_ptr);
20147 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
20148 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
20149 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20150 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
20151 return (int64_t)ret_conv;
20154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20155 LDKDecodeError e_conv;
20156 e_conv.inner = (void*)(e & (~1));
20157 e_conv.is_owned = (e & 1) || (e == 0);
20158 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20159 e_conv = DecodeError_clone(&e_conv);
20160 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20161 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
20162 return (int64_t)ret_conv;
20165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20166 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
20167 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
20171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20172 if ((_res & 1) != 0) return;
20173 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20174 CHECK_ACCESS(_res_ptr);
20175 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
20177 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
20180 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
20181 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20182 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
20183 return (int64_t)ret_conv;
20185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20186 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
20187 int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
20191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20192 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
20193 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20194 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
20195 return (int64_t)ret_conv;
20198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20199 LDKThirtyTwoBytes o_ref;
20200 CHECK((*env)->GetArrayLength(env, o) == 32);
20201 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20202 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20203 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
20204 return (int64_t)ret_conv;
20207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20208 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20209 CHECK_ACCESS(e_ptr);
20210 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
20211 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
20212 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20213 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
20214 return (int64_t)ret_conv;
20217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20218 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
20219 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
20223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20224 if ((_res & 1) != 0) return;
20225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20226 CHECK_ACCESS(_res_ptr);
20227 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
20229 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
20232 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
20233 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20234 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
20235 return (int64_t)ret_conv;
20237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20238 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
20239 int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
20243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20244 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
20245 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20246 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
20247 return (int64_t)ret_conv;
20250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
20251 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
20252 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20253 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
20254 return (int64_t)ret_conv;
20257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20258 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20259 CHECK_ACCESS(e_ptr);
20260 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20261 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20262 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20263 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
20264 return (int64_t)ret_conv;
20267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20268 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
20269 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
20273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20274 if ((_res & 1) != 0) return;
20275 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20276 CHECK_ACCESS(_res_ptr);
20277 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
20279 CResult_SiPrefixParseErrorZ_free(_res_conv);
20282 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
20283 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20284 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
20285 return (int64_t)ret_conv;
20287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20288 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
20289 int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
20293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20294 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
20295 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20296 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
20297 return (int64_t)ret_conv;
20300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20302 o_conv.inner = (void*)(o & (~1));
20303 o_conv.is_owned = (o & 1) || (o == 0);
20304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20305 o_conv = Invoice_clone(&o_conv);
20306 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20307 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
20308 return (int64_t)ret_conv;
20311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20312 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20313 CHECK_ACCESS(e_ptr);
20314 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
20315 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
20316 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20317 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
20318 return (int64_t)ret_conv;
20321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20322 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
20323 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
20327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20328 if ((_res & 1) != 0) return;
20329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20330 CHECK_ACCESS(_res_ptr);
20331 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
20333 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
20336 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
20337 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20338 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
20339 return (int64_t)ret_conv;
20341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20342 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
20343 int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
20347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20348 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
20349 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20350 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
20351 return (int64_t)ret_conv;
20354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20355 LDKSignedRawInvoice o_conv;
20356 o_conv.inner = (void*)(o & (~1));
20357 o_conv.is_owned = (o & 1) || (o == 0);
20358 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20359 o_conv = SignedRawInvoice_clone(&o_conv);
20360 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20361 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
20362 return (int64_t)ret_conv;
20365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20366 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20367 CHECK_ACCESS(e_ptr);
20368 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20369 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20370 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20371 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
20372 return (int64_t)ret_conv;
20375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20376 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
20377 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
20381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20382 if ((_res & 1) != 0) return;
20383 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20384 CHECK_ACCESS(_res_ptr);
20385 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
20387 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
20390 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
20391 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20392 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
20393 return (int64_t)ret_conv;
20395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20396 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
20397 int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
20401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20402 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
20403 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20404 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
20405 return (int64_t)ret_conv;
20408 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
20409 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20410 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
20411 return ((int64_t)ret_conv);
20413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20414 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
20415 int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
20419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20420 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
20421 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20422 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
20423 return ((int64_t)ret_conv);
20426 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) {
20427 LDKRawInvoice a_conv;
20428 a_conv.inner = (void*)(a & (~1));
20429 a_conv.is_owned = (a & 1) || (a == 0);
20430 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20431 a_conv = RawInvoice_clone(&a_conv);
20432 LDKThirtyTwoBytes b_ref;
20433 CHECK((*env)->GetArrayLength(env, b) == 32);
20434 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20435 LDKInvoiceSignature c_conv;
20436 c_conv.inner = (void*)(c & (~1));
20437 c_conv.is_owned = (c & 1) || (c == 0);
20438 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20439 c_conv = InvoiceSignature_clone(&c_conv);
20440 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20441 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
20442 return ((int64_t)ret_conv);
20445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20446 if ((_res & 1) != 0) return;
20447 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20448 CHECK_ACCESS(_res_ptr);
20449 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
20451 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
20454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20455 LDKPayeePubKey o_conv;
20456 o_conv.inner = (void*)(o & (~1));
20457 o_conv.is_owned = (o & 1) || (o == 0);
20458 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20459 o_conv = PayeePubKey_clone(&o_conv);
20460 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20461 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
20462 return (int64_t)ret_conv;
20465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20466 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20467 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20468 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
20469 return (int64_t)ret_conv;
20472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20473 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
20474 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
20478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20479 if ((_res & 1) != 0) return;
20480 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20481 CHECK_ACCESS(_res_ptr);
20482 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
20484 CResult_PayeePubKeyErrorZ_free(_res_conv);
20487 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
20488 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20489 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
20490 return (int64_t)ret_conv;
20492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20493 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
20494 int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
20498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20499 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
20500 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20501 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
20502 return (int64_t)ret_conv;
20505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20506 LDKCVec_PrivateRouteZ _res_constr;
20507 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20508 if (_res_constr.datalen > 0)
20509 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
20511 _res_constr.data = NULL;
20512 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20513 for (size_t o = 0; o < _res_constr.datalen; o++) {
20514 int64_t _res_conv_14 = _res_vals[o];
20515 LDKPrivateRoute _res_conv_14_conv;
20516 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
20517 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
20518 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
20519 _res_constr.data[o] = _res_conv_14_conv;
20521 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20522 CVec_PrivateRouteZ_free(_res_constr);
20525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20526 LDKPositiveTimestamp o_conv;
20527 o_conv.inner = (void*)(o & (~1));
20528 o_conv.is_owned = (o & 1) || (o == 0);
20529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20530 o_conv = PositiveTimestamp_clone(&o_conv);
20531 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20532 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
20533 return (int64_t)ret_conv;
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20537 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20538 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20539 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
20540 return (int64_t)ret_conv;
20543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20544 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
20545 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
20549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20550 if ((_res & 1) != 0) return;
20551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20552 CHECK_ACCESS(_res_ptr);
20553 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
20555 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
20558 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
20559 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20560 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
20561 return (int64_t)ret_conv;
20563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20564 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
20565 int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
20569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20570 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
20571 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20572 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
20573 return (int64_t)ret_conv;
20576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
20577 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20578 *ret_conv = CResult_NoneSemanticErrorZ_ok();
20579 return (int64_t)ret_conv;
20582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20583 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
20584 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20585 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
20586 return (int64_t)ret_conv;
20589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20590 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
20591 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
20595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20596 if ((_res & 1) != 0) return;
20597 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20598 CHECK_ACCESS(_res_ptr);
20599 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
20601 CResult_NoneSemanticErrorZ_free(_res_conv);
20604 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
20605 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20606 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
20607 return (int64_t)ret_conv;
20609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20610 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
20611 int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
20615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20616 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
20617 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20618 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
20619 return (int64_t)ret_conv;
20622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20624 o_conv.inner = (void*)(o & (~1));
20625 o_conv.is_owned = (o & 1) || (o == 0);
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20627 o_conv = Invoice_clone(&o_conv);
20628 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20629 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
20630 return (int64_t)ret_conv;
20633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20634 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
20635 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20636 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
20637 return (int64_t)ret_conv;
20640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20641 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
20642 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
20646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20647 if ((_res & 1) != 0) return;
20648 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20649 CHECK_ACCESS(_res_ptr);
20650 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
20652 CResult_InvoiceSemanticErrorZ_free(_res_conv);
20655 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
20656 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20657 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
20658 return (int64_t)ret_conv;
20660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20661 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
20662 int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
20666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20667 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
20668 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20669 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
20670 return (int64_t)ret_conv;
20673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20674 LDKDescription o_conv;
20675 o_conv.inner = (void*)(o & (~1));
20676 o_conv.is_owned = (o & 1) || (o == 0);
20677 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20678 o_conv = Description_clone(&o_conv);
20679 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20680 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
20681 return (int64_t)ret_conv;
20684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20685 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20686 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20687 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
20688 return (int64_t)ret_conv;
20691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20692 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
20693 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
20697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20698 if ((_res & 1) != 0) return;
20699 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20700 CHECK_ACCESS(_res_ptr);
20701 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
20703 CResult_DescriptionCreationErrorZ_free(_res_conv);
20706 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
20707 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20708 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
20709 return (int64_t)ret_conv;
20711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20712 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
20713 int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
20717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20718 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
20719 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20720 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
20721 return (int64_t)ret_conv;
20724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20725 LDKPrivateRoute o_conv;
20726 o_conv.inner = (void*)(o & (~1));
20727 o_conv.is_owned = (o & 1) || (o == 0);
20728 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20729 o_conv = PrivateRoute_clone(&o_conv);
20730 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20731 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
20732 return (int64_t)ret_conv;
20735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20736 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20737 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20738 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
20739 return (int64_t)ret_conv;
20742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20743 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
20744 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
20748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20749 if ((_res & 1) != 0) return;
20750 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20751 CHECK_ACCESS(_res_ptr);
20752 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
20754 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
20757 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
20758 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20759 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
20760 return (int64_t)ret_conv;
20762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20763 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
20764 int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
20768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20769 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
20770 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20771 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
20772 return (int64_t)ret_conv;
20775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
20776 LDKStr o_conv = java_to_owned_str(env, o);
20777 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20778 *ret_conv = CResult_StringErrorZ_ok(o_conv);
20779 return (int64_t)ret_conv;
20782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20783 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20784 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20785 *ret_conv = CResult_StringErrorZ_err(e_conv);
20786 return (int64_t)ret_conv;
20789 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20790 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
20791 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
20795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20796 if ((_res & 1) != 0) return;
20797 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20798 CHECK_ACCESS(_res_ptr);
20799 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
20801 CResult_StringErrorZ_free(_res_conv);
20804 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
20805 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20806 *ret_conv = CResult_StringErrorZ_clone(arg);
20807 return (int64_t)ret_conv;
20809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20810 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
20811 int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
20815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20816 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
20817 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20818 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
20819 return (int64_t)ret_conv;
20822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20823 LDKChannelMonitorUpdate o_conv;
20824 o_conv.inner = (void*)(o & (~1));
20825 o_conv.is_owned = (o & 1) || (o == 0);
20826 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20827 o_conv = ChannelMonitorUpdate_clone(&o_conv);
20828 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20829 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
20830 return (int64_t)ret_conv;
20833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20834 LDKDecodeError e_conv;
20835 e_conv.inner = (void*)(e & (~1));
20836 e_conv.is_owned = (e & 1) || (e == 0);
20837 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20838 e_conv = DecodeError_clone(&e_conv);
20839 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20840 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
20841 return (int64_t)ret_conv;
20844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20845 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
20846 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
20850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20851 if ((_res & 1) != 0) return;
20852 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20853 CHECK_ACCESS(_res_ptr);
20854 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
20856 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
20859 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
20860 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20861 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
20862 return (int64_t)ret_conv;
20864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20865 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
20866 int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
20870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20871 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
20872 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20873 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
20874 return (int64_t)ret_conv;
20877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20878 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20879 CHECK_ACCESS(o_ptr);
20880 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
20881 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
20882 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20883 *ret_copy = COption_MonitorEventZ_some(o_conv);
20884 int64_t ret_ref = (uintptr_t)ret_copy;
20888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
20889 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20890 *ret_copy = COption_MonitorEventZ_none();
20891 int64_t ret_ref = (uintptr_t)ret_copy;
20895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20896 if ((_res & 1) != 0) return;
20897 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20898 CHECK_ACCESS(_res_ptr);
20899 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
20901 COption_MonitorEventZ_free(_res_conv);
20904 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
20905 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20906 *ret_copy = COption_MonitorEventZ_clone(arg);
20907 int64_t ret_ref = (uintptr_t)ret_copy;
20910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20911 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
20912 int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
20916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20917 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
20918 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20919 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
20920 int64_t ret_ref = (uintptr_t)ret_copy;
20924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20925 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20926 CHECK_ACCESS(o_ptr);
20927 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
20928 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
20929 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20930 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
20931 return (int64_t)ret_conv;
20934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20935 LDKDecodeError e_conv;
20936 e_conv.inner = (void*)(e & (~1));
20937 e_conv.is_owned = (e & 1) || (e == 0);
20938 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20939 e_conv = DecodeError_clone(&e_conv);
20940 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20941 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
20942 return (int64_t)ret_conv;
20945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20946 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
20947 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
20951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20952 if ((_res & 1) != 0) return;
20953 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20954 CHECK_ACCESS(_res_ptr);
20955 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
20957 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
20960 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
20961 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20962 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
20963 return (int64_t)ret_conv;
20965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20966 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
20967 int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
20971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20972 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
20973 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20974 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
20975 return (int64_t)ret_conv;
20978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20979 LDKHTLCUpdate o_conv;
20980 o_conv.inner = (void*)(o & (~1));
20981 o_conv.is_owned = (o & 1) || (o == 0);
20982 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20983 o_conv = HTLCUpdate_clone(&o_conv);
20984 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20985 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
20986 return (int64_t)ret_conv;
20989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20990 LDKDecodeError e_conv;
20991 e_conv.inner = (void*)(e & (~1));
20992 e_conv.is_owned = (e & 1) || (e == 0);
20993 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20994 e_conv = DecodeError_clone(&e_conv);
20995 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20996 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
20997 return (int64_t)ret_conv;
21000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21001 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
21002 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21007 if ((_res & 1) != 0) return;
21008 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21009 CHECK_ACCESS(_res_ptr);
21010 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21012 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21015 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21016 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21017 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21018 return (int64_t)ret_conv;
21020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21021 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
21022 int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21027 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
21028 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21029 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21030 return (int64_t)ret_conv;
21033 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
21034 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21035 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
21036 return ((int64_t)ret_conv);
21038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21039 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
21040 int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
21044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21045 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
21046 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21047 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
21048 return ((int64_t)ret_conv);
21051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21052 LDKOutPoint a_conv;
21053 a_conv.inner = (void*)(a & (~1));
21054 a_conv.is_owned = (a & 1) || (a == 0);
21055 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21056 a_conv = OutPoint_clone(&a_conv);
21058 b_ref.datalen = (*env)->GetArrayLength(env, b);
21059 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21060 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21061 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21062 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
21063 return ((int64_t)ret_conv);
21066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21067 if ((_res & 1) != 0) return;
21068 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21069 CHECK_ACCESS(_res_ptr);
21070 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
21072 C2Tuple_OutPointScriptZ_free(_res_conv);
21075 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
21076 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21077 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
21078 return ((int64_t)ret_conv);
21080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21081 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
21082 int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
21086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21087 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
21088 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21089 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
21090 return ((int64_t)ret_conv);
21093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
21095 b_ref.datalen = (*env)->GetArrayLength(env, b);
21096 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21097 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21098 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21099 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
21100 return ((int64_t)ret_conv);
21103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21104 if ((_res & 1) != 0) return;
21105 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21106 CHECK_ACCESS(_res_ptr);
21107 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
21109 C2Tuple_u32ScriptZ_free(_res_conv);
21112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21113 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
21114 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21115 if (_res_constr.datalen > 0)
21116 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21118 _res_constr.data = NULL;
21119 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21120 for (size_t v = 0; v < _res_constr.datalen; v++) {
21121 int64_t _res_conv_21 = _res_vals[v];
21122 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
21123 CHECK_ACCESS(_res_conv_21_ptr);
21124 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
21125 FREE((void*)_res_conv_21);
21126 _res_constr.data[v] = _res_conv_21_conv;
21128 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21129 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
21132 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
21133 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21134 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
21135 return ((int64_t)ret_conv);
21137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21138 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
21139 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
21143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21144 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
21145 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21146 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
21147 return ((int64_t)ret_conv);
21150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21151 LDKThirtyTwoBytes a_ref;
21152 CHECK((*env)->GetArrayLength(env, a) == 32);
21153 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21154 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
21155 b_constr.datalen = (*env)->GetArrayLength(env, b);
21156 if (b_constr.datalen > 0)
21157 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21159 b_constr.data = NULL;
21160 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21161 for (size_t v = 0; v < b_constr.datalen; v++) {
21162 int64_t b_conv_21 = b_vals[v];
21163 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
21164 CHECK_ACCESS(b_conv_21_ptr);
21165 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
21166 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
21167 b_constr.data[v] = b_conv_21_conv;
21169 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21170 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21171 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
21172 return ((int64_t)ret_conv);
21175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21176 if ((_res & 1) != 0) return;
21177 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21178 CHECK_ACCESS(_res_ptr);
21179 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
21181 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
21184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21185 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
21186 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21187 if (_res_constr.datalen > 0)
21188 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
21190 _res_constr.data = NULL;
21191 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21192 for (size_t o = 0; o < _res_constr.datalen; o++) {
21193 int64_t _res_conv_40 = _res_vals[o];
21194 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
21195 CHECK_ACCESS(_res_conv_40_ptr);
21196 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
21197 FREE((void*)_res_conv_40);
21198 _res_constr.data[o] = _res_conv_40_conv;
21200 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21201 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
21204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21205 LDKCVec_EventZ _res_constr;
21206 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21207 if (_res_constr.datalen > 0)
21208 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
21210 _res_constr.data = NULL;
21211 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21212 for (size_t h = 0; h < _res_constr.datalen; h++) {
21213 int64_t _res_conv_7 = _res_vals[h];
21214 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
21215 CHECK_ACCESS(_res_conv_7_ptr);
21216 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
21217 FREE((void*)_res_conv_7);
21218 _res_constr.data[h] = _res_conv_7_conv;
21220 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21221 CVec_EventZ_free(_res_constr);
21224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21225 LDKCVec_TransactionZ _res_constr;
21226 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21227 if (_res_constr.datalen > 0)
21228 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
21230 _res_constr.data = NULL;
21231 for (size_t i = 0; i < _res_constr.datalen; i++) {
21232 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21233 LDKTransaction _res_conv_8_ref;
21234 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
21235 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
21236 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
21237 _res_conv_8_ref.data_is_owned = true;
21238 _res_constr.data[i] = _res_conv_8_ref;
21240 CVec_TransactionZ_free(_res_constr);
21243 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
21244 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21245 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
21246 return ((int64_t)ret_conv);
21248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21249 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
21250 int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
21254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21255 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
21256 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21257 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
21258 return ((int64_t)ret_conv);
21261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
21262 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21263 CHECK_ACCESS(b_ptr);
21264 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
21265 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
21266 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21267 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
21268 return ((int64_t)ret_conv);
21271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21272 if ((_res & 1) != 0) return;
21273 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21274 CHECK_ACCESS(_res_ptr);
21275 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21277 C2Tuple_u32TxOutZ_free(_res_conv);
21280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21281 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21282 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21283 if (_res_constr.datalen > 0)
21284 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21286 _res_constr.data = NULL;
21287 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21288 for (size_t u = 0; u < _res_constr.datalen; u++) {
21289 int64_t _res_conv_20 = _res_vals[u];
21290 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
21291 CHECK_ACCESS(_res_conv_20_ptr);
21292 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21293 FREE((void*)_res_conv_20);
21294 _res_constr.data[u] = _res_conv_20_conv;
21296 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21297 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21300 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21301 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21302 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21303 return ((int64_t)ret_conv);
21305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21306 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
21307 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21312 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
21313 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21314 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21315 return ((int64_t)ret_conv);
21318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21319 LDKThirtyTwoBytes a_ref;
21320 CHECK((*env)->GetArrayLength(env, a) == 32);
21321 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21322 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21323 b_constr.datalen = (*env)->GetArrayLength(env, b);
21324 if (b_constr.datalen > 0)
21325 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21327 b_constr.data = NULL;
21328 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21329 for (size_t u = 0; u < b_constr.datalen; u++) {
21330 int64_t b_conv_20 = b_vals[u];
21331 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
21332 CHECK_ACCESS(b_conv_20_ptr);
21333 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21334 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
21335 b_constr.data[u] = b_conv_20_conv;
21337 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21338 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21339 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21340 return ((int64_t)ret_conv);
21343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21344 if ((_res & 1) != 0) return;
21345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21346 CHECK_ACCESS(_res_ptr);
21347 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21349 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21353 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21354 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21355 if (_res_constr.datalen > 0)
21356 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
21358 _res_constr.data = NULL;
21359 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21360 for (size_t n = 0; n < _res_constr.datalen; n++) {
21361 int64_t _res_conv_39 = _res_vals[n];
21362 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
21363 CHECK_ACCESS(_res_conv_39_ptr);
21364 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
21365 FREE((void*)_res_conv_39);
21366 _res_constr.data[n] = _res_conv_39_conv;
21368 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21369 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21373 LDKCVec_BalanceZ _res_constr;
21374 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21375 if (_res_constr.datalen > 0)
21376 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21378 _res_constr.data = NULL;
21379 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21380 for (size_t j = 0; j < _res_constr.datalen; j++) {
21381 int64_t _res_conv_9 = _res_vals[j];
21382 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
21383 CHECK_ACCESS(_res_conv_9_ptr);
21384 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21385 FREE((void*)_res_conv_9);
21386 _res_constr.data[j] = _res_conv_9_conv;
21388 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21389 CVec_BalanceZ_free(_res_constr);
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21393 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21394 CHECK_ACCESS(o_ptr);
21395 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
21396 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
21397 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21398 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
21399 return (int64_t)ret_conv;
21402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21403 LDKDecodeError e_conv;
21404 e_conv.inner = (void*)(e & (~1));
21405 e_conv.is_owned = (e & 1) || (e == 0);
21406 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21407 e_conv = DecodeError_clone(&e_conv);
21408 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21409 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
21410 return (int64_t)ret_conv;
21413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21414 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
21415 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21420 if ((_res & 1) != 0) return;
21421 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21422 CHECK_ACCESS(_res_ptr);
21423 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
21425 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
21428 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21429 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21430 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
21431 return (int64_t)ret_conv;
21433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21434 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
21435 int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21440 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
21441 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21442 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
21443 return (int64_t)ret_conv;
21446 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21447 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21448 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21449 return ((int64_t)ret_conv);
21451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21452 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
21453 int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21458 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
21459 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21460 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21461 return ((int64_t)ret_conv);
21464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21465 LDKPublicKey a_ref;
21466 CHECK((*env)->GetArrayLength(env, a) == 33);
21467 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
21468 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21469 CHECK_ACCESS(b_ptr);
21470 LDKType b_conv = *(LDKType*)(b_ptr);
21471 if (b_conv.free == LDKType_JCalls_free) {
21472 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21473 LDKType_JCalls_cloned(&b_conv);
21475 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21476 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21477 return ((int64_t)ret_conv);
21480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21481 if ((_res & 1) != 0) return;
21482 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21483 CHECK_ACCESS(_res_ptr);
21484 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21486 C2Tuple_PublicKeyTypeZ_free(_res_conv);
21489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21490 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21491 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21492 if (_res_constr.datalen > 0)
21493 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21495 _res_constr.data = NULL;
21496 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21497 for (size_t z = 0; z < _res_constr.datalen; z++) {
21498 int64_t _res_conv_25 = _res_vals[z];
21499 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
21500 CHECK_ACCESS(_res_conv_25_ptr);
21501 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21502 FREE((void*)_res_conv_25);
21503 _res_constr.data[z] = _res_conv_25_conv;
21505 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21506 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21510 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21511 CHECK_ACCESS(o_ptr);
21512 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21513 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21514 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21515 *ret_copy = COption_NetAddressZ_some(o_conv);
21516 int64_t ret_ref = (uintptr_t)ret_copy;
21520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
21521 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21522 *ret_copy = COption_NetAddressZ_none();
21523 int64_t ret_ref = (uintptr_t)ret_copy;
21527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21528 if ((_res & 1) != 0) return;
21529 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21530 CHECK_ACCESS(_res_ptr);
21531 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
21533 COption_NetAddressZ_free(_res_conv);
21536 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
21537 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21538 *ret_copy = COption_NetAddressZ_clone(arg);
21539 int64_t ret_ref = (uintptr_t)ret_copy;
21542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21543 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
21544 int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
21548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21549 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
21550 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21551 *ret_copy = COption_NetAddressZ_clone(orig_conv);
21552 int64_t ret_ref = (uintptr_t)ret_copy;
21556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21558 o_ref.datalen = (*env)->GetArrayLength(env, o);
21559 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21560 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21561 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21562 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
21563 return (int64_t)ret_conv;
21566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21567 LDKPeerHandleError e_conv;
21568 e_conv.inner = (void*)(e & (~1));
21569 e_conv.is_owned = (e & 1) || (e == 0);
21570 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21571 e_conv = PeerHandleError_clone(&e_conv);
21572 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21573 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
21574 return (int64_t)ret_conv;
21577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21578 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
21579 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
21583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21584 if ((_res & 1) != 0) return;
21585 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21586 CHECK_ACCESS(_res_ptr);
21587 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
21589 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
21592 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
21593 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21594 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
21595 return (int64_t)ret_conv;
21597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21598 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
21599 int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
21603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21604 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
21605 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21606 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
21607 return (int64_t)ret_conv;
21610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
21611 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21612 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
21613 return (int64_t)ret_conv;
21616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21617 LDKPeerHandleError e_conv;
21618 e_conv.inner = (void*)(e & (~1));
21619 e_conv.is_owned = (e & 1) || (e == 0);
21620 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21621 e_conv = PeerHandleError_clone(&e_conv);
21622 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21623 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
21624 return (int64_t)ret_conv;
21627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21628 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
21629 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
21633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21634 if ((_res & 1) != 0) return;
21635 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21636 CHECK_ACCESS(_res_ptr);
21637 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
21639 CResult_NonePeerHandleErrorZ_free(_res_conv);
21642 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
21643 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21644 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
21645 return (int64_t)ret_conv;
21647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21648 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
21649 int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
21653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21654 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
21655 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21656 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
21657 return (int64_t)ret_conv;
21660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
21661 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21662 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
21663 return (int64_t)ret_conv;
21666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21667 LDKPeerHandleError e_conv;
21668 e_conv.inner = (void*)(e & (~1));
21669 e_conv.is_owned = (e & 1) || (e == 0);
21670 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21671 e_conv = PeerHandleError_clone(&e_conv);
21672 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21673 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
21674 return (int64_t)ret_conv;
21677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21678 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
21679 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
21683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21684 if ((_res & 1) != 0) return;
21685 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21686 CHECK_ACCESS(_res_ptr);
21687 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
21689 CResult_boolPeerHandleErrorZ_free(_res_conv);
21692 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
21693 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21694 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
21695 return (int64_t)ret_conv;
21697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21698 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
21699 int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
21703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21704 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
21705 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21706 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
21707 return (int64_t)ret_conv;
21710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
21711 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21712 *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
21713 return (int64_t)ret_conv;
21716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21717 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
21718 CHECK_ACCESS(e_ptr);
21719 LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
21720 e_conv = GraphSyncError_clone((LDKGraphSyncError*)(((uintptr_t)e) & ~1));
21721 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21722 *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
21723 return (int64_t)ret_conv;
21726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21727 LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)(o & ~1);
21728 jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
21732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21733 if ((_res & 1) != 0) return;
21734 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21735 CHECK_ACCESS(_res_ptr);
21736 LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
21738 CResult_u32GraphSyncErrorZ_free(_res_conv);
21741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21742 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21743 CHECK_ACCESS(o_ptr);
21744 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21745 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21746 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21747 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
21748 return (int64_t)ret_conv;
21751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21752 LDKDecodeError e_conv;
21753 e_conv.inner = (void*)(e & (~1));
21754 e_conv.is_owned = (e & 1) || (e == 0);
21755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21756 e_conv = DecodeError_clone(&e_conv);
21757 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21758 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
21759 return (int64_t)ret_conv;
21762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21763 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
21764 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
21768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21769 if ((_res & 1) != 0) return;
21770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21771 CHECK_ACCESS(_res_ptr);
21772 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
21774 CResult_NetAddressDecodeErrorZ_free(_res_conv);
21777 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
21778 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21779 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
21780 return (int64_t)ret_conv;
21782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21783 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
21784 int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
21788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21789 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
21790 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21791 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
21792 return (int64_t)ret_conv;
21795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21796 LDKCVec_UpdateAddHTLCZ _res_constr;
21797 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21798 if (_res_constr.datalen > 0)
21799 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21801 _res_constr.data = NULL;
21802 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21803 for (size_t p = 0; p < _res_constr.datalen; p++) {
21804 int64_t _res_conv_15 = _res_vals[p];
21805 LDKUpdateAddHTLC _res_conv_15_conv;
21806 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
21807 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
21808 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21809 _res_constr.data[p] = _res_conv_15_conv;
21811 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21812 CVec_UpdateAddHTLCZ_free(_res_constr);
21815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21816 LDKCVec_UpdateFulfillHTLCZ _res_constr;
21817 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21818 if (_res_constr.datalen > 0)
21819 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21821 _res_constr.data = NULL;
21822 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21823 for (size_t t = 0; t < _res_constr.datalen; t++) {
21824 int64_t _res_conv_19 = _res_vals[t];
21825 LDKUpdateFulfillHTLC _res_conv_19_conv;
21826 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
21827 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
21828 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21829 _res_constr.data[t] = _res_conv_19_conv;
21831 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21832 CVec_UpdateFulfillHTLCZ_free(_res_constr);
21835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21836 LDKCVec_UpdateFailHTLCZ _res_constr;
21837 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21838 if (_res_constr.datalen > 0)
21839 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21841 _res_constr.data = NULL;
21842 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21843 for (size_t q = 0; q < _res_constr.datalen; q++) {
21844 int64_t _res_conv_16 = _res_vals[q];
21845 LDKUpdateFailHTLC _res_conv_16_conv;
21846 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
21847 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
21848 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21849 _res_constr.data[q] = _res_conv_16_conv;
21851 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21852 CVec_UpdateFailHTLCZ_free(_res_constr);
21855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21856 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21857 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21858 if (_res_constr.datalen > 0)
21859 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21861 _res_constr.data = NULL;
21862 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21863 for (size_t z = 0; z < _res_constr.datalen; z++) {
21864 int64_t _res_conv_25 = _res_vals[z];
21865 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21866 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
21867 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
21868 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21869 _res_constr.data[z] = _res_conv_25_conv;
21871 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21872 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21876 LDKAcceptChannel o_conv;
21877 o_conv.inner = (void*)(o & (~1));
21878 o_conv.is_owned = (o & 1) || (o == 0);
21879 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21880 o_conv = AcceptChannel_clone(&o_conv);
21881 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21882 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21883 return (int64_t)ret_conv;
21886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21887 LDKDecodeError e_conv;
21888 e_conv.inner = (void*)(e & (~1));
21889 e_conv.is_owned = (e & 1) || (e == 0);
21890 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21891 e_conv = DecodeError_clone(&e_conv);
21892 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21893 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21894 return (int64_t)ret_conv;
21897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21898 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
21899 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21904 if ((_res & 1) != 0) return;
21905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21906 CHECK_ACCESS(_res_ptr);
21907 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21909 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21912 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21913 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21914 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21915 return (int64_t)ret_conv;
21917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21918 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
21919 int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21924 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
21925 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21926 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21927 return (int64_t)ret_conv;
21930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21931 LDKAnnouncementSignatures o_conv;
21932 o_conv.inner = (void*)(o & (~1));
21933 o_conv.is_owned = (o & 1) || (o == 0);
21934 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21935 o_conv = AnnouncementSignatures_clone(&o_conv);
21936 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21937 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21938 return (int64_t)ret_conv;
21941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21942 LDKDecodeError e_conv;
21943 e_conv.inner = (void*)(e & (~1));
21944 e_conv.is_owned = (e & 1) || (e == 0);
21945 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21946 e_conv = DecodeError_clone(&e_conv);
21947 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21948 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21949 return (int64_t)ret_conv;
21952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21953 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
21954 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21959 if ((_res & 1) != 0) return;
21960 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21961 CHECK_ACCESS(_res_ptr);
21962 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21964 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21967 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21968 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21969 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21970 return (int64_t)ret_conv;
21972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21973 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
21974 int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21979 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
21980 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21981 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21982 return (int64_t)ret_conv;
21985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21986 LDKChannelReestablish o_conv;
21987 o_conv.inner = (void*)(o & (~1));
21988 o_conv.is_owned = (o & 1) || (o == 0);
21989 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21990 o_conv = ChannelReestablish_clone(&o_conv);
21991 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21992 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21993 return (int64_t)ret_conv;
21996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21997 LDKDecodeError e_conv;
21998 e_conv.inner = (void*)(e & (~1));
21999 e_conv.is_owned = (e & 1) || (e == 0);
22000 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22001 e_conv = DecodeError_clone(&e_conv);
22002 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22003 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
22004 return (int64_t)ret_conv;
22007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22008 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
22009 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
22013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22014 if ((_res & 1) != 0) return;
22015 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22016 CHECK_ACCESS(_res_ptr);
22017 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
22019 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
22022 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
22023 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22024 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
22025 return (int64_t)ret_conv;
22027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22028 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
22029 int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
22033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22034 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
22035 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22036 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
22037 return (int64_t)ret_conv;
22040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22041 LDKClosingSigned o_conv;
22042 o_conv.inner = (void*)(o & (~1));
22043 o_conv.is_owned = (o & 1) || (o == 0);
22044 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22045 o_conv = ClosingSigned_clone(&o_conv);
22046 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22047 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
22048 return (int64_t)ret_conv;
22051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22052 LDKDecodeError e_conv;
22053 e_conv.inner = (void*)(e & (~1));
22054 e_conv.is_owned = (e & 1) || (e == 0);
22055 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22056 e_conv = DecodeError_clone(&e_conv);
22057 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22058 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
22059 return (int64_t)ret_conv;
22062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22063 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
22064 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
22068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22069 if ((_res & 1) != 0) return;
22070 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22071 CHECK_ACCESS(_res_ptr);
22072 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
22074 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
22077 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
22078 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22079 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
22080 return (int64_t)ret_conv;
22082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22083 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
22084 int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
22088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22089 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
22090 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22091 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
22092 return (int64_t)ret_conv;
22095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22096 LDKClosingSignedFeeRange o_conv;
22097 o_conv.inner = (void*)(o & (~1));
22098 o_conv.is_owned = (o & 1) || (o == 0);
22099 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22100 o_conv = ClosingSignedFeeRange_clone(&o_conv);
22101 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22102 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
22103 return (int64_t)ret_conv;
22106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22107 LDKDecodeError e_conv;
22108 e_conv.inner = (void*)(e & (~1));
22109 e_conv.is_owned = (e & 1) || (e == 0);
22110 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22111 e_conv = DecodeError_clone(&e_conv);
22112 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22113 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
22114 return (int64_t)ret_conv;
22117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22118 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
22119 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
22123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22124 if ((_res & 1) != 0) return;
22125 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22126 CHECK_ACCESS(_res_ptr);
22127 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
22129 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
22132 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
22133 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22134 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
22135 return (int64_t)ret_conv;
22137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22138 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
22139 int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
22143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22144 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
22145 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22146 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
22147 return (int64_t)ret_conv;
22150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22151 LDKCommitmentSigned o_conv;
22152 o_conv.inner = (void*)(o & (~1));
22153 o_conv.is_owned = (o & 1) || (o == 0);
22154 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22155 o_conv = CommitmentSigned_clone(&o_conv);
22156 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22157 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
22158 return (int64_t)ret_conv;
22161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22162 LDKDecodeError e_conv;
22163 e_conv.inner = (void*)(e & (~1));
22164 e_conv.is_owned = (e & 1) || (e == 0);
22165 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22166 e_conv = DecodeError_clone(&e_conv);
22167 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22168 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
22169 return (int64_t)ret_conv;
22172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22173 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
22174 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
22178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22179 if ((_res & 1) != 0) return;
22180 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22181 CHECK_ACCESS(_res_ptr);
22182 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
22184 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
22187 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
22188 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22189 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
22190 return (int64_t)ret_conv;
22192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22193 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
22194 int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
22198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22199 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
22200 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22201 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
22202 return (int64_t)ret_conv;
22205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22206 LDKFundingCreated o_conv;
22207 o_conv.inner = (void*)(o & (~1));
22208 o_conv.is_owned = (o & 1) || (o == 0);
22209 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22210 o_conv = FundingCreated_clone(&o_conv);
22211 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22212 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
22213 return (int64_t)ret_conv;
22216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22217 LDKDecodeError e_conv;
22218 e_conv.inner = (void*)(e & (~1));
22219 e_conv.is_owned = (e & 1) || (e == 0);
22220 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22221 e_conv = DecodeError_clone(&e_conv);
22222 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22223 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
22224 return (int64_t)ret_conv;
22227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22228 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
22229 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
22233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22234 if ((_res & 1) != 0) return;
22235 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22236 CHECK_ACCESS(_res_ptr);
22237 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
22239 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
22242 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
22243 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22244 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
22245 return (int64_t)ret_conv;
22247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22248 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
22249 int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
22253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22254 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
22255 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22256 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
22257 return (int64_t)ret_conv;
22260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22261 LDKFundingSigned o_conv;
22262 o_conv.inner = (void*)(o & (~1));
22263 o_conv.is_owned = (o & 1) || (o == 0);
22264 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22265 o_conv = FundingSigned_clone(&o_conv);
22266 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22267 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
22268 return (int64_t)ret_conv;
22271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22272 LDKDecodeError e_conv;
22273 e_conv.inner = (void*)(e & (~1));
22274 e_conv.is_owned = (e & 1) || (e == 0);
22275 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22276 e_conv = DecodeError_clone(&e_conv);
22277 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22278 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
22279 return (int64_t)ret_conv;
22282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22283 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
22284 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
22288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22289 if ((_res & 1) != 0) return;
22290 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22291 CHECK_ACCESS(_res_ptr);
22292 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
22294 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
22297 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
22298 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22299 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
22300 return (int64_t)ret_conv;
22302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22303 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
22304 int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
22308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22309 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
22310 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22311 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
22312 return (int64_t)ret_conv;
22315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22316 LDKChannelReady o_conv;
22317 o_conv.inner = (void*)(o & (~1));
22318 o_conv.is_owned = (o & 1) || (o == 0);
22319 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22320 o_conv = ChannelReady_clone(&o_conv);
22321 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22322 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
22323 return (int64_t)ret_conv;
22326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22327 LDKDecodeError e_conv;
22328 e_conv.inner = (void*)(e & (~1));
22329 e_conv.is_owned = (e & 1) || (e == 0);
22330 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22331 e_conv = DecodeError_clone(&e_conv);
22332 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22333 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
22334 return (int64_t)ret_conv;
22337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22338 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
22339 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
22343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22344 if ((_res & 1) != 0) return;
22345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22346 CHECK_ACCESS(_res_ptr);
22347 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
22349 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
22352 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
22353 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22354 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
22355 return (int64_t)ret_conv;
22357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22358 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
22359 int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
22363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22364 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
22365 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22366 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
22367 return (int64_t)ret_conv;
22370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22372 o_conv.inner = (void*)(o & (~1));
22373 o_conv.is_owned = (o & 1) || (o == 0);
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22375 o_conv = Init_clone(&o_conv);
22376 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22377 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
22378 return (int64_t)ret_conv;
22381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22382 LDKDecodeError e_conv;
22383 e_conv.inner = (void*)(e & (~1));
22384 e_conv.is_owned = (e & 1) || (e == 0);
22385 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22386 e_conv = DecodeError_clone(&e_conv);
22387 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22388 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
22389 return (int64_t)ret_conv;
22392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22393 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
22394 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
22398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22399 if ((_res & 1) != 0) return;
22400 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22401 CHECK_ACCESS(_res_ptr);
22402 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
22404 CResult_InitDecodeErrorZ_free(_res_conv);
22407 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
22408 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22409 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
22410 return (int64_t)ret_conv;
22412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22413 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
22414 int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
22418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22419 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
22420 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22421 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
22422 return (int64_t)ret_conv;
22425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22426 LDKOpenChannel o_conv;
22427 o_conv.inner = (void*)(o & (~1));
22428 o_conv.is_owned = (o & 1) || (o == 0);
22429 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22430 o_conv = OpenChannel_clone(&o_conv);
22431 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22432 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
22433 return (int64_t)ret_conv;
22436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22437 LDKDecodeError e_conv;
22438 e_conv.inner = (void*)(e & (~1));
22439 e_conv.is_owned = (e & 1) || (e == 0);
22440 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22441 e_conv = DecodeError_clone(&e_conv);
22442 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22443 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
22444 return (int64_t)ret_conv;
22447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22448 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
22449 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
22453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22454 if ((_res & 1) != 0) return;
22455 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22456 CHECK_ACCESS(_res_ptr);
22457 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
22459 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
22462 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
22463 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22464 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
22465 return (int64_t)ret_conv;
22467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22468 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
22469 int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
22473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22474 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
22475 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22476 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
22477 return (int64_t)ret_conv;
22480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22481 LDKRevokeAndACK o_conv;
22482 o_conv.inner = (void*)(o & (~1));
22483 o_conv.is_owned = (o & 1) || (o == 0);
22484 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22485 o_conv = RevokeAndACK_clone(&o_conv);
22486 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22487 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
22488 return (int64_t)ret_conv;
22491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22492 LDKDecodeError e_conv;
22493 e_conv.inner = (void*)(e & (~1));
22494 e_conv.is_owned = (e & 1) || (e == 0);
22495 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22496 e_conv = DecodeError_clone(&e_conv);
22497 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22498 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
22499 return (int64_t)ret_conv;
22502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22503 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
22504 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
22508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22509 if ((_res & 1) != 0) return;
22510 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22511 CHECK_ACCESS(_res_ptr);
22512 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
22514 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
22517 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
22518 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22519 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
22520 return (int64_t)ret_conv;
22522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22523 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
22524 int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
22528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22529 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
22530 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22531 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
22532 return (int64_t)ret_conv;
22535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22536 LDKShutdown o_conv;
22537 o_conv.inner = (void*)(o & (~1));
22538 o_conv.is_owned = (o & 1) || (o == 0);
22539 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22540 o_conv = Shutdown_clone(&o_conv);
22541 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22542 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
22543 return (int64_t)ret_conv;
22546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22547 LDKDecodeError e_conv;
22548 e_conv.inner = (void*)(e & (~1));
22549 e_conv.is_owned = (e & 1) || (e == 0);
22550 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22551 e_conv = DecodeError_clone(&e_conv);
22552 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22553 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
22554 return (int64_t)ret_conv;
22557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22558 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
22559 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
22563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22564 if ((_res & 1) != 0) return;
22565 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22566 CHECK_ACCESS(_res_ptr);
22567 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
22569 CResult_ShutdownDecodeErrorZ_free(_res_conv);
22572 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
22573 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22574 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
22575 return (int64_t)ret_conv;
22577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22578 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
22579 int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
22583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22584 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
22585 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22586 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
22587 return (int64_t)ret_conv;
22590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22591 LDKUpdateFailHTLC o_conv;
22592 o_conv.inner = (void*)(o & (~1));
22593 o_conv.is_owned = (o & 1) || (o == 0);
22594 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22595 o_conv = UpdateFailHTLC_clone(&o_conv);
22596 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22597 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
22598 return (int64_t)ret_conv;
22601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22602 LDKDecodeError e_conv;
22603 e_conv.inner = (void*)(e & (~1));
22604 e_conv.is_owned = (e & 1) || (e == 0);
22605 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22606 e_conv = DecodeError_clone(&e_conv);
22607 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22608 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
22609 return (int64_t)ret_conv;
22612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22613 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
22614 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
22618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22619 if ((_res & 1) != 0) return;
22620 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22621 CHECK_ACCESS(_res_ptr);
22622 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
22624 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
22627 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
22628 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22629 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
22630 return (int64_t)ret_conv;
22632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22633 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
22634 int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
22638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22639 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
22640 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22641 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
22642 return (int64_t)ret_conv;
22645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22646 LDKUpdateFailMalformedHTLC o_conv;
22647 o_conv.inner = (void*)(o & (~1));
22648 o_conv.is_owned = (o & 1) || (o == 0);
22649 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22650 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
22651 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22652 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
22653 return (int64_t)ret_conv;
22656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22657 LDKDecodeError e_conv;
22658 e_conv.inner = (void*)(e & (~1));
22659 e_conv.is_owned = (e & 1) || (e == 0);
22660 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22661 e_conv = DecodeError_clone(&e_conv);
22662 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22663 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
22664 return (int64_t)ret_conv;
22667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22668 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
22669 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
22673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22674 if ((_res & 1) != 0) return;
22675 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22676 CHECK_ACCESS(_res_ptr);
22677 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
22679 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
22682 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
22683 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22684 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
22685 return (int64_t)ret_conv;
22687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22688 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
22689 int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
22693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22694 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
22695 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22696 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
22697 return (int64_t)ret_conv;
22700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22701 LDKUpdateFee o_conv;
22702 o_conv.inner = (void*)(o & (~1));
22703 o_conv.is_owned = (o & 1) || (o == 0);
22704 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22705 o_conv = UpdateFee_clone(&o_conv);
22706 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22707 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
22708 return (int64_t)ret_conv;
22711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22712 LDKDecodeError e_conv;
22713 e_conv.inner = (void*)(e & (~1));
22714 e_conv.is_owned = (e & 1) || (e == 0);
22715 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22716 e_conv = DecodeError_clone(&e_conv);
22717 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22718 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
22719 return (int64_t)ret_conv;
22722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22723 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
22724 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
22728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22729 if ((_res & 1) != 0) return;
22730 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22731 CHECK_ACCESS(_res_ptr);
22732 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
22734 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
22737 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
22738 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22739 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
22740 return (int64_t)ret_conv;
22742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22743 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
22744 int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
22748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22749 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
22750 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22751 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
22752 return (int64_t)ret_conv;
22755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22756 LDKUpdateFulfillHTLC o_conv;
22757 o_conv.inner = (void*)(o & (~1));
22758 o_conv.is_owned = (o & 1) || (o == 0);
22759 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22760 o_conv = UpdateFulfillHTLC_clone(&o_conv);
22761 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22762 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
22763 return (int64_t)ret_conv;
22766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22767 LDKDecodeError e_conv;
22768 e_conv.inner = (void*)(e & (~1));
22769 e_conv.is_owned = (e & 1) || (e == 0);
22770 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22771 e_conv = DecodeError_clone(&e_conv);
22772 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22773 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
22774 return (int64_t)ret_conv;
22777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22778 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
22779 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
22783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22784 if ((_res & 1) != 0) return;
22785 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22786 CHECK_ACCESS(_res_ptr);
22787 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
22789 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
22792 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
22793 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22794 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
22795 return (int64_t)ret_conv;
22797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22798 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
22799 int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22804 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
22805 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22806 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22807 return (int64_t)ret_conv;
22810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22811 LDKUpdateAddHTLC o_conv;
22812 o_conv.inner = (void*)(o & (~1));
22813 o_conv.is_owned = (o & 1) || (o == 0);
22814 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22815 o_conv = UpdateAddHTLC_clone(&o_conv);
22816 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22817 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22818 return (int64_t)ret_conv;
22821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22822 LDKDecodeError e_conv;
22823 e_conv.inner = (void*)(e & (~1));
22824 e_conv.is_owned = (e & 1) || (e == 0);
22825 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22826 e_conv = DecodeError_clone(&e_conv);
22827 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22828 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22829 return (int64_t)ret_conv;
22832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22833 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
22834 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22839 if ((_res & 1) != 0) return;
22840 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22841 CHECK_ACCESS(_res_ptr);
22842 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22844 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22847 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22848 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22849 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22850 return (int64_t)ret_conv;
22852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22853 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
22854 int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22859 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
22860 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22861 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22862 return (int64_t)ret_conv;
22865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22867 o_conv.inner = (void*)(o & (~1));
22868 o_conv.is_owned = (o & 1) || (o == 0);
22869 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22870 o_conv = Ping_clone(&o_conv);
22871 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22872 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22873 return (int64_t)ret_conv;
22876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22877 LDKDecodeError e_conv;
22878 e_conv.inner = (void*)(e & (~1));
22879 e_conv.is_owned = (e & 1) || (e == 0);
22880 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22881 e_conv = DecodeError_clone(&e_conv);
22882 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22883 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22884 return (int64_t)ret_conv;
22887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22888 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
22889 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22894 if ((_res & 1) != 0) return;
22895 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22896 CHECK_ACCESS(_res_ptr);
22897 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22899 CResult_PingDecodeErrorZ_free(_res_conv);
22902 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22903 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22904 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22905 return (int64_t)ret_conv;
22907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22908 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
22909 int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22914 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
22915 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22916 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22917 return (int64_t)ret_conv;
22920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22922 o_conv.inner = (void*)(o & (~1));
22923 o_conv.is_owned = (o & 1) || (o == 0);
22924 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22925 o_conv = Pong_clone(&o_conv);
22926 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22927 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22928 return (int64_t)ret_conv;
22931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22932 LDKDecodeError e_conv;
22933 e_conv.inner = (void*)(e & (~1));
22934 e_conv.is_owned = (e & 1) || (e == 0);
22935 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22936 e_conv = DecodeError_clone(&e_conv);
22937 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22938 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22939 return (int64_t)ret_conv;
22942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22943 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
22944 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22949 if ((_res & 1) != 0) return;
22950 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22951 CHECK_ACCESS(_res_ptr);
22952 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22954 CResult_PongDecodeErrorZ_free(_res_conv);
22957 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22958 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22959 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22960 return (int64_t)ret_conv;
22962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22963 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
22964 int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22969 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
22970 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22971 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22972 return (int64_t)ret_conv;
22975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22976 LDKUnsignedChannelAnnouncement o_conv;
22977 o_conv.inner = (void*)(o & (~1));
22978 o_conv.is_owned = (o & 1) || (o == 0);
22979 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22980 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22981 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22982 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22983 return (int64_t)ret_conv;
22986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22987 LDKDecodeError e_conv;
22988 e_conv.inner = (void*)(e & (~1));
22989 e_conv.is_owned = (e & 1) || (e == 0);
22990 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22991 e_conv = DecodeError_clone(&e_conv);
22992 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22993 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22994 return (int64_t)ret_conv;
22997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22998 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
22999 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23004 if ((_res & 1) != 0) return;
23005 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23006 CHECK_ACCESS(_res_ptr);
23007 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23009 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
23012 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23013 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23014 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
23015 return (int64_t)ret_conv;
23017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23018 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23019 int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23024 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23025 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23026 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23027 return (int64_t)ret_conv;
23030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23031 LDKChannelAnnouncement o_conv;
23032 o_conv.inner = (void*)(o & (~1));
23033 o_conv.is_owned = (o & 1) || (o == 0);
23034 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23035 o_conv = ChannelAnnouncement_clone(&o_conv);
23036 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23037 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
23038 return (int64_t)ret_conv;
23041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23042 LDKDecodeError e_conv;
23043 e_conv.inner = (void*)(e & (~1));
23044 e_conv.is_owned = (e & 1) || (e == 0);
23045 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23046 e_conv = DecodeError_clone(&e_conv);
23047 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23048 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
23049 return (int64_t)ret_conv;
23052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23053 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
23054 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23059 if ((_res & 1) != 0) return;
23060 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23061 CHECK_ACCESS(_res_ptr);
23062 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23064 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
23067 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23068 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23069 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
23070 return (int64_t)ret_conv;
23072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23073 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23074 int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23079 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23080 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23081 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23082 return (int64_t)ret_conv;
23085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23086 LDKUnsignedChannelUpdate o_conv;
23087 o_conv.inner = (void*)(o & (~1));
23088 o_conv.is_owned = (o & 1) || (o == 0);
23089 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23090 o_conv = UnsignedChannelUpdate_clone(&o_conv);
23091 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23092 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
23093 return (int64_t)ret_conv;
23096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23097 LDKDecodeError e_conv;
23098 e_conv.inner = (void*)(e & (~1));
23099 e_conv.is_owned = (e & 1) || (e == 0);
23100 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23101 e_conv = DecodeError_clone(&e_conv);
23102 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23103 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
23104 return (int64_t)ret_conv;
23107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23108 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
23109 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
23113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23114 if ((_res & 1) != 0) return;
23115 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23116 CHECK_ACCESS(_res_ptr);
23117 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
23119 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
23122 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23123 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23124 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
23125 return (int64_t)ret_conv;
23127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23128 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
23129 int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23134 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
23135 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23136 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
23137 return (int64_t)ret_conv;
23140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23141 LDKChannelUpdate o_conv;
23142 o_conv.inner = (void*)(o & (~1));
23143 o_conv.is_owned = (o & 1) || (o == 0);
23144 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23145 o_conv = ChannelUpdate_clone(&o_conv);
23146 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23147 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
23148 return (int64_t)ret_conv;
23151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23152 LDKDecodeError e_conv;
23153 e_conv.inner = (void*)(e & (~1));
23154 e_conv.is_owned = (e & 1) || (e == 0);
23155 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23156 e_conv = DecodeError_clone(&e_conv);
23157 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23158 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
23159 return (int64_t)ret_conv;
23162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23163 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
23164 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
23168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23169 if ((_res & 1) != 0) return;
23170 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23171 CHECK_ACCESS(_res_ptr);
23172 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
23174 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
23177 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23178 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23179 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
23180 return (int64_t)ret_conv;
23182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23183 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
23184 int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23189 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
23190 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23191 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
23192 return (int64_t)ret_conv;
23195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23196 LDKErrorMessage o_conv;
23197 o_conv.inner = (void*)(o & (~1));
23198 o_conv.is_owned = (o & 1) || (o == 0);
23199 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23200 o_conv = ErrorMessage_clone(&o_conv);
23201 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23202 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
23203 return (int64_t)ret_conv;
23206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23207 LDKDecodeError e_conv;
23208 e_conv.inner = (void*)(e & (~1));
23209 e_conv.is_owned = (e & 1) || (e == 0);
23210 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23211 e_conv = DecodeError_clone(&e_conv);
23212 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23213 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
23214 return (int64_t)ret_conv;
23217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23218 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
23219 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
23223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23224 if ((_res & 1) != 0) return;
23225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23226 CHECK_ACCESS(_res_ptr);
23227 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
23229 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
23232 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
23233 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23234 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
23235 return (int64_t)ret_conv;
23237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23238 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
23239 int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
23243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23244 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
23245 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23246 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
23247 return (int64_t)ret_conv;
23250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23251 LDKWarningMessage o_conv;
23252 o_conv.inner = (void*)(o & (~1));
23253 o_conv.is_owned = (o & 1) || (o == 0);
23254 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23255 o_conv = WarningMessage_clone(&o_conv);
23256 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23257 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
23258 return (int64_t)ret_conv;
23261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23262 LDKDecodeError e_conv;
23263 e_conv.inner = (void*)(e & (~1));
23264 e_conv.is_owned = (e & 1) || (e == 0);
23265 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23266 e_conv = DecodeError_clone(&e_conv);
23267 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23268 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
23269 return (int64_t)ret_conv;
23272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23273 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
23274 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
23278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23279 if ((_res & 1) != 0) return;
23280 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23281 CHECK_ACCESS(_res_ptr);
23282 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
23284 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
23287 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
23288 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23289 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
23290 return (int64_t)ret_conv;
23292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23293 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
23294 int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
23298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23299 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
23300 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23301 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
23302 return (int64_t)ret_conv;
23305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23306 LDKUnsignedNodeAnnouncement o_conv;
23307 o_conv.inner = (void*)(o & (~1));
23308 o_conv.is_owned = (o & 1) || (o == 0);
23309 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23310 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
23311 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23312 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
23313 return (int64_t)ret_conv;
23316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23317 LDKDecodeError e_conv;
23318 e_conv.inner = (void*)(e & (~1));
23319 e_conv.is_owned = (e & 1) || (e == 0);
23320 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23321 e_conv = DecodeError_clone(&e_conv);
23322 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23323 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
23324 return (int64_t)ret_conv;
23327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23328 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
23329 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23334 if ((_res & 1) != 0) return;
23335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23336 CHECK_ACCESS(_res_ptr);
23337 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
23339 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
23342 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23343 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23344 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
23345 return (int64_t)ret_conv;
23347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23348 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
23349 int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23354 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
23355 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23356 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
23357 return (int64_t)ret_conv;
23360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23361 LDKNodeAnnouncement o_conv;
23362 o_conv.inner = (void*)(o & (~1));
23363 o_conv.is_owned = (o & 1) || (o == 0);
23364 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23365 o_conv = NodeAnnouncement_clone(&o_conv);
23366 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23367 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
23368 return (int64_t)ret_conv;
23371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23372 LDKDecodeError e_conv;
23373 e_conv.inner = (void*)(e & (~1));
23374 e_conv.is_owned = (e & 1) || (e == 0);
23375 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23376 e_conv = DecodeError_clone(&e_conv);
23377 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23378 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
23379 return (int64_t)ret_conv;
23382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23383 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
23384 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23389 if ((_res & 1) != 0) return;
23390 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23391 CHECK_ACCESS(_res_ptr);
23392 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
23394 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
23397 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23398 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23399 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
23400 return (int64_t)ret_conv;
23402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23403 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
23404 int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23409 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
23410 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23411 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
23412 return (int64_t)ret_conv;
23415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23416 LDKQueryShortChannelIds o_conv;
23417 o_conv.inner = (void*)(o & (~1));
23418 o_conv.is_owned = (o & 1) || (o == 0);
23419 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23420 o_conv = QueryShortChannelIds_clone(&o_conv);
23421 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23422 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
23423 return (int64_t)ret_conv;
23426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23427 LDKDecodeError e_conv;
23428 e_conv.inner = (void*)(e & (~1));
23429 e_conv.is_owned = (e & 1) || (e == 0);
23430 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23431 e_conv = DecodeError_clone(&e_conv);
23432 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23433 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
23434 return (int64_t)ret_conv;
23437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23438 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
23439 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
23443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23444 if ((_res & 1) != 0) return;
23445 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23446 CHECK_ACCESS(_res_ptr);
23447 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
23449 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
23452 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
23453 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23454 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
23455 return (int64_t)ret_conv;
23457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23458 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
23459 int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
23463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23464 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
23465 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23466 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
23467 return (int64_t)ret_conv;
23470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23471 LDKReplyShortChannelIdsEnd o_conv;
23472 o_conv.inner = (void*)(o & (~1));
23473 o_conv.is_owned = (o & 1) || (o == 0);
23474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23475 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
23476 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23477 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
23478 return (int64_t)ret_conv;
23481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23482 LDKDecodeError e_conv;
23483 e_conv.inner = (void*)(e & (~1));
23484 e_conv.is_owned = (e & 1) || (e == 0);
23485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23486 e_conv = DecodeError_clone(&e_conv);
23487 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23488 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
23489 return (int64_t)ret_conv;
23492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23493 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
23494 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
23498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23499 if ((_res & 1) != 0) return;
23500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23501 CHECK_ACCESS(_res_ptr);
23502 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
23504 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
23507 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
23508 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23509 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
23510 return (int64_t)ret_conv;
23512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23513 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
23514 int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
23518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23519 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
23520 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23521 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
23522 return (int64_t)ret_conv;
23525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23526 LDKQueryChannelRange o_conv;
23527 o_conv.inner = (void*)(o & (~1));
23528 o_conv.is_owned = (o & 1) || (o == 0);
23529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23530 o_conv = QueryChannelRange_clone(&o_conv);
23531 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23532 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
23533 return (int64_t)ret_conv;
23536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23537 LDKDecodeError e_conv;
23538 e_conv.inner = (void*)(e & (~1));
23539 e_conv.is_owned = (e & 1) || (e == 0);
23540 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23541 e_conv = DecodeError_clone(&e_conv);
23542 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23543 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
23544 return (int64_t)ret_conv;
23547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23548 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
23549 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
23553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23554 if ((_res & 1) != 0) return;
23555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23556 CHECK_ACCESS(_res_ptr);
23557 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
23559 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
23562 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
23563 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23564 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
23565 return (int64_t)ret_conv;
23567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23568 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
23569 int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
23573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23574 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
23575 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23576 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
23577 return (int64_t)ret_conv;
23580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23581 LDKReplyChannelRange o_conv;
23582 o_conv.inner = (void*)(o & (~1));
23583 o_conv.is_owned = (o & 1) || (o == 0);
23584 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23585 o_conv = ReplyChannelRange_clone(&o_conv);
23586 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23587 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
23588 return (int64_t)ret_conv;
23591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23592 LDKDecodeError e_conv;
23593 e_conv.inner = (void*)(e & (~1));
23594 e_conv.is_owned = (e & 1) || (e == 0);
23595 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23596 e_conv = DecodeError_clone(&e_conv);
23597 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23598 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
23599 return (int64_t)ret_conv;
23602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23603 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
23604 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
23608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23609 if ((_res & 1) != 0) return;
23610 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23611 CHECK_ACCESS(_res_ptr);
23612 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
23614 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
23617 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
23618 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23619 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
23620 return (int64_t)ret_conv;
23622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23623 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
23624 int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
23628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23629 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
23630 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23631 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
23632 return (int64_t)ret_conv;
23635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23636 LDKGossipTimestampFilter o_conv;
23637 o_conv.inner = (void*)(o & (~1));
23638 o_conv.is_owned = (o & 1) || (o == 0);
23639 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23640 o_conv = GossipTimestampFilter_clone(&o_conv);
23641 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23642 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
23643 return (int64_t)ret_conv;
23646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23647 LDKDecodeError e_conv;
23648 e_conv.inner = (void*)(e & (~1));
23649 e_conv.is_owned = (e & 1) || (e == 0);
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23651 e_conv = DecodeError_clone(&e_conv);
23652 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23653 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
23654 return (int64_t)ret_conv;
23657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23658 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
23659 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
23663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23664 if ((_res & 1) != 0) return;
23665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23666 CHECK_ACCESS(_res_ptr);
23667 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
23669 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
23672 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
23673 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23674 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
23675 return (int64_t)ret_conv;
23677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23678 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
23679 int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
23683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23684 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
23685 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23686 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
23687 return (int64_t)ret_conv;
23690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23691 LDKCVec_PhantomRouteHintsZ _res_constr;
23692 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23693 if (_res_constr.datalen > 0)
23694 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
23696 _res_constr.data = NULL;
23697 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23698 for (size_t t = 0; t < _res_constr.datalen; t++) {
23699 int64_t _res_conv_19 = _res_vals[t];
23700 LDKPhantomRouteHints _res_conv_19_conv;
23701 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
23702 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
23703 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23704 _res_constr.data[t] = _res_conv_19_conv;
23706 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23707 CVec_PhantomRouteHintsZ_free(_res_constr);
23710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23712 o_conv.inner = (void*)(o & (~1));
23713 o_conv.is_owned = (o & 1) || (o == 0);
23714 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23715 o_conv = Invoice_clone(&o_conv);
23716 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23717 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
23718 return (int64_t)ret_conv;
23721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23722 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
23723 CHECK_ACCESS(e_ptr);
23724 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
23725 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
23726 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23727 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
23728 return (int64_t)ret_conv;
23731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23732 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
23733 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
23737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23738 if ((_res & 1) != 0) return;
23739 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23740 CHECK_ACCESS(_res_ptr);
23741 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
23743 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
23746 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
23747 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23748 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
23749 return (int64_t)ret_conv;
23751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23752 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
23753 int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
23757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23758 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
23759 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23760 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
23761 return (int64_t)ret_conv;
23764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23765 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
23766 CHECK_ACCESS(o_ptr);
23767 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
23768 if (o_conv.free == LDKFilter_JCalls_free) {
23769 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23770 LDKFilter_JCalls_cloned(&o_conv);
23772 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23773 *ret_copy = COption_FilterZ_some(o_conv);
23774 int64_t ret_ref = (uintptr_t)ret_copy;
23778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
23779 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23780 *ret_copy = COption_FilterZ_none();
23781 int64_t ret_ref = (uintptr_t)ret_copy;
23785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23786 if ((_res & 1) != 0) return;
23787 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23788 CHECK_ACCESS(_res_ptr);
23789 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
23791 COption_FilterZ_free(_res_conv);
23794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23795 LDKLockedChannelMonitor o_conv;
23796 o_conv.inner = (void*)(o & (~1));
23797 o_conv.is_owned = (o & 1) || (o == 0);
23798 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23799 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23800 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23801 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23802 return (int64_t)ret_conv;
23805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23806 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23807 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23808 return (int64_t)ret_conv;
23811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23812 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
23813 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23818 if ((_res & 1) != 0) return;
23819 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23820 CHECK_ACCESS(_res_ptr);
23821 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23823 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23827 LDKCVec_OutPointZ _res_constr;
23828 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23829 if (_res_constr.datalen > 0)
23830 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23832 _res_constr.data = NULL;
23833 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23834 for (size_t k = 0; k < _res_constr.datalen; k++) {
23835 int64_t _res_conv_10 = _res_vals[k];
23836 LDKOutPoint _res_conv_10_conv;
23837 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
23838 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
23839 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23840 _res_constr.data[k] = _res_conv_10_conv;
23842 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23843 CVec_OutPointZ_free(_res_constr);
23846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23847 if ((this_ptr & 1) != 0) return;
23848 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23849 CHECK_ACCESS(this_ptr_ptr);
23850 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23851 FREE((void*)this_ptr);
23852 PaymentPurpose_free(this_ptr_conv);
23855 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23856 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23857 *ret_copy = PaymentPurpose_clone(arg);
23858 int64_t ret_ref = (uintptr_t)ret_copy;
23861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23862 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
23863 int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23868 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
23869 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23870 *ret_copy = PaymentPurpose_clone(orig_conv);
23871 int64_t ret_ref = (uintptr_t)ret_copy;
23875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23876 LDKThirtyTwoBytes payment_preimage_ref;
23877 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23878 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23879 LDKThirtyTwoBytes payment_secret_ref;
23880 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23881 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23882 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23883 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23884 int64_t ret_ref = (uintptr_t)ret_copy;
23888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23889 LDKThirtyTwoBytes a_ref;
23890 CHECK((*env)->GetArrayLength(env, a) == 32);
23891 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23892 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23893 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23894 int64_t ret_ref = (uintptr_t)ret_copy;
23898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
23899 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
23900 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
23901 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23902 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23903 CVec_u8Z_free(ret_var);
23907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23908 LDKu8slice ser_ref;
23909 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23910 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23911 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
23912 *ret_conv = PaymentPurpose_read(ser_ref);
23913 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23914 return (int64_t)ret_conv;
23917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23918 if ((this_ptr & 1) != 0) return;
23919 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23920 CHECK_ACCESS(this_ptr_ptr);
23921 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23922 FREE((void*)this_ptr);
23923 ClosureReason_free(this_ptr_conv);
23926 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23927 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23928 *ret_copy = ClosureReason_clone(arg);
23929 int64_t ret_ref = (uintptr_t)ret_copy;
23932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23933 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
23934 int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23939 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
23940 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23941 *ret_copy = ClosureReason_clone(orig_conv);
23942 int64_t ret_ref = (uintptr_t)ret_copy;
23946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23947 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23948 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23949 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23950 int64_t ret_ref = (uintptr_t)ret_copy;
23954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23955 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23956 *ret_copy = ClosureReason_holder_force_closed();
23957 int64_t ret_ref = (uintptr_t)ret_copy;
23961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23962 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23963 *ret_copy = ClosureReason_cooperative_closure();
23964 int64_t ret_ref = (uintptr_t)ret_copy;
23968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23969 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23970 *ret_copy = ClosureReason_commitment_tx_confirmed();
23971 int64_t ret_ref = (uintptr_t)ret_copy;
23975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23976 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23977 *ret_copy = ClosureReason_funding_timed_out();
23978 int64_t ret_ref = (uintptr_t)ret_copy;
23982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23983 LDKStr err_conv = java_to_owned_str(env, err);
23984 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23985 *ret_copy = ClosureReason_processing_error(err_conv);
23986 int64_t ret_ref = (uintptr_t)ret_copy;
23990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23991 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23992 *ret_copy = ClosureReason_disconnected_peer();
23993 int64_t ret_ref = (uintptr_t)ret_copy;
23997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23998 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23999 *ret_copy = ClosureReason_outdated_channel_manager();
24000 int64_t ret_ref = (uintptr_t)ret_copy;
24004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
24005 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
24006 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
24007 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24008 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24009 CVec_u8Z_free(ret_var);
24013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24014 LDKu8slice ser_ref;
24015 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24016 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24017 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
24018 *ret_conv = ClosureReason_read(ser_ref);
24019 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24020 return (int64_t)ret_conv;
24023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24024 if ((this_ptr & 1) != 0) return;
24025 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24026 CHECK_ACCESS(this_ptr_ptr);
24027 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
24028 FREE((void*)this_ptr);
24029 Event_free(this_ptr_conv);
24032 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
24033 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24034 *ret_copy = Event_clone(arg);
24035 int64_t ret_ref = (uintptr_t)ret_copy;
24038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24039 LDKEvent* arg_conv = (LDKEvent*)arg;
24040 int64_t ret_conv = Event_clone_ptr(arg_conv);
24044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24045 LDKEvent* orig_conv = (LDKEvent*)orig;
24046 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24047 *ret_copy = Event_clone(orig_conv);
24048 int64_t ret_ref = (uintptr_t)ret_copy;
24052 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) {
24053 LDKThirtyTwoBytes temporary_channel_id_ref;
24054 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24055 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24056 LDKPublicKey counterparty_node_id_ref;
24057 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24058 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24059 LDKCVec_u8Z output_script_ref;
24060 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
24061 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
24062 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
24063 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24064 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
24065 int64_t ret_ref = (uintptr_t)ret_copy;
24069 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) {
24070 LDKThirtyTwoBytes payment_hash_ref;
24071 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24072 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24073 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24074 CHECK_ACCESS(purpose_ptr);
24075 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24076 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24077 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24078 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
24079 int64_t ret_ref = (uintptr_t)ret_copy;
24083 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) {
24084 LDKThirtyTwoBytes payment_hash_ref;
24085 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24086 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24087 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24088 CHECK_ACCESS(purpose_ptr);
24089 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24090 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24091 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24092 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
24093 int64_t ret_ref = (uintptr_t)ret_copy;
24097 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) {
24098 LDKThirtyTwoBytes payment_id_ref;
24099 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24100 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24101 LDKThirtyTwoBytes payment_preimage_ref;
24102 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24103 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24104 LDKThirtyTwoBytes payment_hash_ref;
24105 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24106 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24107 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
24108 CHECK_ACCESS(fee_paid_msat_ptr);
24109 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
24110 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
24111 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24112 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
24113 int64_t ret_ref = (uintptr_t)ret_copy;
24117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
24118 LDKThirtyTwoBytes payment_id_ref;
24119 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24120 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24121 LDKThirtyTwoBytes payment_hash_ref;
24122 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24123 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24124 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24125 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
24126 int64_t ret_ref = (uintptr_t)ret_copy;
24130 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) {
24131 LDKThirtyTwoBytes payment_id_ref;
24132 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24133 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24134 LDKThirtyTwoBytes payment_hash_ref;
24135 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24136 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24137 LDKCVec_RouteHopZ path_constr;
24138 path_constr.datalen = (*env)->GetArrayLength(env, path);
24139 if (path_constr.datalen > 0)
24140 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24142 path_constr.data = NULL;
24143 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24144 for (size_t k = 0; k < path_constr.datalen; k++) {
24145 int64_t path_conv_10 = path_vals[k];
24146 LDKRouteHop path_conv_10_conv;
24147 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24148 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24149 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24150 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24151 path_constr.data[k] = path_conv_10_conv;
24153 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24154 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24155 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
24156 int64_t ret_ref = (uintptr_t)ret_copy;
24160 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) {
24161 LDKThirtyTwoBytes payment_id_ref;
24162 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24163 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24164 LDKThirtyTwoBytes payment_hash_ref;
24165 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24166 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24167 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
24168 CHECK_ACCESS(network_update_ptr);
24169 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
24170 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
24171 LDKCVec_RouteHopZ path_constr;
24172 path_constr.datalen = (*env)->GetArrayLength(env, path);
24173 if (path_constr.datalen > 0)
24174 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24176 path_constr.data = NULL;
24177 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24178 for (size_t k = 0; k < path_constr.datalen; k++) {
24179 int64_t path_conv_10 = path_vals[k];
24180 LDKRouteHop path_conv_10_conv;
24181 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24182 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24183 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24184 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24185 path_constr.data[k] = path_conv_10_conv;
24187 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24188 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
24189 CHECK_ACCESS(short_channel_id_ptr);
24190 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
24191 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
24192 LDKRouteParameters retry_conv;
24193 retry_conv.inner = (void*)(retry & (~1));
24194 retry_conv.is_owned = (retry & 1) || (retry == 0);
24195 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
24196 retry_conv = RouteParameters_clone(&retry_conv);
24197 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24198 *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);
24199 int64_t ret_ref = (uintptr_t)ret_copy;
24203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
24204 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24205 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
24206 int64_t ret_ref = (uintptr_t)ret_copy;
24210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
24211 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
24212 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
24213 if (outputs_constr.datalen > 0)
24214 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24216 outputs_constr.data = NULL;
24217 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
24218 for (size_t b = 0; b < outputs_constr.datalen; b++) {
24219 int64_t outputs_conv_27 = outputs_vals[b];
24220 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
24221 CHECK_ACCESS(outputs_conv_27_ptr);
24222 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
24223 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
24224 outputs_constr.data[b] = outputs_conv_27_conv;
24226 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
24227 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24228 *ret_copy = Event_spendable_outputs(outputs_constr);
24229 int64_t ret_ref = (uintptr_t)ret_copy;
24233 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) {
24234 LDKThirtyTwoBytes prev_channel_id_ref;
24235 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
24236 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
24237 LDKThirtyTwoBytes next_channel_id_ref;
24238 CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
24239 (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
24240 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
24241 CHECK_ACCESS(fee_earned_msat_ptr);
24242 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
24243 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
24244 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24245 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
24246 int64_t ret_ref = (uintptr_t)ret_copy;
24250 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) {
24251 LDKThirtyTwoBytes channel_id_ref;
24252 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24253 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24254 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
24255 CHECK_ACCESS(reason_ptr);
24256 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
24257 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
24258 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24259 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
24260 int64_t ret_ref = (uintptr_t)ret_copy;
24264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
24265 LDKThirtyTwoBytes channel_id_ref;
24266 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24267 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24268 LDKTransaction transaction_ref;
24269 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
24270 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
24271 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
24272 transaction_ref.data_is_owned = true;
24273 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24274 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
24275 int64_t ret_ref = (uintptr_t)ret_copy;
24279 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) {
24280 LDKThirtyTwoBytes temporary_channel_id_ref;
24281 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24282 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24283 LDKPublicKey counterparty_node_id_ref;
24284 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24285 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24286 LDKChannelTypeFeatures channel_type_conv;
24287 channel_type_conv.inner = (void*)(channel_type & (~1));
24288 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
24289 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
24290 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
24291 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24292 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
24293 int64_t ret_ref = (uintptr_t)ret_copy;
24297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
24298 LDKEvent* obj_conv = (LDKEvent*)obj;
24299 LDKCVec_u8Z ret_var = Event_write(obj_conv);
24300 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24301 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24302 CVec_u8Z_free(ret_var);
24306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24307 LDKu8slice ser_ref;
24308 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24309 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24310 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
24311 *ret_conv = Event_read(ser_ref);
24312 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24313 return (int64_t)ret_conv;
24316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24317 if ((this_ptr & 1) != 0) return;
24318 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24319 CHECK_ACCESS(this_ptr_ptr);
24320 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
24321 FREE((void*)this_ptr);
24322 MessageSendEvent_free(this_ptr_conv);
24325 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
24326 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24327 *ret_copy = MessageSendEvent_clone(arg);
24328 int64_t ret_ref = (uintptr_t)ret_copy;
24331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24332 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
24333 int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
24337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24338 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
24339 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24340 *ret_copy = MessageSendEvent_clone(orig_conv);
24341 int64_t ret_ref = (uintptr_t)ret_copy;
24345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24346 LDKPublicKey node_id_ref;
24347 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24348 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24349 LDKAcceptChannel msg_conv;
24350 msg_conv.inner = (void*)(msg & (~1));
24351 msg_conv.is_owned = (msg & 1) || (msg == 0);
24352 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24353 msg_conv = AcceptChannel_clone(&msg_conv);
24354 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24355 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
24356 int64_t ret_ref = (uintptr_t)ret_copy;
24360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24361 LDKPublicKey node_id_ref;
24362 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24363 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24364 LDKOpenChannel msg_conv;
24365 msg_conv.inner = (void*)(msg & (~1));
24366 msg_conv.is_owned = (msg & 1) || (msg == 0);
24367 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24368 msg_conv = OpenChannel_clone(&msg_conv);
24369 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24370 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
24371 int64_t ret_ref = (uintptr_t)ret_copy;
24375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24376 LDKPublicKey node_id_ref;
24377 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24378 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24379 LDKFundingCreated msg_conv;
24380 msg_conv.inner = (void*)(msg & (~1));
24381 msg_conv.is_owned = (msg & 1) || (msg == 0);
24382 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24383 msg_conv = FundingCreated_clone(&msg_conv);
24384 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24385 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
24386 int64_t ret_ref = (uintptr_t)ret_copy;
24390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24391 LDKPublicKey node_id_ref;
24392 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24393 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24394 LDKFundingSigned msg_conv;
24395 msg_conv.inner = (void*)(msg & (~1));
24396 msg_conv.is_owned = (msg & 1) || (msg == 0);
24397 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24398 msg_conv = FundingSigned_clone(&msg_conv);
24399 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24400 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
24401 int64_t ret_ref = (uintptr_t)ret_copy;
24405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24406 LDKPublicKey node_id_ref;
24407 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24408 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24409 LDKChannelReady msg_conv;
24410 msg_conv.inner = (void*)(msg & (~1));
24411 msg_conv.is_owned = (msg & 1) || (msg == 0);
24412 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24413 msg_conv = ChannelReady_clone(&msg_conv);
24414 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24415 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
24416 int64_t ret_ref = (uintptr_t)ret_copy;
24420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24421 LDKPublicKey node_id_ref;
24422 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24423 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24424 LDKAnnouncementSignatures msg_conv;
24425 msg_conv.inner = (void*)(msg & (~1));
24426 msg_conv.is_owned = (msg & 1) || (msg == 0);
24427 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24428 msg_conv = AnnouncementSignatures_clone(&msg_conv);
24429 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24430 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
24431 int64_t ret_ref = (uintptr_t)ret_copy;
24435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
24436 LDKPublicKey node_id_ref;
24437 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24438 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24439 LDKCommitmentUpdate updates_conv;
24440 updates_conv.inner = (void*)(updates & (~1));
24441 updates_conv.is_owned = (updates & 1) || (updates == 0);
24442 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24443 updates_conv = CommitmentUpdate_clone(&updates_conv);
24444 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24445 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
24446 int64_t ret_ref = (uintptr_t)ret_copy;
24450 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) {
24451 LDKPublicKey node_id_ref;
24452 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24453 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24454 LDKRevokeAndACK msg_conv;
24455 msg_conv.inner = (void*)(msg & (~1));
24456 msg_conv.is_owned = (msg & 1) || (msg == 0);
24457 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24458 msg_conv = RevokeAndACK_clone(&msg_conv);
24459 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24460 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
24461 int64_t ret_ref = (uintptr_t)ret_copy;
24465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24466 LDKPublicKey node_id_ref;
24467 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24468 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24469 LDKClosingSigned msg_conv;
24470 msg_conv.inner = (void*)(msg & (~1));
24471 msg_conv.is_owned = (msg & 1) || (msg == 0);
24472 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24473 msg_conv = ClosingSigned_clone(&msg_conv);
24474 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24475 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
24476 int64_t ret_ref = (uintptr_t)ret_copy;
24480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24481 LDKPublicKey node_id_ref;
24482 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24483 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24484 LDKShutdown msg_conv;
24485 msg_conv.inner = (void*)(msg & (~1));
24486 msg_conv.is_owned = (msg & 1) || (msg == 0);
24487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24488 msg_conv = Shutdown_clone(&msg_conv);
24489 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24490 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
24491 int64_t ret_ref = (uintptr_t)ret_copy;
24495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24496 LDKPublicKey node_id_ref;
24497 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24498 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24499 LDKChannelReestablish msg_conv;
24500 msg_conv.inner = (void*)(msg & (~1));
24501 msg_conv.is_owned = (msg & 1) || (msg == 0);
24502 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24503 msg_conv = ChannelReestablish_clone(&msg_conv);
24504 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24505 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
24506 int64_t ret_ref = (uintptr_t)ret_copy;
24510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
24511 LDKChannelAnnouncement msg_conv;
24512 msg_conv.inner = (void*)(msg & (~1));
24513 msg_conv.is_owned = (msg & 1) || (msg == 0);
24514 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24515 msg_conv = ChannelAnnouncement_clone(&msg_conv);
24516 LDKChannelUpdate update_msg_conv;
24517 update_msg_conv.inner = (void*)(update_msg & (~1));
24518 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
24519 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
24520 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
24521 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24522 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
24523 int64_t ret_ref = (uintptr_t)ret_copy;
24527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
24528 LDKNodeAnnouncement msg_conv;
24529 msg_conv.inner = (void*)(msg & (~1));
24530 msg_conv.is_owned = (msg & 1) || (msg == 0);
24531 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24532 msg_conv = NodeAnnouncement_clone(&msg_conv);
24533 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24534 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
24535 int64_t ret_ref = (uintptr_t)ret_copy;
24539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
24540 LDKChannelUpdate msg_conv;
24541 msg_conv.inner = (void*)(msg & (~1));
24542 msg_conv.is_owned = (msg & 1) || (msg == 0);
24543 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24544 msg_conv = ChannelUpdate_clone(&msg_conv);
24545 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24546 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
24547 int64_t ret_ref = (uintptr_t)ret_copy;
24551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24552 LDKPublicKey node_id_ref;
24553 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24554 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24555 LDKChannelUpdate msg_conv;
24556 msg_conv.inner = (void*)(msg & (~1));
24557 msg_conv.is_owned = (msg & 1) || (msg == 0);
24558 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24559 msg_conv = ChannelUpdate_clone(&msg_conv);
24560 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24561 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
24562 int64_t ret_ref = (uintptr_t)ret_copy;
24566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
24567 LDKPublicKey node_id_ref;
24568 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24569 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24570 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
24571 CHECK_ACCESS(action_ptr);
24572 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
24573 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
24574 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24575 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
24576 int64_t ret_ref = (uintptr_t)ret_copy;
24580 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) {
24581 LDKPublicKey node_id_ref;
24582 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24583 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24584 LDKQueryChannelRange msg_conv;
24585 msg_conv.inner = (void*)(msg & (~1));
24586 msg_conv.is_owned = (msg & 1) || (msg == 0);
24587 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24588 msg_conv = QueryChannelRange_clone(&msg_conv);
24589 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24590 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
24591 int64_t ret_ref = (uintptr_t)ret_copy;
24595 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) {
24596 LDKPublicKey node_id_ref;
24597 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24598 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24599 LDKQueryShortChannelIds msg_conv;
24600 msg_conv.inner = (void*)(msg & (~1));
24601 msg_conv.is_owned = (msg & 1) || (msg == 0);
24602 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24603 msg_conv = QueryShortChannelIds_clone(&msg_conv);
24604 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24605 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
24606 int64_t ret_ref = (uintptr_t)ret_copy;
24610 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) {
24611 LDKPublicKey node_id_ref;
24612 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24613 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24614 LDKReplyChannelRange msg_conv;
24615 msg_conv.inner = (void*)(msg & (~1));
24616 msg_conv.is_owned = (msg & 1) || (msg == 0);
24617 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24618 msg_conv = ReplyChannelRange_clone(&msg_conv);
24619 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24620 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
24621 int64_t ret_ref = (uintptr_t)ret_copy;
24625 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) {
24626 LDKPublicKey node_id_ref;
24627 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24628 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24629 LDKGossipTimestampFilter msg_conv;
24630 msg_conv.inner = (void*)(msg & (~1));
24631 msg_conv.is_owned = (msg & 1) || (msg == 0);
24632 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24633 msg_conv = GossipTimestampFilter_clone(&msg_conv);
24634 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24635 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
24636 int64_t ret_ref = (uintptr_t)ret_copy;
24640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24641 if ((this_ptr & 1) != 0) return;
24642 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24643 CHECK_ACCESS(this_ptr_ptr);
24644 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
24645 FREE((void*)this_ptr);
24646 MessageSendEventsProvider_free(this_ptr_conv);
24649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24650 if ((this_ptr & 1) != 0) return;
24651 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24652 CHECK_ACCESS(this_ptr_ptr);
24653 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
24654 FREE((void*)this_ptr);
24655 EventsProvider_free(this_ptr_conv);
24658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24659 if ((this_ptr & 1) != 0) return;
24660 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24661 CHECK_ACCESS(this_ptr_ptr);
24662 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
24663 FREE((void*)this_ptr);
24664 EventHandler_free(this_ptr_conv);
24667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24668 if ((this_ptr & 1) != 0) return;
24669 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24670 CHECK_ACCESS(this_ptr_ptr);
24671 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
24672 FREE((void*)this_ptr);
24673 APIError_free(this_ptr_conv);
24676 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
24677 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24678 *ret_copy = APIError_clone(arg);
24679 int64_t ret_ref = (uintptr_t)ret_copy;
24682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24683 LDKAPIError* arg_conv = (LDKAPIError*)arg;
24684 int64_t ret_conv = APIError_clone_ptr(arg_conv);
24688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24689 LDKAPIError* orig_conv = (LDKAPIError*)orig;
24690 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24691 *ret_copy = APIError_clone(orig_conv);
24692 int64_t ret_ref = (uintptr_t)ret_copy;
24696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
24697 LDKStr err_conv = java_to_owned_str(env, err);
24698 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24699 *ret_copy = APIError_apimisuse_error(err_conv);
24700 int64_t ret_ref = (uintptr_t)ret_copy;
24704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
24705 LDKStr err_conv = java_to_owned_str(env, err);
24706 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24707 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
24708 int64_t ret_ref = (uintptr_t)ret_copy;
24712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
24713 LDKStr err_conv = java_to_owned_str(env, err);
24714 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24715 *ret_copy = APIError_route_error(err_conv);
24716 int64_t ret_ref = (uintptr_t)ret_copy;
24720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
24721 LDKStr err_conv = java_to_owned_str(env, err);
24722 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24723 *ret_copy = APIError_channel_unavailable(err_conv);
24724 int64_t ret_ref = (uintptr_t)ret_copy;
24728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
24729 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24730 *ret_copy = APIError_monitor_update_failed();
24731 int64_t ret_ref = (uintptr_t)ret_copy;
24735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
24736 LDKShutdownScript script_conv;
24737 script_conv.inner = (void*)(script & (~1));
24738 script_conv.is_owned = (script & 1) || (script == 0);
24739 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
24740 script_conv = ShutdownScript_clone(&script_conv);
24741 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24742 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
24743 int64_t ret_ref = (uintptr_t)ret_copy;
24747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24748 LDKBigSize this_obj_conv;
24749 this_obj_conv.inner = (void*)(this_obj & (~1));
24750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24752 BigSize_free(this_obj_conv);
24755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
24756 LDKBigSize this_ptr_conv;
24757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24758 this_ptr_conv.is_owned = false;
24759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24760 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
24764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24765 LDKBigSize this_ptr_conv;
24766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24767 this_ptr_conv.is_owned = false;
24768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24769 BigSize_set_a(&this_ptr_conv, val);
24772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
24773 LDKBigSize ret_var = BigSize_new(a_arg);
24774 int64_t ret_ref = 0;
24775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24778 ret_ref = (uintptr_t)ret_var.inner;
24779 if (ret_var.is_owned) {
24785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
24786 LDKu8slice msg_ref;
24787 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24788 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24789 unsigned char sk_arr[32];
24790 CHECK((*env)->GetArrayLength(env, sk) == 32);
24791 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
24792 unsigned char (*sk_ref)[32] = &sk_arr;
24793 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
24794 *ret_conv = sign(msg_ref, sk_ref);
24795 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24796 return (int64_t)ret_conv;
24799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
24800 LDKu8slice msg_ref;
24801 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24802 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24803 LDKStr sig_conv = java_to_owned_str(env, sig);
24804 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24805 *ret_conv = recover_pk(msg_ref, sig_conv);
24806 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24807 return (int64_t)ret_conv;
24810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
24811 LDKu8slice msg_ref;
24812 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24813 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24814 LDKStr sig_conv = java_to_owned_str(env, sig);
24815 LDKPublicKey pk_ref;
24816 CHECK((*env)->GetArrayLength(env, pk) == 33);
24817 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24818 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24819 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24824 LDKu8slice hrp_bytes_ref;
24825 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24826 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24827 LDKCVec_u5Z data_without_signature_constr;
24828 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24829 if (data_without_signature_constr.datalen > 0)
24830 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24832 data_without_signature_constr.data = NULL;
24833 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24834 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24835 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24837 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24839 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24840 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24841 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24842 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24843 CVec_u8Z_free(ret_var);
24844 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24849 if ((this_ptr & 1) != 0) return;
24850 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24851 CHECK_ACCESS(this_ptr_ptr);
24852 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
24853 FREE((void*)this_ptr);
24854 Persister_free(this_ptr_conv);
24857 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24858 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
24859 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24863 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24864 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24868 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24869 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24874 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24878 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24879 jclass ret_conv = LDKLevel_to_java(env, Level_info());
24883 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24884 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24888 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24889 jclass ret_conv = LDKLevel_to_java(env, Level_error());
24893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24894 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
24895 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
24896 jboolean ret_conv = Level_eq(a_conv, b_conv);
24900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24901 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
24902 int64_t ret_conv = Level_hash(o_conv);
24906 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24907 jclass ret_conv = LDKLevel_to_java(env, Level_max());
24911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24912 LDKRecord this_obj_conv;
24913 this_obj_conv.inner = (void*)(this_obj & (~1));
24914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24916 Record_free(this_obj_conv);
24919 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24920 LDKRecord this_ptr_conv;
24921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24922 this_ptr_conv.is_owned = false;
24923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24924 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24929 LDKRecord this_ptr_conv;
24930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24931 this_ptr_conv.is_owned = false;
24932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24933 LDKLevel val_conv = LDKLevel_from_java(env, val);
24934 Record_set_level(&this_ptr_conv, val_conv);
24937 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24938 LDKRecord this_ptr_conv;
24939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24940 this_ptr_conv.is_owned = false;
24941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24942 LDKStr ret_str = Record_get_args(&this_ptr_conv);
24943 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24949 LDKRecord this_ptr_conv;
24950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24951 this_ptr_conv.is_owned = false;
24952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24953 LDKStr val_conv = java_to_owned_str(env, val);
24954 Record_set_args(&this_ptr_conv, val_conv);
24957 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24958 LDKRecord this_ptr_conv;
24959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24960 this_ptr_conv.is_owned = false;
24961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24962 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24963 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24969 LDKRecord this_ptr_conv;
24970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24971 this_ptr_conv.is_owned = false;
24972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24973 LDKStr val_conv = java_to_owned_str(env, val);
24974 Record_set_module_path(&this_ptr_conv, val_conv);
24977 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24978 LDKRecord this_ptr_conv;
24979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24980 this_ptr_conv.is_owned = false;
24981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24982 LDKStr ret_str = Record_get_file(&this_ptr_conv);
24983 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24989 LDKRecord this_ptr_conv;
24990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24991 this_ptr_conv.is_owned = false;
24992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24993 LDKStr val_conv = java_to_owned_str(env, val);
24994 Record_set_file(&this_ptr_conv, val_conv);
24997 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24998 LDKRecord this_ptr_conv;
24999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25000 this_ptr_conv.is_owned = false;
25001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25002 int32_t ret_conv = Record_get_line(&this_ptr_conv);
25006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25007 LDKRecord this_ptr_conv;
25008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25009 this_ptr_conv.is_owned = false;
25010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25011 Record_set_line(&this_ptr_conv, val);
25014 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
25015 LDKRecord ret_var = Record_clone(arg);
25016 int64_t ret_ref = 0;
25017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25020 ret_ref = (uintptr_t)ret_var.inner;
25021 if (ret_var.is_owned) {
25026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25027 LDKRecord arg_conv;
25028 arg_conv.inner = (void*)(arg & (~1));
25029 arg_conv.is_owned = false;
25030 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25031 int64_t ret_conv = Record_clone_ptr(&arg_conv);
25035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25036 LDKRecord orig_conv;
25037 orig_conv.inner = (void*)(orig & (~1));
25038 orig_conv.is_owned = false;
25039 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25040 LDKRecord ret_var = Record_clone(&orig_conv);
25041 int64_t ret_ref = 0;
25042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25045 ret_ref = (uintptr_t)ret_var.inner;
25046 if (ret_var.is_owned) {
25052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25053 if ((this_ptr & 1) != 0) return;
25054 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25055 CHECK_ACCESS(this_ptr_ptr);
25056 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
25057 FREE((void*)this_ptr);
25058 Logger_free(this_ptr_conv);
25061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25062 LDKChannelHandshakeConfig this_obj_conv;
25063 this_obj_conv.inner = (void*)(this_obj & (~1));
25064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25066 ChannelHandshakeConfig_free(this_obj_conv);
25069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
25070 LDKChannelHandshakeConfig this_ptr_conv;
25071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25072 this_ptr_conv.is_owned = false;
25073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25074 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
25078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25079 LDKChannelHandshakeConfig this_ptr_conv;
25080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25081 this_ptr_conv.is_owned = false;
25082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25083 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
25086 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25087 LDKChannelHandshakeConfig this_ptr_conv;
25088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25089 this_ptr_conv.is_owned = false;
25090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25091 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
25095 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) {
25096 LDKChannelHandshakeConfig this_ptr_conv;
25097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25098 this_ptr_conv.is_owned = false;
25099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25100 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
25103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25104 LDKChannelHandshakeConfig this_ptr_conv;
25105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25106 this_ptr_conv.is_owned = false;
25107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25108 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
25112 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) {
25113 LDKChannelHandshakeConfig this_ptr_conv;
25114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25115 this_ptr_conv.is_owned = false;
25116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25117 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
25120 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) {
25121 LDKChannelHandshakeConfig this_ptr_conv;
25122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25123 this_ptr_conv.is_owned = false;
25124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25125 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
25129 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) {
25130 LDKChannelHandshakeConfig this_ptr_conv;
25131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25132 this_ptr_conv.is_owned = false;
25133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25134 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
25137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
25138 LDKChannelHandshakeConfig this_ptr_conv;
25139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25140 this_ptr_conv.is_owned = false;
25141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25142 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
25146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25147 LDKChannelHandshakeConfig this_ptr_conv;
25148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25149 this_ptr_conv.is_owned = false;
25150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25151 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
25154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
25155 LDKChannelHandshakeConfig this_ptr_conv;
25156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25157 this_ptr_conv.is_owned = false;
25158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25159 jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
25163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25164 LDKChannelHandshakeConfig this_ptr_conv;
25165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25166 this_ptr_conv.is_owned = false;
25167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25168 ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
25171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25172 LDKChannelHandshakeConfig this_ptr_conv;
25173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25174 this_ptr_conv.is_owned = false;
25175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25176 jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
25180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25181 LDKChannelHandshakeConfig this_ptr_conv;
25182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25183 this_ptr_conv.is_owned = false;
25184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25185 ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
25188 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) {
25189 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);
25190 int64_t ret_ref = 0;
25191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25194 ret_ref = (uintptr_t)ret_var.inner;
25195 if (ret_var.is_owned) {
25201 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
25202 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
25203 int64_t ret_ref = 0;
25204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25207 ret_ref = (uintptr_t)ret_var.inner;
25208 if (ret_var.is_owned) {
25213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25214 LDKChannelHandshakeConfig arg_conv;
25215 arg_conv.inner = (void*)(arg & (~1));
25216 arg_conv.is_owned = false;
25217 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25218 int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
25222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25223 LDKChannelHandshakeConfig orig_conv;
25224 orig_conv.inner = (void*)(orig & (~1));
25225 orig_conv.is_owned = false;
25226 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25227 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
25228 int64_t ret_ref = 0;
25229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25232 ret_ref = (uintptr_t)ret_var.inner;
25233 if (ret_var.is_owned) {
25239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
25240 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
25241 int64_t ret_ref = 0;
25242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25245 ret_ref = (uintptr_t)ret_var.inner;
25246 if (ret_var.is_owned) {
25252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25253 LDKChannelHandshakeLimits this_obj_conv;
25254 this_obj_conv.inner = (void*)(this_obj & (~1));
25255 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25257 ChannelHandshakeLimits_free(this_obj_conv);
25260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25261 LDKChannelHandshakeLimits this_ptr_conv;
25262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25263 this_ptr_conv.is_owned = false;
25264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25265 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
25269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25270 LDKChannelHandshakeLimits this_ptr_conv;
25271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25272 this_ptr_conv.is_owned = false;
25273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25274 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
25277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25278 LDKChannelHandshakeLimits this_ptr_conv;
25279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25280 this_ptr_conv.is_owned = false;
25281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25282 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
25286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25287 LDKChannelHandshakeLimits this_ptr_conv;
25288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25289 this_ptr_conv.is_owned = false;
25290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25291 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
25294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25295 LDKChannelHandshakeLimits this_ptr_conv;
25296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25297 this_ptr_conv.is_owned = false;
25298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25299 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
25303 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) {
25304 LDKChannelHandshakeLimits this_ptr_conv;
25305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25306 this_ptr_conv.is_owned = false;
25307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25308 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
25311 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) {
25312 LDKChannelHandshakeLimits this_ptr_conv;
25313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25314 this_ptr_conv.is_owned = false;
25315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25316 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
25320 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) {
25321 LDKChannelHandshakeLimits this_ptr_conv;
25322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25323 this_ptr_conv.is_owned = false;
25324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25325 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
25328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25329 LDKChannelHandshakeLimits this_ptr_conv;
25330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25331 this_ptr_conv.is_owned = false;
25332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25333 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
25337 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) {
25338 LDKChannelHandshakeLimits this_ptr_conv;
25339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25340 this_ptr_conv.is_owned = false;
25341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25342 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
25345 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25346 LDKChannelHandshakeLimits this_ptr_conv;
25347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25348 this_ptr_conv.is_owned = false;
25349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25350 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
25354 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) {
25355 LDKChannelHandshakeLimits this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25359 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
25362 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
25363 LDKChannelHandshakeLimits this_ptr_conv;
25364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25365 this_ptr_conv.is_owned = false;
25366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25367 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
25371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25372 LDKChannelHandshakeLimits this_ptr_conv;
25373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25374 this_ptr_conv.is_owned = false;
25375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25376 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
25379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
25380 LDKChannelHandshakeLimits this_ptr_conv;
25381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25382 this_ptr_conv.is_owned = false;
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25384 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
25388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25389 LDKChannelHandshakeLimits this_ptr_conv;
25390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25391 this_ptr_conv.is_owned = false;
25392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25393 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
25396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
25397 LDKChannelHandshakeLimits this_ptr_conv;
25398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25399 this_ptr_conv.is_owned = false;
25400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25401 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
25405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25406 LDKChannelHandshakeLimits this_ptr_conv;
25407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25408 this_ptr_conv.is_owned = false;
25409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25410 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
25413 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25414 LDKChannelHandshakeLimits this_ptr_conv;
25415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25416 this_ptr_conv.is_owned = false;
25417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25418 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
25422 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) {
25423 LDKChannelHandshakeLimits this_ptr_conv;
25424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25425 this_ptr_conv.is_owned = false;
25426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25427 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
25430 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) {
25431 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);
25432 int64_t ret_ref = 0;
25433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25436 ret_ref = (uintptr_t)ret_var.inner;
25437 if (ret_var.is_owned) {
25443 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
25444 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
25445 int64_t ret_ref = 0;
25446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25449 ret_ref = (uintptr_t)ret_var.inner;
25450 if (ret_var.is_owned) {
25455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25456 LDKChannelHandshakeLimits arg_conv;
25457 arg_conv.inner = (void*)(arg & (~1));
25458 arg_conv.is_owned = false;
25459 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25460 int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
25464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25465 LDKChannelHandshakeLimits orig_conv;
25466 orig_conv.inner = (void*)(orig & (~1));
25467 orig_conv.is_owned = false;
25468 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25469 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
25470 int64_t ret_ref = 0;
25471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25474 ret_ref = (uintptr_t)ret_var.inner;
25475 if (ret_var.is_owned) {
25481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
25482 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
25483 int64_t ret_ref = 0;
25484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25487 ret_ref = (uintptr_t)ret_var.inner;
25488 if (ret_var.is_owned) {
25494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25495 LDKChannelConfig this_obj_conv;
25496 this_obj_conv.inner = (void*)(this_obj & (~1));
25497 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25499 ChannelConfig_free(this_obj_conv);
25502 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25503 LDKChannelConfig this_ptr_conv;
25504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25505 this_ptr_conv.is_owned = false;
25506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25507 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
25511 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) {
25512 LDKChannelConfig this_ptr_conv;
25513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25514 this_ptr_conv.is_owned = false;
25515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25516 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
25519 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25520 LDKChannelConfig this_ptr_conv;
25521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25522 this_ptr_conv.is_owned = false;
25523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25524 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
25528 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) {
25529 LDKChannelConfig this_ptr_conv;
25530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25531 this_ptr_conv.is_owned = false;
25532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25533 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
25536 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25537 LDKChannelConfig this_ptr_conv;
25538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25539 this_ptr_conv.is_owned = false;
25540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25541 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
25545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25546 LDKChannelConfig this_ptr_conv;
25547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25548 this_ptr_conv.is_owned = false;
25549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25550 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
25553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25554 LDKChannelConfig this_ptr_conv;
25555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25556 this_ptr_conv.is_owned = false;
25557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25558 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
25562 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) {
25563 LDKChannelConfig this_ptr_conv;
25564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25565 this_ptr_conv.is_owned = false;
25566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25567 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
25570 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) {
25571 LDKChannelConfig this_ptr_conv;
25572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25573 this_ptr_conv.is_owned = false;
25574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25575 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
25579 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) {
25580 LDKChannelConfig this_ptr_conv;
25581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25582 this_ptr_conv.is_owned = false;
25583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25584 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
25587 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) {
25588 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);
25589 int64_t ret_ref = 0;
25590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25593 ret_ref = (uintptr_t)ret_var.inner;
25594 if (ret_var.is_owned) {
25600 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
25601 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
25602 int64_t ret_ref = 0;
25603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25606 ret_ref = (uintptr_t)ret_var.inner;
25607 if (ret_var.is_owned) {
25612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25613 LDKChannelConfig arg_conv;
25614 arg_conv.inner = (void*)(arg & (~1));
25615 arg_conv.is_owned = false;
25616 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25617 int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
25621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25622 LDKChannelConfig orig_conv;
25623 orig_conv.inner = (void*)(orig & (~1));
25624 orig_conv.is_owned = false;
25625 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25626 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
25627 int64_t ret_ref = 0;
25628 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25629 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25630 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25631 ret_ref = (uintptr_t)ret_var.inner;
25632 if (ret_var.is_owned) {
25638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
25639 LDKChannelConfig ret_var = ChannelConfig_default();
25640 int64_t ret_ref = 0;
25641 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25642 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25644 ret_ref = (uintptr_t)ret_var.inner;
25645 if (ret_var.is_owned) {
25651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
25652 LDKChannelConfig obj_conv;
25653 obj_conv.inner = (void*)(obj & (~1));
25654 obj_conv.is_owned = false;
25655 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25656 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
25657 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25658 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25659 CVec_u8Z_free(ret_var);
25663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25664 LDKu8slice ser_ref;
25665 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25666 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25667 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25668 *ret_conv = ChannelConfig_read(ser_ref);
25669 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25670 return (int64_t)ret_conv;
25673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25674 LDKUserConfig this_obj_conv;
25675 this_obj_conv.inner = (void*)(this_obj & (~1));
25676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25678 UserConfig_free(this_obj_conv);
25681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25682 LDKUserConfig this_ptr_conv;
25683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25684 this_ptr_conv.is_owned = false;
25685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25686 LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
25687 int64_t ret_ref = 0;
25688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25691 ret_ref = (uintptr_t)ret_var.inner;
25692 if (ret_var.is_owned) {
25698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25699 LDKUserConfig this_ptr_conv;
25700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25701 this_ptr_conv.is_owned = false;
25702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25703 LDKChannelHandshakeConfig val_conv;
25704 val_conv.inner = (void*)(val & (~1));
25705 val_conv.is_owned = (val & 1) || (val == 0);
25706 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25707 val_conv = ChannelHandshakeConfig_clone(&val_conv);
25708 UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
25711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
25712 LDKUserConfig this_ptr_conv;
25713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25714 this_ptr_conv.is_owned = false;
25715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25716 LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
25717 int64_t ret_ref = 0;
25718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25721 ret_ref = (uintptr_t)ret_var.inner;
25722 if (ret_var.is_owned) {
25728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25729 LDKUserConfig this_ptr_conv;
25730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25731 this_ptr_conv.is_owned = false;
25732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25733 LDKChannelHandshakeLimits val_conv;
25734 val_conv.inner = (void*)(val & (~1));
25735 val_conv.is_owned = (val & 1) || (val == 0);
25736 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25737 val_conv = ChannelHandshakeLimits_clone(&val_conv);
25738 UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
25741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25742 LDKUserConfig this_ptr_conv;
25743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25744 this_ptr_conv.is_owned = false;
25745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25746 LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
25747 int64_t ret_ref = 0;
25748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25751 ret_ref = (uintptr_t)ret_var.inner;
25752 if (ret_var.is_owned) {
25758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25759 LDKUserConfig this_ptr_conv;
25760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25761 this_ptr_conv.is_owned = false;
25762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25763 LDKChannelConfig val_conv;
25764 val_conv.inner = (void*)(val & (~1));
25765 val_conv.is_owned = (val & 1) || (val == 0);
25766 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25767 val_conv = ChannelConfig_clone(&val_conv);
25768 UserConfig_set_channel_config(&this_ptr_conv, val_conv);
25771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25772 LDKUserConfig this_ptr_conv;
25773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25774 this_ptr_conv.is_owned = false;
25775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25776 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
25780 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) {
25781 LDKUserConfig this_ptr_conv;
25782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25783 this_ptr_conv.is_owned = false;
25784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25785 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
25788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25789 LDKUserConfig this_ptr_conv;
25790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25791 this_ptr_conv.is_owned = false;
25792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25793 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
25797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25798 LDKUserConfig this_ptr_conv;
25799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25800 this_ptr_conv.is_owned = false;
25801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25802 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
25805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25806 LDKUserConfig this_ptr_conv;
25807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25808 this_ptr_conv.is_owned = false;
25809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25810 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
25814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25815 LDKUserConfig this_ptr_conv;
25816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25817 this_ptr_conv.is_owned = false;
25818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25819 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
25822 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) {
25823 LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
25824 channel_handshake_config_arg_conv.inner = (void*)(channel_handshake_config_arg & (~1));
25825 channel_handshake_config_arg_conv.is_owned = (channel_handshake_config_arg & 1) || (channel_handshake_config_arg == 0);
25826 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
25827 channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
25828 LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
25829 channel_handshake_limits_arg_conv.inner = (void*)(channel_handshake_limits_arg & (~1));
25830 channel_handshake_limits_arg_conv.is_owned = (channel_handshake_limits_arg & 1) || (channel_handshake_limits_arg == 0);
25831 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
25832 channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
25833 LDKChannelConfig channel_config_arg_conv;
25834 channel_config_arg_conv.inner = (void*)(channel_config_arg & (~1));
25835 channel_config_arg_conv.is_owned = (channel_config_arg & 1) || (channel_config_arg == 0);
25836 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
25837 channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
25838 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);
25839 int64_t ret_ref = 0;
25840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25843 ret_ref = (uintptr_t)ret_var.inner;
25844 if (ret_var.is_owned) {
25850 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
25851 LDKUserConfig ret_var = UserConfig_clone(arg);
25852 int64_t ret_ref = 0;
25853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25856 ret_ref = (uintptr_t)ret_var.inner;
25857 if (ret_var.is_owned) {
25862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25863 LDKUserConfig arg_conv;
25864 arg_conv.inner = (void*)(arg & (~1));
25865 arg_conv.is_owned = false;
25866 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25867 int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
25871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25872 LDKUserConfig orig_conv;
25873 orig_conv.inner = (void*)(orig & (~1));
25874 orig_conv.is_owned = false;
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25876 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25877 int64_t ret_ref = 0;
25878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25881 ret_ref = (uintptr_t)ret_var.inner;
25882 if (ret_var.is_owned) {
25888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25889 LDKUserConfig ret_var = UserConfig_default();
25890 int64_t ret_ref = 0;
25891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25894 ret_ref = (uintptr_t)ret_var.inner;
25895 if (ret_var.is_owned) {
25901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25902 LDKBestBlock this_obj_conv;
25903 this_obj_conv.inner = (void*)(this_obj & (~1));
25904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25906 BestBlock_free(this_obj_conv);
25909 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25910 LDKBestBlock ret_var = BestBlock_clone(arg);
25911 int64_t ret_ref = 0;
25912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25915 ret_ref = (uintptr_t)ret_var.inner;
25916 if (ret_var.is_owned) {
25921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25922 LDKBestBlock arg_conv;
25923 arg_conv.inner = (void*)(arg & (~1));
25924 arg_conv.is_owned = false;
25925 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25926 int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25931 LDKBestBlock orig_conv;
25932 orig_conv.inner = (void*)(orig & (~1));
25933 orig_conv.is_owned = false;
25934 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25935 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25936 int64_t ret_ref = 0;
25937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25940 ret_ref = (uintptr_t)ret_var.inner;
25941 if (ret_var.is_owned) {
25947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25948 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25949 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25950 int64_t ret_ref = 0;
25951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25954 ret_ref = (uintptr_t)ret_var.inner;
25955 if (ret_var.is_owned) {
25961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25962 LDKThirtyTwoBytes block_hash_ref;
25963 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25964 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25965 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25966 int64_t ret_ref = 0;
25967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25970 ret_ref = (uintptr_t)ret_var.inner;
25971 if (ret_var.is_owned) {
25977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25978 LDKBestBlock this_arg_conv;
25979 this_arg_conv.inner = (void*)(this_arg & (~1));
25980 this_arg_conv.is_owned = false;
25981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25982 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25987 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25988 LDKBestBlock this_arg_conv;
25989 this_arg_conv.inner = (void*)(this_arg & (~1));
25990 this_arg_conv.is_owned = false;
25991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25992 int32_t ret_conv = BestBlock_height(&this_arg_conv);
25996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25997 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
25998 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
26002 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
26003 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
26007 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
26008 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
26012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26013 if ((this_ptr & 1) != 0) return;
26014 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26015 CHECK_ACCESS(this_ptr_ptr);
26016 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
26017 FREE((void*)this_ptr);
26018 Access_free(this_ptr_conv);
26021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26022 if ((this_ptr & 1) != 0) return;
26023 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26024 CHECK_ACCESS(this_ptr_ptr);
26025 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
26026 FREE((void*)this_ptr);
26027 Listen_free(this_ptr_conv);
26030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26031 if ((this_ptr & 1) != 0) return;
26032 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26033 CHECK_ACCESS(this_ptr_ptr);
26034 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
26035 FREE((void*)this_ptr);
26036 Confirm_free(this_ptr_conv);
26039 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26040 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
26041 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
26045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
26046 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
26050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
26051 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
26055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26056 if ((this_ptr & 1) != 0) return;
26057 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26058 CHECK_ACCESS(this_ptr_ptr);
26059 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
26060 FREE((void*)this_ptr);
26061 Watch_free(this_ptr_conv);
26064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26065 if ((this_ptr & 1) != 0) return;
26066 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26067 CHECK_ACCESS(this_ptr_ptr);
26068 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
26069 FREE((void*)this_ptr);
26070 Filter_free(this_ptr_conv);
26073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26074 LDKWatchedOutput this_obj_conv;
26075 this_obj_conv.inner = (void*)(this_obj & (~1));
26076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26078 WatchedOutput_free(this_obj_conv);
26081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
26082 LDKWatchedOutput this_ptr_conv;
26083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26084 this_ptr_conv.is_owned = false;
26085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26086 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26087 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
26091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26092 LDKWatchedOutput this_ptr_conv;
26093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26094 this_ptr_conv.is_owned = false;
26095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26096 LDKThirtyTwoBytes val_ref;
26097 CHECK((*env)->GetArrayLength(env, val) == 32);
26098 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26099 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
26102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26103 LDKWatchedOutput this_ptr_conv;
26104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26105 this_ptr_conv.is_owned = false;
26106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26107 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
26108 int64_t ret_ref = 0;
26109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26112 ret_ref = (uintptr_t)ret_var.inner;
26113 if (ret_var.is_owned) {
26119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26120 LDKWatchedOutput this_ptr_conv;
26121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26122 this_ptr_conv.is_owned = false;
26123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26124 LDKOutPoint val_conv;
26125 val_conv.inner = (void*)(val & (~1));
26126 val_conv.is_owned = (val & 1) || (val == 0);
26127 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26128 val_conv = OutPoint_clone(&val_conv);
26129 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
26132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26133 LDKWatchedOutput this_ptr_conv;
26134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26135 this_ptr_conv.is_owned = false;
26136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26137 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
26138 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26139 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26144 LDKWatchedOutput this_ptr_conv;
26145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26146 this_ptr_conv.is_owned = false;
26147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26148 LDKCVec_u8Z val_ref;
26149 val_ref.datalen = (*env)->GetArrayLength(env, val);
26150 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26151 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26152 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
26155 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) {
26156 LDKThirtyTwoBytes block_hash_arg_ref;
26157 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
26158 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
26159 LDKOutPoint outpoint_arg_conv;
26160 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26161 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26162 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26163 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26164 LDKCVec_u8Z script_pubkey_arg_ref;
26165 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
26166 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26167 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
26168 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
26169 int64_t ret_ref = 0;
26170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26173 ret_ref = (uintptr_t)ret_var.inner;
26174 if (ret_var.is_owned) {
26180 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
26181 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
26182 int64_t ret_ref = 0;
26183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26186 ret_ref = (uintptr_t)ret_var.inner;
26187 if (ret_var.is_owned) {
26192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26193 LDKWatchedOutput arg_conv;
26194 arg_conv.inner = (void*)(arg & (~1));
26195 arg_conv.is_owned = false;
26196 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26197 int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
26201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26202 LDKWatchedOutput orig_conv;
26203 orig_conv.inner = (void*)(orig & (~1));
26204 orig_conv.is_owned = false;
26205 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26206 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
26207 int64_t ret_ref = 0;
26208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26211 ret_ref = (uintptr_t)ret_var.inner;
26212 if (ret_var.is_owned) {
26218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
26219 LDKWatchedOutput o_conv;
26220 o_conv.inner = (void*)(o & (~1));
26221 o_conv.is_owned = false;
26222 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26223 int64_t ret_conv = WatchedOutput_hash(&o_conv);
26227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26228 if ((this_ptr & 1) != 0) return;
26229 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26230 CHECK_ACCESS(this_ptr_ptr);
26231 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
26232 FREE((void*)this_ptr);
26233 BroadcasterInterface_free(this_ptr_conv);
26236 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26237 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
26238 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
26242 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
26243 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
26247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
26248 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
26252 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
26253 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
26257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26258 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
26259 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
26260 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
26264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26265 if ((this_ptr & 1) != 0) return;
26266 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26267 CHECK_ACCESS(this_ptr_ptr);
26268 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
26269 FREE((void*)this_ptr);
26270 FeeEstimator_free(this_ptr_conv);
26273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26274 LDKMonitorUpdateId this_obj_conv;
26275 this_obj_conv.inner = (void*)(this_obj & (~1));
26276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26278 MonitorUpdateId_free(this_obj_conv);
26281 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
26282 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
26283 int64_t ret_ref = 0;
26284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26287 ret_ref = (uintptr_t)ret_var.inner;
26288 if (ret_var.is_owned) {
26293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26294 LDKMonitorUpdateId arg_conv;
26295 arg_conv.inner = (void*)(arg & (~1));
26296 arg_conv.is_owned = false;
26297 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26298 int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
26302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26303 LDKMonitorUpdateId orig_conv;
26304 orig_conv.inner = (void*)(orig & (~1));
26305 orig_conv.is_owned = false;
26306 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26307 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
26308 int64_t ret_ref = 0;
26309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26312 ret_ref = (uintptr_t)ret_var.inner;
26313 if (ret_var.is_owned) {
26319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
26320 LDKMonitorUpdateId o_conv;
26321 o_conv.inner = (void*)(o & (~1));
26322 o_conv.is_owned = false;
26323 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26324 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
26328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26329 LDKMonitorUpdateId a_conv;
26330 a_conv.inner = (void*)(a & (~1));
26331 a_conv.is_owned = false;
26332 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26333 LDKMonitorUpdateId b_conv;
26334 b_conv.inner = (void*)(b & (~1));
26335 b_conv.is_owned = false;
26336 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26337 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
26341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26342 if ((this_ptr & 1) != 0) return;
26343 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26344 CHECK_ACCESS(this_ptr_ptr);
26345 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
26346 FREE((void*)this_ptr);
26347 Persist_free(this_ptr_conv);
26350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26351 LDKLockedChannelMonitor this_obj_conv;
26352 this_obj_conv.inner = (void*)(this_obj & (~1));
26353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26355 LockedChannelMonitor_free(this_obj_conv);
26358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26359 LDKChainMonitor this_obj_conv;
26360 this_obj_conv.inner = (void*)(this_obj & (~1));
26361 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26363 ChainMonitor_free(this_obj_conv);
26366 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) {
26367 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
26368 CHECK_ACCESS(chain_source_ptr);
26369 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
26370 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
26371 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
26372 // Manually implement clone for Java trait instances
26373 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
26374 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26375 LDKFilter_JCalls_cloned(&chain_source_conv.some);
26378 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26379 CHECK_ACCESS(broadcaster_ptr);
26380 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26381 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26382 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26383 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26385 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26386 CHECK_ACCESS(logger_ptr);
26387 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26388 if (logger_conv.free == LDKLogger_JCalls_free) {
26389 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26390 LDKLogger_JCalls_cloned(&logger_conv);
26392 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
26393 CHECK_ACCESS(feeest_ptr);
26394 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
26395 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
26396 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26397 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
26399 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
26400 CHECK_ACCESS(persister_ptr);
26401 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
26402 if (persister_conv.free == LDKPersist_JCalls_free) {
26403 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26404 LDKPersist_JCalls_cloned(&persister_conv);
26406 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
26407 int64_t ret_ref = 0;
26408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26411 ret_ref = (uintptr_t)ret_var.inner;
26412 if (ret_var.is_owned) {
26418 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) {
26419 LDKChainMonitor this_arg_conv;
26420 this_arg_conv.inner = (void*)(this_arg & (~1));
26421 this_arg_conv.is_owned = false;
26422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26423 LDKCVec_ChannelDetailsZ ignored_channels_constr;
26424 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
26425 if (ignored_channels_constr.datalen > 0)
26426 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26428 ignored_channels_constr.data = NULL;
26429 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
26430 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
26431 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
26432 LDKChannelDetails ignored_channels_conv_16_conv;
26433 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
26434 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
26435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
26436 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
26437 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
26439 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
26440 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
26441 int64_tArray ret_arr = NULL;
26442 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26443 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26444 for (size_t j = 0; j < ret_var.datalen; j++) {
26445 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26446 *ret_conv_9_copy = ret_var.data[j];
26447 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
26448 ret_arr_ptr[j] = ret_conv_9_ref;
26450 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26451 FREE(ret_var.data);
26455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
26456 LDKChainMonitor this_arg_conv;
26457 this_arg_conv.inner = (void*)(this_arg & (~1));
26458 this_arg_conv.is_owned = false;
26459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26460 LDKOutPoint funding_txo_conv;
26461 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26462 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26463 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26464 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26465 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26466 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
26467 return (int64_t)ret_conv;
26470 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
26471 LDKChainMonitor this_arg_conv;
26472 this_arg_conv.inner = (void*)(this_arg & (~1));
26473 this_arg_conv.is_owned = false;
26474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26475 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
26476 int64_tArray ret_arr = NULL;
26477 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26478 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26479 for (size_t k = 0; k < ret_var.datalen; k++) {
26480 LDKOutPoint ret_conv_10_var = ret_var.data[k];
26481 int64_t ret_conv_10_ref = 0;
26482 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26483 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
26485 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
26486 if (ret_conv_10_var.is_owned) {
26487 ret_conv_10_ref |= 1;
26489 ret_arr_ptr[k] = ret_conv_10_ref;
26491 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26492 FREE(ret_var.data);
26496 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) {
26497 LDKChainMonitor this_arg_conv;
26498 this_arg_conv.inner = (void*)(this_arg & (~1));
26499 this_arg_conv.is_owned = false;
26500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26501 LDKOutPoint funding_txo_conv;
26502 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26503 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26504 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26505 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26506 LDKMonitorUpdateId completed_update_id_conv;
26507 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
26508 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
26509 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
26510 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
26511 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26512 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
26513 return (int64_t)ret_conv;
26516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
26517 LDKChainMonitor this_arg_conv;
26518 this_arg_conv.inner = (void*)(this_arg & (~1));
26519 this_arg_conv.is_owned = false;
26520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26521 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26522 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
26523 return (int64_t)ret_ret;
26526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
26527 LDKChainMonitor this_arg_conv;
26528 this_arg_conv.inner = (void*)(this_arg & (~1));
26529 this_arg_conv.is_owned = false;
26530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26531 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26532 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
26533 return (int64_t)ret_ret;
26536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26537 LDKChainMonitor this_arg_conv;
26538 this_arg_conv.inner = (void*)(this_arg & (~1));
26539 this_arg_conv.is_owned = false;
26540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26541 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
26542 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
26543 return (int64_t)ret_ret;
26546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26547 LDKChainMonitor this_arg_conv;
26548 this_arg_conv.inner = (void*)(this_arg & (~1));
26549 this_arg_conv.is_owned = false;
26550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26551 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26552 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
26553 return (int64_t)ret_ret;
26556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26557 LDKChannelMonitorUpdate this_obj_conv;
26558 this_obj_conv.inner = (void*)(this_obj & (~1));
26559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26561 ChannelMonitorUpdate_free(this_obj_conv);
26564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26565 LDKChannelMonitorUpdate this_ptr_conv;
26566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26567 this_ptr_conv.is_owned = false;
26568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26569 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
26573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26574 LDKChannelMonitorUpdate this_ptr_conv;
26575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26576 this_ptr_conv.is_owned = false;
26577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26578 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
26581 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
26582 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
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) {
26593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26594 LDKChannelMonitorUpdate arg_conv;
26595 arg_conv.inner = (void*)(arg & (~1));
26596 arg_conv.is_owned = false;
26597 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26598 int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
26602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26603 LDKChannelMonitorUpdate orig_conv;
26604 orig_conv.inner = (void*)(orig & (~1));
26605 orig_conv.is_owned = false;
26606 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26607 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
26608 int64_t ret_ref = 0;
26609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26612 ret_ref = (uintptr_t)ret_var.inner;
26613 if (ret_var.is_owned) {
26619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26620 LDKChannelMonitorUpdate obj_conv;
26621 obj_conv.inner = (void*)(obj & (~1));
26622 obj_conv.is_owned = false;
26623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26624 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
26625 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26626 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26627 CVec_u8Z_free(ret_var);
26631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26632 LDKu8slice ser_ref;
26633 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26634 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26635 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26636 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
26637 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26638 return (int64_t)ret_conv;
26641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26642 if ((this_ptr & 1) != 0) return;
26643 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26644 CHECK_ACCESS(this_ptr_ptr);
26645 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
26646 FREE((void*)this_ptr);
26647 MonitorEvent_free(this_ptr_conv);
26650 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
26651 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26652 *ret_copy = MonitorEvent_clone(arg);
26653 int64_t ret_ref = (uintptr_t)ret_copy;
26656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26657 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
26658 int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
26662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26663 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
26664 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26665 *ret_copy = MonitorEvent_clone(orig_conv);
26666 int64_t ret_ref = (uintptr_t)ret_copy;
26670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
26671 LDKHTLCUpdate a_conv;
26672 a_conv.inner = (void*)(a & (~1));
26673 a_conv.is_owned = (a & 1) || (a == 0);
26674 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26675 a_conv = HTLCUpdate_clone(&a_conv);
26676 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26677 *ret_copy = MonitorEvent_htlcevent(a_conv);
26678 int64_t ret_ref = (uintptr_t)ret_copy;
26682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
26683 LDKOutPoint a_conv;
26684 a_conv.inner = (void*)(a & (~1));
26685 a_conv.is_owned = (a & 1) || (a == 0);
26686 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26687 a_conv = OutPoint_clone(&a_conv);
26688 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26689 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
26690 int64_t ret_ref = (uintptr_t)ret_copy;
26694 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) {
26695 LDKOutPoint funding_txo_conv;
26696 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26697 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26698 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26699 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26700 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26701 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
26702 int64_t ret_ref = (uintptr_t)ret_copy;
26706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
26707 LDKOutPoint a_conv;
26708 a_conv.inner = (void*)(a & (~1));
26709 a_conv.is_owned = (a & 1) || (a == 0);
26710 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26711 a_conv = OutPoint_clone(&a_conv);
26712 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26713 *ret_copy = MonitorEvent_update_failed(a_conv);
26714 int64_t ret_ref = (uintptr_t)ret_copy;
26718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
26719 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
26720 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
26721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26723 CVec_u8Z_free(ret_var);
26727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26728 LDKu8slice ser_ref;
26729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26731 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26732 *ret_conv = MonitorEvent_read(ser_ref);
26733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26734 return (int64_t)ret_conv;
26737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26738 LDKHTLCUpdate this_obj_conv;
26739 this_obj_conv.inner = (void*)(this_obj & (~1));
26740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26742 HTLCUpdate_free(this_obj_conv);
26745 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
26746 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
26747 int64_t ret_ref = 0;
26748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26751 ret_ref = (uintptr_t)ret_var.inner;
26752 if (ret_var.is_owned) {
26757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26758 LDKHTLCUpdate arg_conv;
26759 arg_conv.inner = (void*)(arg & (~1));
26760 arg_conv.is_owned = false;
26761 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26762 int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
26766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26767 LDKHTLCUpdate orig_conv;
26768 orig_conv.inner = (void*)(orig & (~1));
26769 orig_conv.is_owned = false;
26770 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26771 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
26772 int64_t ret_ref = 0;
26773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26776 ret_ref = (uintptr_t)ret_var.inner;
26777 if (ret_var.is_owned) {
26783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26784 LDKHTLCUpdate obj_conv;
26785 obj_conv.inner = (void*)(obj & (~1));
26786 obj_conv.is_owned = false;
26787 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26788 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
26789 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26790 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26791 CVec_u8Z_free(ret_var);
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26796 LDKu8slice ser_ref;
26797 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26798 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26799 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26800 *ret_conv = HTLCUpdate_read(ser_ref);
26801 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26802 return (int64_t)ret_conv;
26805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26806 if ((this_ptr & 1) != 0) return;
26807 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26808 CHECK_ACCESS(this_ptr_ptr);
26809 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
26810 FREE((void*)this_ptr);
26811 Balance_free(this_ptr_conv);
26814 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
26815 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26816 *ret_copy = Balance_clone(arg);
26817 int64_t ret_ref = (uintptr_t)ret_copy;
26820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26821 LDKBalance* arg_conv = (LDKBalance*)arg;
26822 int64_t ret_conv = Balance_clone_ptr(arg_conv);
26826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26827 LDKBalance* orig_conv = (LDKBalance*)orig;
26828 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26829 *ret_copy = Balance_clone(orig_conv);
26830 int64_t ret_ref = (uintptr_t)ret_copy;
26834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
26835 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26836 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
26837 int64_t ret_ref = (uintptr_t)ret_copy;
26841 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) {
26842 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26843 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
26844 int64_t ret_ref = (uintptr_t)ret_copy;
26848 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) {
26849 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26850 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
26851 int64_t ret_ref = (uintptr_t)ret_copy;
26855 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) {
26856 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26857 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
26858 int64_t ret_ref = (uintptr_t)ret_copy;
26862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26863 LDKBalance* a_conv = (LDKBalance*)a;
26864 LDKBalance* b_conv = (LDKBalance*)b;
26865 jboolean ret_conv = Balance_eq(a_conv, b_conv);
26869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26870 LDKChannelMonitor this_obj_conv;
26871 this_obj_conv.inner = (void*)(this_obj & (~1));
26872 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26874 ChannelMonitor_free(this_obj_conv);
26877 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26878 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26879 int64_t ret_ref = 0;
26880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26883 ret_ref = (uintptr_t)ret_var.inner;
26884 if (ret_var.is_owned) {
26889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26890 LDKChannelMonitor arg_conv;
26891 arg_conv.inner = (void*)(arg & (~1));
26892 arg_conv.is_owned = false;
26893 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26894 int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26899 LDKChannelMonitor orig_conv;
26900 orig_conv.inner = (void*)(orig & (~1));
26901 orig_conv.is_owned = false;
26902 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26903 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26904 int64_t ret_ref = 0;
26905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26908 ret_ref = (uintptr_t)ret_var.inner;
26909 if (ret_var.is_owned) {
26915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26916 LDKChannelMonitor obj_conv;
26917 obj_conv.inner = (void*)(obj & (~1));
26918 obj_conv.is_owned = false;
26919 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26920 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26921 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26922 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26923 CVec_u8Z_free(ret_var);
26927 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) {
26928 LDKChannelMonitor this_arg_conv;
26929 this_arg_conv.inner = (void*)(this_arg & (~1));
26930 this_arg_conv.is_owned = false;
26931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26932 LDKChannelMonitorUpdate updates_conv;
26933 updates_conv.inner = (void*)(updates & (~1));
26934 updates_conv.is_owned = false;
26935 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26936 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26937 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
26938 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26939 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26940 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
26941 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
26942 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26943 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26944 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26945 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26946 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26947 return (int64_t)ret_conv;
26950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26951 LDKChannelMonitor this_arg_conv;
26952 this_arg_conv.inner = (void*)(this_arg & (~1));
26953 this_arg_conv.is_owned = false;
26954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26955 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26960 LDKChannelMonitor this_arg_conv;
26961 this_arg_conv.inner = (void*)(this_arg & (~1));
26962 this_arg_conv.is_owned = false;
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26964 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26965 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26966 return ((int64_t)ret_conv);
26969 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26970 LDKChannelMonitor this_arg_conv;
26971 this_arg_conv.inner = (void*)(this_arg & (~1));
26972 this_arg_conv.is_owned = false;
26973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26974 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26975 int64_tArray ret_arr = NULL;
26976 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26977 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26978 for (size_t o = 0; o < ret_var.datalen; o++) {
26979 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26980 *ret_conv_40_conv = ret_var.data[o];
26981 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
26983 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26984 FREE(ret_var.data);
26988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26989 LDKChannelMonitor this_arg_conv;
26990 this_arg_conv.inner = (void*)(this_arg & (~1));
26991 this_arg_conv.is_owned = false;
26992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26993 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
26994 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
26995 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26996 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26999 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27000 LDKChannelMonitor this_arg_conv;
27001 this_arg_conv.inner = (void*)(this_arg & (~1));
27002 this_arg_conv.is_owned = false;
27003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27004 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
27005 int64_tArray ret_arr = NULL;
27006 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27007 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27008 for (size_t o = 0; o < ret_var.datalen; o++) {
27009 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27010 *ret_conv_14_copy = ret_var.data[o];
27011 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
27012 ret_arr_ptr[o] = ret_conv_14_ref;
27014 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27015 FREE(ret_var.data);
27019 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27020 LDKChannelMonitor this_arg_conv;
27021 this_arg_conv.inner = (void*)(this_arg & (~1));
27022 this_arg_conv.is_owned = false;
27023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27024 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
27025 int64_tArray ret_arr = NULL;
27026 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27027 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27028 for (size_t h = 0; h < ret_var.datalen; h++) {
27029 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
27030 *ret_conv_7_copy = ret_var.data[h];
27031 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
27032 ret_arr_ptr[h] = ret_conv_7_ref;
27034 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27035 FREE(ret_var.data);
27039 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) {
27040 LDKChannelMonitor this_arg_conv;
27041 this_arg_conv.inner = (void*)(this_arg & (~1));
27042 this_arg_conv.is_owned = false;
27043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27044 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27045 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
27046 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
27047 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
27048 jobjectArray ret_arr = NULL;
27049 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27051 for (size_t i = 0; i < ret_var.datalen; i++) {
27052 LDKTransaction ret_conv_8_var = ret_var.data[i];
27053 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
27054 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
27055 Transaction_free(ret_conv_8_var);
27056 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27059 FREE(ret_var.data);
27063 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) {
27064 LDKChannelMonitor this_arg_conv;
27065 this_arg_conv.inner = (void*)(this_arg & (~1));
27066 this_arg_conv.is_owned = false;
27067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27068 unsigned char header_arr[80];
27069 CHECK((*env)->GetArrayLength(env, header) == 80);
27070 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27071 unsigned char (*header_ref)[80] = &header_arr;
27072 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27073 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27074 if (txdata_constr.datalen > 0)
27075 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27077 txdata_constr.data = NULL;
27078 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27079 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27080 int64_t txdata_conv_28 = txdata_vals[c];
27081 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27082 CHECK_ACCESS(txdata_conv_28_ptr);
27083 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27084 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27085 txdata_constr.data[c] = txdata_conv_28_conv;
27087 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27088 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27089 CHECK_ACCESS(broadcaster_ptr);
27090 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27091 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27092 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27093 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27095 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27096 CHECK_ACCESS(fee_estimator_ptr);
27097 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27098 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27099 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27100 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27102 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27103 CHECK_ACCESS(logger_ptr);
27104 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27105 if (logger_conv.free == LDKLogger_JCalls_free) {
27106 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27107 LDKLogger_JCalls_cloned(&logger_conv);
27109 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);
27110 int64_tArray ret_arr = NULL;
27111 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27112 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27113 for (size_t n = 0; n < ret_var.datalen; n++) {
27114 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27115 *ret_conv_39_conv = ret_var.data[n];
27116 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27118 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27119 FREE(ret_var.data);
27123 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) {
27124 LDKChannelMonitor this_arg_conv;
27125 this_arg_conv.inner = (void*)(this_arg & (~1));
27126 this_arg_conv.is_owned = false;
27127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27128 unsigned char header_arr[80];
27129 CHECK((*env)->GetArrayLength(env, header) == 80);
27130 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27131 unsigned char (*header_ref)[80] = &header_arr;
27132 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27133 CHECK_ACCESS(broadcaster_ptr);
27134 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27135 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27137 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27139 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27140 CHECK_ACCESS(fee_estimator_ptr);
27141 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27142 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27143 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27144 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27146 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27147 CHECK_ACCESS(logger_ptr);
27148 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27149 if (logger_conv.free == LDKLogger_JCalls_free) {
27150 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27151 LDKLogger_JCalls_cloned(&logger_conv);
27153 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27156 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) {
27157 LDKChannelMonitor this_arg_conv;
27158 this_arg_conv.inner = (void*)(this_arg & (~1));
27159 this_arg_conv.is_owned = false;
27160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27161 unsigned char header_arr[80];
27162 CHECK((*env)->GetArrayLength(env, header) == 80);
27163 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27164 unsigned char (*header_ref)[80] = &header_arr;
27165 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27166 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27167 if (txdata_constr.datalen > 0)
27168 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27170 txdata_constr.data = NULL;
27171 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27172 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27173 int64_t txdata_conv_28 = txdata_vals[c];
27174 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27175 CHECK_ACCESS(txdata_conv_28_ptr);
27176 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27177 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27178 txdata_constr.data[c] = txdata_conv_28_conv;
27180 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27181 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27182 CHECK_ACCESS(broadcaster_ptr);
27183 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27184 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27185 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27186 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27188 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27189 CHECK_ACCESS(fee_estimator_ptr);
27190 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27191 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27192 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27193 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27195 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27196 CHECK_ACCESS(logger_ptr);
27197 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27198 if (logger_conv.free == LDKLogger_JCalls_free) {
27199 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27200 LDKLogger_JCalls_cloned(&logger_conv);
27202 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);
27203 int64_tArray ret_arr = NULL;
27204 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27205 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27206 for (size_t n = 0; n < ret_var.datalen; n++) {
27207 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27208 *ret_conv_39_conv = ret_var.data[n];
27209 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27211 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27212 FREE(ret_var.data);
27216 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) {
27217 LDKChannelMonitor this_arg_conv;
27218 this_arg_conv.inner = (void*)(this_arg & (~1));
27219 this_arg_conv.is_owned = false;
27220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27221 unsigned char txid_arr[32];
27222 CHECK((*env)->GetArrayLength(env, txid) == 32);
27223 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
27224 unsigned char (*txid_ref)[32] = &txid_arr;
27225 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27226 CHECK_ACCESS(broadcaster_ptr);
27227 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27228 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27230 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27232 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27233 CHECK_ACCESS(fee_estimator_ptr);
27234 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27235 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27236 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27237 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27239 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27240 CHECK_ACCESS(logger_ptr);
27241 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27242 if (logger_conv.free == LDKLogger_JCalls_free) {
27243 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27244 LDKLogger_JCalls_cloned(&logger_conv);
27246 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
27249 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) {
27250 LDKChannelMonitor this_arg_conv;
27251 this_arg_conv.inner = (void*)(this_arg & (~1));
27252 this_arg_conv.is_owned = false;
27253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27254 unsigned char header_arr[80];
27255 CHECK((*env)->GetArrayLength(env, header) == 80);
27256 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27257 unsigned char (*header_ref)[80] = &header_arr;
27258 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27259 CHECK_ACCESS(broadcaster_ptr);
27260 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27261 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27262 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27263 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27265 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27266 CHECK_ACCESS(fee_estimator_ptr);
27267 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27268 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27269 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27270 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27272 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27273 CHECK_ACCESS(logger_ptr);
27274 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27275 if (logger_conv.free == LDKLogger_JCalls_free) {
27276 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27277 LDKLogger_JCalls_cloned(&logger_conv);
27279 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27280 int64_tArray ret_arr = NULL;
27281 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27282 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27283 for (size_t n = 0; n < ret_var.datalen; n++) {
27284 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27285 *ret_conv_39_conv = ret_var.data[n];
27286 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27288 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27289 FREE(ret_var.data);
27293 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
27294 LDKChannelMonitor this_arg_conv;
27295 this_arg_conv.inner = (void*)(this_arg & (~1));
27296 this_arg_conv.is_owned = false;
27297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27298 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
27299 jobjectArray ret_arr = NULL;
27300 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27302 for (size_t i = 0; i < ret_var.datalen; i++) {
27303 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
27304 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
27305 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27308 FREE(ret_var.data);
27312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
27313 LDKChannelMonitor this_arg_conv;
27314 this_arg_conv.inner = (void*)(this_arg & (~1));
27315 this_arg_conv.is_owned = false;
27316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27317 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
27318 int64_t ret_ref = 0;
27319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27322 ret_ref = (uintptr_t)ret_var.inner;
27323 if (ret_var.is_owned) {
27329 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
27330 LDKChannelMonitor this_arg_conv;
27331 this_arg_conv.inner = (void*)(this_arg & (~1));
27332 this_arg_conv.is_owned = false;
27333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27334 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
27335 int64_tArray ret_arr = NULL;
27336 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27337 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27338 for (size_t j = 0; j < ret_var.datalen; j++) {
27339 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27340 *ret_conv_9_copy = ret_var.data[j];
27341 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
27342 ret_arr_ptr[j] = ret_conv_9_ref;
27344 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27345 FREE(ret_var.data);
27349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
27350 LDKu8slice ser_ref;
27351 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27352 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27353 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
27354 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
27355 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
27356 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
27357 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
27358 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27359 return (int64_t)ret_conv;
27362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27363 LDKOutPoint this_obj_conv;
27364 this_obj_conv.inner = (void*)(this_obj & (~1));
27365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27367 OutPoint_free(this_obj_conv);
27370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
27371 LDKOutPoint this_ptr_conv;
27372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27373 this_ptr_conv.is_owned = false;
27374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27375 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
27380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27381 LDKOutPoint this_ptr_conv;
27382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27383 this_ptr_conv.is_owned = false;
27384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27385 LDKThirtyTwoBytes val_ref;
27386 CHECK((*env)->GetArrayLength(env, val) == 32);
27387 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27388 OutPoint_set_txid(&this_ptr_conv, val_ref);
27391 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
27392 LDKOutPoint this_ptr_conv;
27393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27394 this_ptr_conv.is_owned = false;
27395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27396 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
27400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27401 LDKOutPoint this_ptr_conv;
27402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27403 this_ptr_conv.is_owned = false;
27404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27405 OutPoint_set_index(&this_ptr_conv, val);
27408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
27409 LDKThirtyTwoBytes txid_arg_ref;
27410 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
27411 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
27412 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
27413 int64_t ret_ref = 0;
27414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27417 ret_ref = (uintptr_t)ret_var.inner;
27418 if (ret_var.is_owned) {
27424 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
27425 LDKOutPoint ret_var = OutPoint_clone(arg);
27426 int64_t ret_ref = 0;
27427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27430 ret_ref = (uintptr_t)ret_var.inner;
27431 if (ret_var.is_owned) {
27436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27437 LDKOutPoint arg_conv;
27438 arg_conv.inner = (void*)(arg & (~1));
27439 arg_conv.is_owned = false;
27440 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27441 int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
27445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27446 LDKOutPoint orig_conv;
27447 orig_conv.inner = (void*)(orig & (~1));
27448 orig_conv.is_owned = false;
27449 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27450 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
27451 int64_t ret_ref = 0;
27452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27455 ret_ref = (uintptr_t)ret_var.inner;
27456 if (ret_var.is_owned) {
27462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27463 LDKOutPoint a_conv;
27464 a_conv.inner = (void*)(a & (~1));
27465 a_conv.is_owned = false;
27466 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27467 LDKOutPoint b_conv;
27468 b_conv.inner = (void*)(b & (~1));
27469 b_conv.is_owned = false;
27470 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27471 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
27475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
27476 LDKOutPoint o_conv;
27477 o_conv.inner = (void*)(o & (~1));
27478 o_conv.is_owned = false;
27479 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27480 int64_t ret_conv = OutPoint_hash(&o_conv);
27484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27485 LDKOutPoint this_arg_conv;
27486 this_arg_conv.inner = (void*)(this_arg & (~1));
27487 this_arg_conv.is_owned = false;
27488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27489 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27490 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
27494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
27495 LDKOutPoint obj_conv;
27496 obj_conv.inner = (void*)(obj & (~1));
27497 obj_conv.is_owned = false;
27498 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27499 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
27500 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27501 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27502 CVec_u8Z_free(ret_var);
27506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27507 LDKu8slice ser_ref;
27508 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27509 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27510 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27511 *ret_conv = OutPoint_read(ser_ref);
27512 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27513 return (int64_t)ret_conv;
27516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27517 LDKDelayedPaymentOutputDescriptor 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 DelayedPaymentOutputDescriptor_free(this_obj_conv);
27524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27525 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27527 this_ptr_conv.is_owned = false;
27528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27529 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27530 int64_t ret_ref = 0;
27531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27534 ret_ref = (uintptr_t)ret_var.inner;
27535 if (ret_var.is_owned) {
27541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27542 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27544 this_ptr_conv.is_owned = false;
27545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27546 LDKOutPoint val_conv;
27547 val_conv.inner = (void*)(val & (~1));
27548 val_conv.is_owned = (val & 1) || (val == 0);
27549 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27550 val_conv = OutPoint_clone(&val_conv);
27551 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27555 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27557 this_ptr_conv.is_owned = false;
27558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27559 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27560 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
27564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27565 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27567 this_ptr_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27569 LDKPublicKey val_ref;
27570 CHECK((*env)->GetArrayLength(env, val) == 33);
27571 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27572 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
27575 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27576 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27578 this_ptr_conv.is_owned = false;
27579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27580 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
27584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27585 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27587 this_ptr_conv.is_owned = false;
27588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27589 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
27592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27593 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27595 this_ptr_conv.is_owned = false;
27596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27597 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27598 CHECK_ACCESS(val_ptr);
27599 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27600 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
27601 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27605 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27607 this_ptr_conv.is_owned = false;
27608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27609 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27610 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
27614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27615 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27617 this_ptr_conv.is_owned = false;
27618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27619 LDKPublicKey val_ref;
27620 CHECK((*env)->GetArrayLength(env, val) == 33);
27621 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27622 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
27625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27626 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27628 this_ptr_conv.is_owned = false;
27629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27630 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27636 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27638 this_ptr_conv.is_owned = false;
27639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27640 LDKThirtyTwoBytes val_ref;
27641 CHECK((*env)->GetArrayLength(env, val) == 32);
27642 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27643 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27647 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27649 this_ptr_conv.is_owned = false;
27650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27651 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27656 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27658 this_ptr_conv.is_owned = false;
27659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27660 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27663 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) {
27664 LDKOutPoint outpoint_arg_conv;
27665 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
27666 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
27667 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27668 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27669 LDKPublicKey per_commitment_point_arg_ref;
27670 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
27671 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
27672 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
27673 CHECK_ACCESS(output_arg_ptr);
27674 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27675 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
27676 LDKPublicKey revocation_pubkey_arg_ref;
27677 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
27678 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
27679 LDKThirtyTwoBytes channel_keys_id_arg_ref;
27680 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27681 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27682 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);
27683 int64_t ret_ref = 0;
27684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27687 ret_ref = (uintptr_t)ret_var.inner;
27688 if (ret_var.is_owned) {
27694 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
27695 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
27696 int64_t ret_ref = 0;
27697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27700 ret_ref = (uintptr_t)ret_var.inner;
27701 if (ret_var.is_owned) {
27706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27707 LDKDelayedPaymentOutputDescriptor arg_conv;
27708 arg_conv.inner = (void*)(arg & (~1));
27709 arg_conv.is_owned = false;
27710 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27711 int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
27715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27716 LDKDelayedPaymentOutputDescriptor orig_conv;
27717 orig_conv.inner = (void*)(orig & (~1));
27718 orig_conv.is_owned = false;
27719 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27720 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
27721 int64_t ret_ref = 0;
27722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27725 ret_ref = (uintptr_t)ret_var.inner;
27726 if (ret_var.is_owned) {
27732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27733 LDKDelayedPaymentOutputDescriptor obj_conv;
27734 obj_conv.inner = (void*)(obj & (~1));
27735 obj_conv.is_owned = false;
27736 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27737 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
27738 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27739 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27740 CVec_u8Z_free(ret_var);
27744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27745 LDKu8slice ser_ref;
27746 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27747 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27748 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
27749 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
27750 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27751 return (int64_t)ret_conv;
27754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27755 LDKStaticPaymentOutputDescriptor this_obj_conv;
27756 this_obj_conv.inner = (void*)(this_obj & (~1));
27757 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27759 StaticPaymentOutputDescriptor_free(this_obj_conv);
27762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27763 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27765 this_ptr_conv.is_owned = false;
27766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27767 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27768 int64_t ret_ref = 0;
27769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27772 ret_ref = (uintptr_t)ret_var.inner;
27773 if (ret_var.is_owned) {
27779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27780 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27782 this_ptr_conv.is_owned = false;
27783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27784 LDKOutPoint val_conv;
27785 val_conv.inner = (void*)(val & (~1));
27786 val_conv.is_owned = (val & 1) || (val == 0);
27787 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27788 val_conv = OutPoint_clone(&val_conv);
27789 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27793 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27795 this_ptr_conv.is_owned = false;
27796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27797 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27798 CHECK_ACCESS(val_ptr);
27799 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27800 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
27801 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27805 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27807 this_ptr_conv.is_owned = false;
27808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27809 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27815 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27817 this_ptr_conv.is_owned = false;
27818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27819 LDKThirtyTwoBytes val_ref;
27820 CHECK((*env)->GetArrayLength(env, val) == 32);
27821 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27822 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27826 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27828 this_ptr_conv.is_owned = false;
27829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27830 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27835 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27837 this_ptr_conv.is_owned = false;
27838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27839 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27842 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) {
27843 LDKOutPoint outpoint_arg_conv;
27844 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
27845 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
27846 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27847 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27848 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
27849 CHECK_ACCESS(output_arg_ptr);
27850 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27851 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
27852 LDKThirtyTwoBytes channel_keys_id_arg_ref;
27853 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27854 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27855 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
27856 int64_t ret_ref = 0;
27857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27860 ret_ref = (uintptr_t)ret_var.inner;
27861 if (ret_var.is_owned) {
27867 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
27868 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
27869 int64_t ret_ref = 0;
27870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27873 ret_ref = (uintptr_t)ret_var.inner;
27874 if (ret_var.is_owned) {
27879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27880 LDKStaticPaymentOutputDescriptor arg_conv;
27881 arg_conv.inner = (void*)(arg & (~1));
27882 arg_conv.is_owned = false;
27883 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27884 int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27889 LDKStaticPaymentOutputDescriptor orig_conv;
27890 orig_conv.inner = (void*)(orig & (~1));
27891 orig_conv.is_owned = false;
27892 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27893 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27894 int64_t ret_ref = 0;
27895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27898 ret_ref = (uintptr_t)ret_var.inner;
27899 if (ret_var.is_owned) {
27905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27906 LDKStaticPaymentOutputDescriptor obj_conv;
27907 obj_conv.inner = (void*)(obj & (~1));
27908 obj_conv.is_owned = false;
27909 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27910 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27911 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27912 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27913 CVec_u8Z_free(ret_var);
27917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27918 LDKu8slice ser_ref;
27919 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27920 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27921 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27922 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27923 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27924 return (int64_t)ret_conv;
27927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27928 if ((this_ptr & 1) != 0) return;
27929 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27930 CHECK_ACCESS(this_ptr_ptr);
27931 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27932 FREE((void*)this_ptr);
27933 SpendableOutputDescriptor_free(this_ptr_conv);
27936 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27937 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27938 *ret_copy = SpendableOutputDescriptor_clone(arg);
27939 int64_t ret_ref = (uintptr_t)ret_copy;
27942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27943 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
27944 int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27949 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
27950 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27951 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27952 int64_t ret_ref = (uintptr_t)ret_copy;
27956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27957 LDKOutPoint outpoint_conv;
27958 outpoint_conv.inner = (void*)(outpoint & (~1));
27959 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
27960 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27961 outpoint_conv = OutPoint_clone(&outpoint_conv);
27962 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
27963 CHECK_ACCESS(output_ptr);
27964 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27965 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
27966 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27967 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27968 int64_t ret_ref = (uintptr_t)ret_copy;
27972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27973 LDKDelayedPaymentOutputDescriptor a_conv;
27974 a_conv.inner = (void*)(a & (~1));
27975 a_conv.is_owned = (a & 1) || (a == 0);
27976 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27977 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27978 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27979 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27980 int64_t ret_ref = (uintptr_t)ret_copy;
27984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27985 LDKStaticPaymentOutputDescriptor a_conv;
27986 a_conv.inner = (void*)(a & (~1));
27987 a_conv.is_owned = (a & 1) || (a == 0);
27988 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27989 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27990 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27991 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27992 int64_t ret_ref = (uintptr_t)ret_copy;
27996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27997 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
27998 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27999 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28000 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28001 CVec_u8Z_free(ret_var);
28005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28006 LDKu8slice ser_ref;
28007 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28008 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28009 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
28010 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
28011 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28012 return (int64_t)ret_conv;
28015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28016 if ((this_ptr & 1) != 0) return;
28017 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28018 CHECK_ACCESS(this_ptr_ptr);
28019 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
28020 FREE((void*)this_ptr);
28021 BaseSign_free(this_ptr_conv);
28024 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
28025 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28026 *ret_ret = Sign_clone(arg);
28027 return (int64_t)ret_ret;
28029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28030 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
28031 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28032 LDKSign* arg_conv = (LDKSign*)arg_ptr;
28033 int64_t ret_conv = Sign_clone_ptr(arg_conv);
28037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28038 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
28039 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28040 LDKSign* orig_conv = (LDKSign*)orig_ptr;
28041 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28042 *ret_ret = Sign_clone(orig_conv);
28043 return (int64_t)ret_ret;
28046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28047 if ((this_ptr & 1) != 0) return;
28048 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28049 CHECK_ACCESS(this_ptr_ptr);
28050 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
28051 FREE((void*)this_ptr);
28052 Sign_free(this_ptr_conv);
28055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28056 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
28057 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
28061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
28062 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
28066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
28067 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
28071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28072 if ((this_ptr & 1) != 0) return;
28073 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28074 CHECK_ACCESS(this_ptr_ptr);
28075 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
28076 FREE((void*)this_ptr);
28077 KeysInterface_free(this_ptr_conv);
28080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28081 LDKInMemorySigner this_obj_conv;
28082 this_obj_conv.inner = (void*)(this_obj & (~1));
28083 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28085 InMemorySigner_free(this_obj_conv);
28088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28089 LDKInMemorySigner this_ptr_conv;
28090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28091 this_ptr_conv.is_owned = false;
28092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28093 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28094 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
28098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28099 LDKInMemorySigner this_ptr_conv;
28100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28101 this_ptr_conv.is_owned = false;
28102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28103 LDKSecretKey val_ref;
28104 CHECK((*env)->GetArrayLength(env, val) == 32);
28105 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28106 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
28109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28110 LDKInMemorySigner this_ptr_conv;
28111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28112 this_ptr_conv.is_owned = false;
28113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28114 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28115 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
28119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28120 LDKInMemorySigner this_ptr_conv;
28121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28122 this_ptr_conv.is_owned = false;
28123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28124 LDKSecretKey val_ref;
28125 CHECK((*env)->GetArrayLength(env, val) == 32);
28126 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28127 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
28130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28131 LDKInMemorySigner this_ptr_conv;
28132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28133 this_ptr_conv.is_owned = false;
28134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28135 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
28140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28141 LDKInMemorySigner this_ptr_conv;
28142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28143 this_ptr_conv.is_owned = false;
28144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28145 LDKSecretKey val_ref;
28146 CHECK((*env)->GetArrayLength(env, val) == 32);
28147 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28148 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
28151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28152 LDKInMemorySigner this_ptr_conv;
28153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28154 this_ptr_conv.is_owned = false;
28155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28156 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28157 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
28161 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) {
28162 LDKInMemorySigner this_ptr_conv;
28163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28164 this_ptr_conv.is_owned = false;
28165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28166 LDKSecretKey val_ref;
28167 CHECK((*env)->GetArrayLength(env, val) == 32);
28168 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28169 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
28172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28173 LDKInMemorySigner this_ptr_conv;
28174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28175 this_ptr_conv.is_owned = false;
28176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28177 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
28182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28183 LDKInMemorySigner this_ptr_conv;
28184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28185 this_ptr_conv.is_owned = false;
28186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28187 LDKSecretKey val_ref;
28188 CHECK((*env)->GetArrayLength(env, val) == 32);
28189 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28190 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
28193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
28194 LDKInMemorySigner this_ptr_conv;
28195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28196 this_ptr_conv.is_owned = false;
28197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28198 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
28203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28204 LDKInMemorySigner this_ptr_conv;
28205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28206 this_ptr_conv.is_owned = false;
28207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28208 LDKThirtyTwoBytes val_ref;
28209 CHECK((*env)->GetArrayLength(env, val) == 32);
28210 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28211 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
28214 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
28215 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
28216 int64_t ret_ref = 0;
28217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28220 ret_ref = (uintptr_t)ret_var.inner;
28221 if (ret_var.is_owned) {
28226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28227 LDKInMemorySigner arg_conv;
28228 arg_conv.inner = (void*)(arg & (~1));
28229 arg_conv.is_owned = false;
28230 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28231 int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
28235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28236 LDKInMemorySigner orig_conv;
28237 orig_conv.inner = (void*)(orig & (~1));
28238 orig_conv.is_owned = false;
28239 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28240 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
28241 int64_t ret_ref = 0;
28242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28245 ret_ref = (uintptr_t)ret_var.inner;
28246 if (ret_var.is_owned) {
28252 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) {
28253 LDKSecretKey node_secret_ref;
28254 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
28255 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
28256 LDKSecretKey funding_key_ref;
28257 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
28258 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
28259 LDKSecretKey revocation_base_key_ref;
28260 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
28261 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
28262 LDKSecretKey payment_key_ref;
28263 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
28264 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
28265 LDKSecretKey delayed_payment_base_key_ref;
28266 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
28267 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
28268 LDKSecretKey htlc_base_key_ref;
28269 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
28270 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
28271 LDKThirtyTwoBytes commitment_seed_ref;
28272 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
28273 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
28274 LDKThirtyTwoBytes channel_keys_id_ref;
28275 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
28276 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
28277 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);
28278 int64_t ret_ref = 0;
28279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28282 ret_ref = (uintptr_t)ret_var.inner;
28283 if (ret_var.is_owned) {
28289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28290 LDKInMemorySigner this_arg_conv;
28291 this_arg_conv.inner = (void*)(this_arg & (~1));
28292 this_arg_conv.is_owned = false;
28293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28294 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
28295 int64_t ret_ref = 0;
28296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28299 ret_ref = (uintptr_t)ret_var.inner;
28300 if (ret_var.is_owned) {
28306 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28307 LDKInMemorySigner this_arg_conv;
28308 this_arg_conv.inner = (void*)(this_arg & (~1));
28309 this_arg_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28311 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
28315 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28316 LDKInMemorySigner this_arg_conv;
28317 this_arg_conv.inner = (void*)(this_arg & (~1));
28318 this_arg_conv.is_owned = false;
28319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28320 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
28324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
28325 LDKInMemorySigner this_arg_conv;
28326 this_arg_conv.inner = (void*)(this_arg & (~1));
28327 this_arg_conv.is_owned = false;
28328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28329 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
28333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
28334 LDKInMemorySigner this_arg_conv;
28335 this_arg_conv.inner = (void*)(this_arg & (~1));
28336 this_arg_conv.is_owned = false;
28337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28338 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
28339 int64_t ret_ref = 0;
28340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28343 ret_ref = (uintptr_t)ret_var.inner;
28344 if (ret_var.is_owned) {
28350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
28351 LDKInMemorySigner this_arg_conv;
28352 this_arg_conv.inner = (void*)(this_arg & (~1));
28353 this_arg_conv.is_owned = false;
28354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28355 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
28356 int64_t ret_ref = 0;
28357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28360 ret_ref = (uintptr_t)ret_var.inner;
28361 if (ret_var.is_owned) {
28367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
28368 LDKInMemorySigner this_arg_conv;
28369 this_arg_conv.inner = (void*)(this_arg & (~1));
28370 this_arg_conv.is_owned = false;
28371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28372 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
28376 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) {
28377 LDKInMemorySigner this_arg_conv;
28378 this_arg_conv.inner = (void*)(this_arg & (~1));
28379 this_arg_conv.is_owned = false;
28380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28381 LDKTransaction spend_tx_ref;
28382 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
28383 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
28384 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
28385 spend_tx_ref.data_is_owned = true;
28386 LDKStaticPaymentOutputDescriptor descriptor_conv;
28387 descriptor_conv.inner = (void*)(descriptor & (~1));
28388 descriptor_conv.is_owned = false;
28389 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
28390 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
28391 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
28392 return (int64_t)ret_conv;
28395 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) {
28396 LDKInMemorySigner this_arg_conv;
28397 this_arg_conv.inner = (void*)(this_arg & (~1));
28398 this_arg_conv.is_owned = false;
28399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28400 LDKTransaction spend_tx_ref;
28401 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
28402 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
28403 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
28404 spend_tx_ref.data_is_owned = true;
28405 LDKDelayedPaymentOutputDescriptor descriptor_conv;
28406 descriptor_conv.inner = (void*)(descriptor & (~1));
28407 descriptor_conv.is_owned = false;
28408 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
28409 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
28410 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
28411 return (int64_t)ret_conv;
28414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
28415 LDKInMemorySigner this_arg_conv;
28416 this_arg_conv.inner = (void*)(this_arg & (~1));
28417 this_arg_conv.is_owned = false;
28418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28419 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
28420 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
28421 return (int64_t)ret_ret;
28424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
28425 LDKInMemorySigner this_arg_conv;
28426 this_arg_conv.inner = (void*)(this_arg & (~1));
28427 this_arg_conv.is_owned = false;
28428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28429 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28430 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
28431 return (int64_t)ret_ret;
28434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
28435 LDKInMemorySigner obj_conv;
28436 obj_conv.inner = (void*)(obj & (~1));
28437 obj_conv.is_owned = false;
28438 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28439 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
28440 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28441 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28442 CVec_u8Z_free(ret_var);
28446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
28447 LDKu8slice ser_ref;
28448 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28449 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28450 LDKSecretKey arg_ref;
28451 CHECK((*env)->GetArrayLength(env, arg) == 32);
28452 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
28453 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
28454 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
28455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28456 return (int64_t)ret_conv;
28459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28460 LDKKeysManager this_obj_conv;
28461 this_obj_conv.inner = (void*)(this_obj & (~1));
28462 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28464 KeysManager_free(this_obj_conv);
28467 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) {
28468 unsigned char seed_arr[32];
28469 CHECK((*env)->GetArrayLength(env, seed) == 32);
28470 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28471 unsigned char (*seed_ref)[32] = &seed_arr;
28472 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
28473 int64_t ret_ref = 0;
28474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28477 ret_ref = (uintptr_t)ret_var.inner;
28478 if (ret_var.is_owned) {
28484 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) {
28485 LDKKeysManager this_arg_conv;
28486 this_arg_conv.inner = (void*)(this_arg & (~1));
28487 this_arg_conv.is_owned = false;
28488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28489 unsigned char params_arr[32];
28490 CHECK((*env)->GetArrayLength(env, params) == 32);
28491 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28492 unsigned char (*params_ref)[32] = ¶ms_arr;
28493 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28494 int64_t ret_ref = 0;
28495 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28496 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28498 ret_ref = (uintptr_t)ret_var.inner;
28499 if (ret_var.is_owned) {
28505 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) {
28506 LDKKeysManager this_arg_conv;
28507 this_arg_conv.inner = (void*)(this_arg & (~1));
28508 this_arg_conv.is_owned = false;
28509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28510 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28511 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28512 if (descriptors_constr.datalen > 0)
28513 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28515 descriptors_constr.data = NULL;
28516 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28517 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28518 int64_t descriptors_conv_27 = descriptors_vals[b];
28519 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
28520 CHECK_ACCESS(descriptors_conv_27_ptr);
28521 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28522 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
28523 descriptors_constr.data[b] = descriptors_conv_27_conv;
28525 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28526 LDKCVec_TxOutZ outputs_constr;
28527 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28528 if (outputs_constr.datalen > 0)
28529 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28531 outputs_constr.data = NULL;
28532 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28533 for (size_t h = 0; h < outputs_constr.datalen; h++) {
28534 int64_t outputs_conv_7 = outputs_vals[h];
28535 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
28536 CHECK_ACCESS(outputs_conv_7_ptr);
28537 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28538 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
28539 outputs_constr.data[h] = outputs_conv_7_conv;
28541 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28542 LDKCVec_u8Z change_destination_script_ref;
28543 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28544 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28545 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28546 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28547 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28548 return (int64_t)ret_conv;
28551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28552 LDKKeysManager this_arg_conv;
28553 this_arg_conv.inner = (void*)(this_arg & (~1));
28554 this_arg_conv.is_owned = false;
28555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28556 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28557 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
28558 return (int64_t)ret_ret;
28561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28562 LDKPhantomKeysManager this_obj_conv;
28563 this_obj_conv.inner = (void*)(this_obj & (~1));
28564 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28566 PhantomKeysManager_free(this_obj_conv);
28569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28570 LDKPhantomKeysManager this_arg_conv;
28571 this_arg_conv.inner = (void*)(this_arg & (~1));
28572 this_arg_conv.is_owned = false;
28573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28574 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28575 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
28576 return (int64_t)ret_ret;
28579 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) {
28580 unsigned char seed_arr[32];
28581 CHECK((*env)->GetArrayLength(env, seed) == 32);
28582 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28583 unsigned char (*seed_ref)[32] = &seed_arr;
28584 unsigned char cross_node_seed_arr[32];
28585 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
28586 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
28587 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
28588 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
28589 int64_t ret_ref = 0;
28590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28593 ret_ref = (uintptr_t)ret_var.inner;
28594 if (ret_var.is_owned) {
28600 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) {
28601 LDKPhantomKeysManager this_arg_conv;
28602 this_arg_conv.inner = (void*)(this_arg & (~1));
28603 this_arg_conv.is_owned = false;
28604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28605 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28606 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28607 if (descriptors_constr.datalen > 0)
28608 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28610 descriptors_constr.data = NULL;
28611 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28612 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28613 int64_t descriptors_conv_27 = descriptors_vals[b];
28614 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
28615 CHECK_ACCESS(descriptors_conv_27_ptr);
28616 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28617 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
28618 descriptors_constr.data[b] = descriptors_conv_27_conv;
28620 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28621 LDKCVec_TxOutZ outputs_constr;
28622 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28623 if (outputs_constr.datalen > 0)
28624 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28626 outputs_constr.data = NULL;
28627 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28628 for (size_t h = 0; h < outputs_constr.datalen; h++) {
28629 int64_t outputs_conv_7 = outputs_vals[h];
28630 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
28631 CHECK_ACCESS(outputs_conv_7_ptr);
28632 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28633 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
28634 outputs_constr.data[h] = outputs_conv_7_conv;
28636 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28637 LDKCVec_u8Z change_destination_script_ref;
28638 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28639 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28640 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28641 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28642 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28643 return (int64_t)ret_conv;
28646 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) {
28647 LDKPhantomKeysManager this_arg_conv;
28648 this_arg_conv.inner = (void*)(this_arg & (~1));
28649 this_arg_conv.is_owned = false;
28650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28651 unsigned char params_arr[32];
28652 CHECK((*env)->GetArrayLength(env, params) == 32);
28653 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28654 unsigned char (*params_ref)[32] = ¶ms_arr;
28655 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28656 int64_t ret_ref = 0;
28657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28660 ret_ref = (uintptr_t)ret_var.inner;
28661 if (ret_var.is_owned) {
28667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28668 LDKChannelManager this_obj_conv;
28669 this_obj_conv.inner = (void*)(this_obj & (~1));
28670 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28672 ChannelManager_free(this_obj_conv);
28675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28676 LDKChainParameters this_obj_conv;
28677 this_obj_conv.inner = (void*)(this_obj & (~1));
28678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28680 ChainParameters_free(this_obj_conv);
28683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
28684 LDKChainParameters this_ptr_conv;
28685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28686 this_ptr_conv.is_owned = false;
28687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28688 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
28692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
28693 LDKChainParameters this_ptr_conv;
28694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28695 this_ptr_conv.is_owned = false;
28696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28697 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
28698 ChainParameters_set_network(&this_ptr_conv, val_conv);
28701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
28702 LDKChainParameters this_ptr_conv;
28703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28704 this_ptr_conv.is_owned = false;
28705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28706 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
28707 int64_t ret_ref = 0;
28708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28711 ret_ref = (uintptr_t)ret_var.inner;
28712 if (ret_var.is_owned) {
28718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28719 LDKChainParameters this_ptr_conv;
28720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28721 this_ptr_conv.is_owned = false;
28722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28723 LDKBestBlock val_conv;
28724 val_conv.inner = (void*)(val & (~1));
28725 val_conv.is_owned = (val & 1) || (val == 0);
28726 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28727 val_conv = BestBlock_clone(&val_conv);
28728 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
28731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
28732 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
28733 LDKBestBlock best_block_arg_conv;
28734 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
28735 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
28736 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
28737 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
28738 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
28739 int64_t ret_ref = 0;
28740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28743 ret_ref = (uintptr_t)ret_var.inner;
28744 if (ret_var.is_owned) {
28750 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
28751 LDKChainParameters ret_var = ChainParameters_clone(arg);
28752 int64_t ret_ref = 0;
28753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28756 ret_ref = (uintptr_t)ret_var.inner;
28757 if (ret_var.is_owned) {
28762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28763 LDKChainParameters arg_conv;
28764 arg_conv.inner = (void*)(arg & (~1));
28765 arg_conv.is_owned = false;
28766 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28767 int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
28771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28772 LDKChainParameters orig_conv;
28773 orig_conv.inner = (void*)(orig & (~1));
28774 orig_conv.is_owned = false;
28775 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28776 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
28777 int64_t ret_ref = 0;
28778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28781 ret_ref = (uintptr_t)ret_var.inner;
28782 if (ret_var.is_owned) {
28788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28789 LDKCounterpartyForwardingInfo this_obj_conv;
28790 this_obj_conv.inner = (void*)(this_obj & (~1));
28791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28793 CounterpartyForwardingInfo_free(this_obj_conv);
28796 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28797 LDKCounterpartyForwardingInfo this_ptr_conv;
28798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28799 this_ptr_conv.is_owned = false;
28800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28801 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
28805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28806 LDKCounterpartyForwardingInfo this_ptr_conv;
28807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28808 this_ptr_conv.is_owned = false;
28809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28810 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
28813 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28814 LDKCounterpartyForwardingInfo this_ptr_conv;
28815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28816 this_ptr_conv.is_owned = false;
28817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28818 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
28822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28823 LDKCounterpartyForwardingInfo this_ptr_conv;
28824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28825 this_ptr_conv.is_owned = false;
28826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28827 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
28830 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28831 LDKCounterpartyForwardingInfo this_ptr_conv;
28832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28833 this_ptr_conv.is_owned = false;
28834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28835 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
28839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28840 LDKCounterpartyForwardingInfo this_ptr_conv;
28841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28842 this_ptr_conv.is_owned = false;
28843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28844 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28847 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) {
28848 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
28849 int64_t ret_ref = 0;
28850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28853 ret_ref = (uintptr_t)ret_var.inner;
28854 if (ret_var.is_owned) {
28860 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
28861 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
28862 int64_t ret_ref = 0;
28863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28866 ret_ref = (uintptr_t)ret_var.inner;
28867 if (ret_var.is_owned) {
28872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28873 LDKCounterpartyForwardingInfo arg_conv;
28874 arg_conv.inner = (void*)(arg & (~1));
28875 arg_conv.is_owned = false;
28876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28877 int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28882 LDKCounterpartyForwardingInfo orig_conv;
28883 orig_conv.inner = (void*)(orig & (~1));
28884 orig_conv.is_owned = false;
28885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28886 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28887 int64_t ret_ref = 0;
28888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28891 ret_ref = (uintptr_t)ret_var.inner;
28892 if (ret_var.is_owned) {
28898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28899 LDKChannelCounterparty this_obj_conv;
28900 this_obj_conv.inner = (void*)(this_obj & (~1));
28901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28903 ChannelCounterparty_free(this_obj_conv);
28906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28907 LDKChannelCounterparty this_ptr_conv;
28908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28909 this_ptr_conv.is_owned = false;
28910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28911 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28917 LDKChannelCounterparty this_ptr_conv;
28918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28919 this_ptr_conv.is_owned = false;
28920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28921 LDKPublicKey val_ref;
28922 CHECK((*env)->GetArrayLength(env, val) == 33);
28923 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28924 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28928 LDKChannelCounterparty this_ptr_conv;
28929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28930 this_ptr_conv.is_owned = false;
28931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28932 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28933 int64_t ret_ref = 0;
28934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28937 ret_ref = (uintptr_t)ret_var.inner;
28938 if (ret_var.is_owned) {
28944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28945 LDKChannelCounterparty this_ptr_conv;
28946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28947 this_ptr_conv.is_owned = false;
28948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28949 LDKInitFeatures val_conv;
28950 val_conv.inner = (void*)(val & (~1));
28951 val_conv.is_owned = (val & 1) || (val == 0);
28952 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28953 val_conv = InitFeatures_clone(&val_conv);
28954 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28958 LDKChannelCounterparty this_ptr_conv;
28959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28960 this_ptr_conv.is_owned = false;
28961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28962 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28967 LDKChannelCounterparty this_ptr_conv;
28968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28969 this_ptr_conv.is_owned = false;
28970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28971 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28975 LDKChannelCounterparty this_ptr_conv;
28976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28977 this_ptr_conv.is_owned = false;
28978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28979 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28980 int64_t ret_ref = 0;
28981 if ((uintptr_t)ret_var.inner > 4096) {
28982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28985 ret_ref = (uintptr_t)ret_var.inner;
28986 if (ret_var.is_owned) {
28993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28994 LDKChannelCounterparty this_ptr_conv;
28995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28996 this_ptr_conv.is_owned = false;
28997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28998 LDKCounterpartyForwardingInfo val_conv;
28999 val_conv.inner = (void*)(val & (~1));
29000 val_conv.is_owned = (val & 1) || (val == 0);
29001 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29002 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
29003 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
29006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29007 LDKChannelCounterparty this_ptr_conv;
29008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29009 this_ptr_conv.is_owned = false;
29010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29011 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29012 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
29013 int64_t ret_ref = (uintptr_t)ret_copy;
29017 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) {
29018 LDKChannelCounterparty this_ptr_conv;
29019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29020 this_ptr_conv.is_owned = false;
29021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29022 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29023 CHECK_ACCESS(val_ptr);
29024 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29025 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29026 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29030 LDKChannelCounterparty this_ptr_conv;
29031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29032 this_ptr_conv.is_owned = false;
29033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29034 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29035 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
29036 int64_t ret_ref = (uintptr_t)ret_copy;
29040 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) {
29041 LDKChannelCounterparty this_ptr_conv;
29042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29043 this_ptr_conv.is_owned = false;
29044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29045 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29046 CHECK_ACCESS(val_ptr);
29047 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29048 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29049 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29052 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) {
29053 LDKPublicKey node_id_arg_ref;
29054 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
29055 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
29056 LDKInitFeatures features_arg_conv;
29057 features_arg_conv.inner = (void*)(features_arg & (~1));
29058 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29059 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29060 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29061 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
29062 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
29063 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
29064 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
29065 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
29066 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
29067 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
29068 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
29069 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
29070 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
29071 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
29072 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
29073 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
29074 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);
29075 int64_t ret_ref = 0;
29076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29079 ret_ref = (uintptr_t)ret_var.inner;
29080 if (ret_var.is_owned) {
29086 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
29087 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
29088 int64_t ret_ref = 0;
29089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29092 ret_ref = (uintptr_t)ret_var.inner;
29093 if (ret_var.is_owned) {
29098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29099 LDKChannelCounterparty arg_conv;
29100 arg_conv.inner = (void*)(arg & (~1));
29101 arg_conv.is_owned = false;
29102 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29103 int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
29107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29108 LDKChannelCounterparty orig_conv;
29109 orig_conv.inner = (void*)(orig & (~1));
29110 orig_conv.is_owned = false;
29111 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29112 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
29113 int64_t ret_ref = 0;
29114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29117 ret_ref = (uintptr_t)ret_var.inner;
29118 if (ret_var.is_owned) {
29124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29125 LDKChannelDetails this_obj_conv;
29126 this_obj_conv.inner = (void*)(this_obj & (~1));
29127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29129 ChannelDetails_free(this_obj_conv);
29132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29133 LDKChannelDetails this_ptr_conv;
29134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29135 this_ptr_conv.is_owned = false;
29136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29137 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29138 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
29142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29143 LDKChannelDetails this_ptr_conv;
29144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29145 this_ptr_conv.is_owned = false;
29146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29147 LDKThirtyTwoBytes val_ref;
29148 CHECK((*env)->GetArrayLength(env, val) == 32);
29149 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29150 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
29153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
29154 LDKChannelDetails this_ptr_conv;
29155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29156 this_ptr_conv.is_owned = false;
29157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29158 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
29159 int64_t ret_ref = 0;
29160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29163 ret_ref = (uintptr_t)ret_var.inner;
29164 if (ret_var.is_owned) {
29170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29171 LDKChannelDetails this_ptr_conv;
29172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29173 this_ptr_conv.is_owned = false;
29174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29175 LDKChannelCounterparty val_conv;
29176 val_conv.inner = (void*)(val & (~1));
29177 val_conv.is_owned = (val & 1) || (val == 0);
29178 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29179 val_conv = ChannelCounterparty_clone(&val_conv);
29180 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
29183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
29184 LDKChannelDetails this_ptr_conv;
29185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29186 this_ptr_conv.is_owned = false;
29187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29188 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
29189 int64_t ret_ref = 0;
29190 if ((uintptr_t)ret_var.inner > 4096) {
29191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29194 ret_ref = (uintptr_t)ret_var.inner;
29195 if (ret_var.is_owned) {
29202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29203 LDKChannelDetails this_ptr_conv;
29204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29205 this_ptr_conv.is_owned = false;
29206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29207 LDKOutPoint val_conv;
29208 val_conv.inner = (void*)(val & (~1));
29209 val_conv.is_owned = (val & 1) || (val == 0);
29210 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29211 val_conv = OutPoint_clone(&val_conv);
29212 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
29215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
29216 LDKChannelDetails this_ptr_conv;
29217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29218 this_ptr_conv.is_owned = false;
29219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29220 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
29221 int64_t ret_ref = 0;
29222 if ((uintptr_t)ret_var.inner > 4096) {
29223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29226 ret_ref = (uintptr_t)ret_var.inner;
29227 if (ret_var.is_owned) {
29234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29235 LDKChannelDetails this_ptr_conv;
29236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29237 this_ptr_conv.is_owned = false;
29238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29239 LDKChannelTypeFeatures val_conv;
29240 val_conv.inner = (void*)(val & (~1));
29241 val_conv.is_owned = (val & 1) || (val == 0);
29242 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29243 val_conv = ChannelTypeFeatures_clone(&val_conv);
29244 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
29247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29248 LDKChannelDetails this_ptr_conv;
29249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29250 this_ptr_conv.is_owned = false;
29251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29252 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29253 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
29254 int64_t ret_ref = (uintptr_t)ret_copy;
29258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29259 LDKChannelDetails this_ptr_conv;
29260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29261 this_ptr_conv.is_owned = false;
29262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29263 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29264 CHECK_ACCESS(val_ptr);
29265 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29266 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29267 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
29270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29271 LDKChannelDetails this_ptr_conv;
29272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29273 this_ptr_conv.is_owned = false;
29274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29275 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29276 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
29277 int64_t ret_ref = (uintptr_t)ret_copy;
29281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29282 LDKChannelDetails this_ptr_conv;
29283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29284 this_ptr_conv.is_owned = false;
29285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29286 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29287 CHECK_ACCESS(val_ptr);
29288 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29289 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29290 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
29293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29294 LDKChannelDetails this_ptr_conv;
29295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29296 this_ptr_conv.is_owned = false;
29297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29298 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29299 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
29300 int64_t ret_ref = (uintptr_t)ret_copy;
29304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29305 LDKChannelDetails this_ptr_conv;
29306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29307 this_ptr_conv.is_owned = false;
29308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29309 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29310 CHECK_ACCESS(val_ptr);
29311 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29312 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29313 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
29316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29317 LDKChannelDetails this_ptr_conv;
29318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29319 this_ptr_conv.is_owned = false;
29320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29321 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
29325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29326 LDKChannelDetails this_ptr_conv;
29327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29328 this_ptr_conv.is_owned = false;
29329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29330 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
29333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
29334 LDKChannelDetails this_ptr_conv;
29335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29336 this_ptr_conv.is_owned = false;
29337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29338 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29339 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
29340 int64_t ret_ref = (uintptr_t)ret_copy;
29344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29345 LDKChannelDetails this_ptr_conv;
29346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29347 this_ptr_conv.is_owned = false;
29348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29349 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29350 CHECK_ACCESS(val_ptr);
29351 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29352 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29353 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
29356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29357 LDKChannelDetails this_ptr_conv;
29358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29359 this_ptr_conv.is_owned = false;
29360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29361 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
29365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29366 LDKChannelDetails this_ptr_conv;
29367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29368 this_ptr_conv.is_owned = false;
29369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29370 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
29373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29374 LDKChannelDetails 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 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
29382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29383 LDKChannelDetails 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 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
29390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29391 LDKChannelDetails this_ptr_conv;
29392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29393 this_ptr_conv.is_owned = false;
29394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29395 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
29399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29400 LDKChannelDetails 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 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
29407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29408 LDKChannelDetails this_ptr_conv;
29409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29410 this_ptr_conv.is_owned = false;
29411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29412 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
29416 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) {
29417 LDKChannelDetails this_ptr_conv;
29418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29419 this_ptr_conv.is_owned = false;
29420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29421 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
29424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29425 LDKChannelDetails this_ptr_conv;
29426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29427 this_ptr_conv.is_owned = false;
29428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29429 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
29433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29434 LDKChannelDetails this_ptr_conv;
29435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29436 this_ptr_conv.is_owned = false;
29437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29438 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
29441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
29442 LDKChannelDetails this_ptr_conv;
29443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29444 this_ptr_conv.is_owned = false;
29445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29446 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29447 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
29448 int64_t ret_ref = (uintptr_t)ret_copy;
29452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29453 LDKChannelDetails this_ptr_conv;
29454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29455 this_ptr_conv.is_owned = false;
29456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29457 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29458 CHECK_ACCESS(val_ptr);
29459 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29460 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
29461 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
29464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
29465 LDKChannelDetails this_ptr_conv;
29466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29467 this_ptr_conv.is_owned = false;
29468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29469 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
29470 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
29471 int64_t ret_ref = (uintptr_t)ret_copy;
29475 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) {
29476 LDKChannelDetails this_ptr_conv;
29477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29478 this_ptr_conv.is_owned = false;
29479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29480 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29481 CHECK_ACCESS(val_ptr);
29482 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
29483 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
29484 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
29487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
29488 LDKChannelDetails this_ptr_conv;
29489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29490 this_ptr_conv.is_owned = false;
29491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29492 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
29496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29497 LDKChannelDetails this_ptr_conv;
29498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29499 this_ptr_conv.is_owned = false;
29500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29501 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
29504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
29505 LDKChannelDetails this_ptr_conv;
29506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29507 this_ptr_conv.is_owned = false;
29508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29509 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
29513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29514 LDKChannelDetails this_ptr_conv;
29515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29516 this_ptr_conv.is_owned = false;
29517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29518 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
29521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
29522 LDKChannelDetails this_ptr_conv;
29523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29524 this_ptr_conv.is_owned = false;
29525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29526 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
29530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29531 LDKChannelDetails this_ptr_conv;
29532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29533 this_ptr_conv.is_owned = false;
29534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29535 ChannelDetails_set_is_usable(&this_ptr_conv, val);
29538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
29539 LDKChannelDetails this_ptr_conv;
29540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29541 this_ptr_conv.is_owned = false;
29542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29543 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
29547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29548 LDKChannelDetails this_ptr_conv;
29549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29550 this_ptr_conv.is_owned = false;
29551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29552 ChannelDetails_set_is_public(&this_ptr_conv, val);
29555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29556 LDKChannelDetails this_ptr_conv;
29557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29558 this_ptr_conv.is_owned = false;
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29560 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29561 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
29562 int64_t ret_ref = (uintptr_t)ret_copy;
29566 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) {
29567 LDKChannelDetails this_ptr_conv;
29568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29569 this_ptr_conv.is_owned = false;
29570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29571 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29572 CHECK_ACCESS(val_ptr);
29573 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29574 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29575 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29579 LDKChannelDetails this_ptr_conv;
29580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29581 this_ptr_conv.is_owned = false;
29582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29583 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29584 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
29585 int64_t ret_ref = (uintptr_t)ret_copy;
29589 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) {
29590 LDKChannelDetails this_ptr_conv;
29591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29592 this_ptr_conv.is_owned = false;
29593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29594 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29595 CHECK_ACCESS(val_ptr);
29596 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29597 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29598 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29602 LDKChannelDetails this_ptr_conv;
29603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29604 this_ptr_conv.is_owned = false;
29605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29606 LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
29607 int64_t ret_ref = 0;
29608 if ((uintptr_t)ret_var.inner > 4096) {
29609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29612 ret_ref = (uintptr_t)ret_var.inner;
29613 if (ret_var.is_owned) {
29620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29621 LDKChannelDetails this_ptr_conv;
29622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29623 this_ptr_conv.is_owned = false;
29624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29625 LDKChannelConfig val_conv;
29626 val_conv.inner = (void*)(val & (~1));
29627 val_conv.is_owned = (val & 1) || (val == 0);
29628 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29629 val_conv = ChannelConfig_clone(&val_conv);
29630 ChannelDetails_set_config(&this_ptr_conv, val_conv);
29633 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) {
29634 LDKThirtyTwoBytes channel_id_arg_ref;
29635 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29636 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29637 LDKChannelCounterparty counterparty_arg_conv;
29638 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
29639 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
29641 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
29642 LDKOutPoint funding_txo_arg_conv;
29643 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
29644 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
29645 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
29646 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
29647 LDKChannelTypeFeatures channel_type_arg_conv;
29648 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
29649 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
29651 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
29652 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
29653 CHECK_ACCESS(short_channel_id_arg_ptr);
29654 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
29655 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
29656 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
29657 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
29658 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
29659 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
29660 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
29661 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
29662 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
29663 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
29664 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
29665 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
29666 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
29667 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
29668 CHECK_ACCESS(confirmations_required_arg_ptr);
29669 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
29670 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
29671 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
29672 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
29673 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
29674 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
29675 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
29676 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
29677 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
29678 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
29679 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
29680 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
29681 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
29682 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
29683 LDKChannelConfig config_arg_conv;
29684 config_arg_conv.inner = (void*)(config_arg & (~1));
29685 config_arg_conv.is_owned = (config_arg & 1) || (config_arg == 0);
29686 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
29687 config_arg_conv = ChannelConfig_clone(&config_arg_conv);
29688 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);
29689 int64_t ret_ref = 0;
29690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29693 ret_ref = (uintptr_t)ret_var.inner;
29694 if (ret_var.is_owned) {
29700 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
29701 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
29702 int64_t ret_ref = 0;
29703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29706 ret_ref = (uintptr_t)ret_var.inner;
29707 if (ret_var.is_owned) {
29712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29713 LDKChannelDetails arg_conv;
29714 arg_conv.inner = (void*)(arg & (~1));
29715 arg_conv.is_owned = false;
29716 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29717 int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
29721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29722 LDKChannelDetails orig_conv;
29723 orig_conv.inner = (void*)(orig & (~1));
29724 orig_conv.is_owned = false;
29725 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29726 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
29727 int64_t ret_ref = 0;
29728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29731 ret_ref = (uintptr_t)ret_var.inner;
29732 if (ret_var.is_owned) {
29738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29739 LDKChannelDetails this_arg_conv;
29740 this_arg_conv.inner = (void*)(this_arg & (~1));
29741 this_arg_conv.is_owned = false;
29742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29743 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29744 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
29745 int64_t ret_ref = (uintptr_t)ret_copy;
29749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29750 LDKChannelDetails this_arg_conv;
29751 this_arg_conv.inner = (void*)(this_arg & (~1));
29752 this_arg_conv.is_owned = false;
29753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29754 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29755 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
29756 int64_t ret_ref = (uintptr_t)ret_copy;
29760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29761 if ((this_ptr & 1) != 0) return;
29762 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
29763 CHECK_ACCESS(this_ptr_ptr);
29764 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
29765 FREE((void*)this_ptr);
29766 PaymentSendFailure_free(this_ptr_conv);
29769 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
29770 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29771 *ret_copy = PaymentSendFailure_clone(arg);
29772 int64_t ret_ref = (uintptr_t)ret_copy;
29775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29776 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
29777 int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
29781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29782 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
29783 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29784 *ret_copy = PaymentSendFailure_clone(orig_conv);
29785 int64_t ret_ref = (uintptr_t)ret_copy;
29789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
29790 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
29791 CHECK_ACCESS(a_ptr);
29792 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
29793 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
29794 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29795 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
29796 int64_t ret_ref = (uintptr_t)ret_copy;
29800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
29801 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
29802 a_constr.datalen = (*env)->GetArrayLength(env, a);
29803 if (a_constr.datalen > 0)
29804 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29806 a_constr.data = NULL;
29807 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29808 for (size_t w = 0; w < a_constr.datalen; w++) {
29809 int64_t a_conv_22 = a_vals[w];
29810 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
29811 CHECK_ACCESS(a_conv_22_ptr);
29812 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
29813 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
29814 a_constr.data[w] = a_conv_22_conv;
29816 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29817 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29818 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
29819 int64_t ret_ref = (uintptr_t)ret_copy;
29823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
29824 LDKCVec_APIErrorZ a_constr;
29825 a_constr.datalen = (*env)->GetArrayLength(env, a);
29826 if (a_constr.datalen > 0)
29827 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
29829 a_constr.data = NULL;
29830 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29831 for (size_t k = 0; k < a_constr.datalen; k++) {
29832 int64_t a_conv_10 = a_vals[k];
29833 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
29834 CHECK_ACCESS(a_conv_10_ptr);
29835 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
29836 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
29837 a_constr.data[k] = a_conv_10_conv;
29839 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29840 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29841 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
29842 int64_t ret_ref = (uintptr_t)ret_copy;
29846 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) {
29847 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
29848 results_constr.datalen = (*env)->GetArrayLength(env, results);
29849 if (results_constr.datalen > 0)
29850 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29852 results_constr.data = NULL;
29853 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
29854 for (size_t w = 0; w < results_constr.datalen; w++) {
29855 int64_t results_conv_22 = results_vals[w];
29856 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
29857 CHECK_ACCESS(results_conv_22_ptr);
29858 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
29859 results_constr.data[w] = results_conv_22_conv;
29861 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
29862 LDKRouteParameters failed_paths_retry_conv;
29863 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
29864 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
29865 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
29866 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
29867 LDKThirtyTwoBytes payment_id_ref;
29868 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29869 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29870 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29871 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
29872 int64_t ret_ref = (uintptr_t)ret_copy;
29876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29877 LDKPhantomRouteHints this_obj_conv;
29878 this_obj_conv.inner = (void*)(this_obj & (~1));
29879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29881 PhantomRouteHints_free(this_obj_conv);
29884 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
29885 LDKPhantomRouteHints this_ptr_conv;
29886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29887 this_ptr_conv.is_owned = false;
29888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29889 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
29890 int64_tArray ret_arr = NULL;
29891 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29892 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29893 for (size_t q = 0; q < ret_var.datalen; q++) {
29894 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29895 int64_t ret_conv_16_ref = 0;
29896 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29897 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29899 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29900 if (ret_conv_16_var.is_owned) {
29901 ret_conv_16_ref |= 1;
29903 ret_arr_ptr[q] = ret_conv_16_ref;
29905 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29906 FREE(ret_var.data);
29910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29911 LDKPhantomRouteHints this_ptr_conv;
29912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29913 this_ptr_conv.is_owned = false;
29914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29915 LDKCVec_ChannelDetailsZ val_constr;
29916 val_constr.datalen = (*env)->GetArrayLength(env, val);
29917 if (val_constr.datalen > 0)
29918 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29920 val_constr.data = NULL;
29921 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29922 for (size_t q = 0; q < val_constr.datalen; q++) {
29923 int64_t val_conv_16 = val_vals[q];
29924 LDKChannelDetails val_conv_16_conv;
29925 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
29926 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
29927 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
29928 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
29929 val_constr.data[q] = val_conv_16_conv;
29931 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29932 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
29935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
29936 LDKPhantomRouteHints this_ptr_conv;
29937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29938 this_ptr_conv.is_owned = false;
29939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29940 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
29944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29945 LDKPhantomRouteHints this_ptr_conv;
29946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29947 this_ptr_conv.is_owned = false;
29948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29949 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
29952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29953 LDKPhantomRouteHints this_ptr_conv;
29954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29955 this_ptr_conv.is_owned = false;
29956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29957 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29958 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
29962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29963 LDKPhantomRouteHints 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 LDKPublicKey val_ref;
29968 CHECK((*env)->GetArrayLength(env, val) == 33);
29969 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29970 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
29973 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) {
29974 LDKCVec_ChannelDetailsZ channels_arg_constr;
29975 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29976 if (channels_arg_constr.datalen > 0)
29977 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29979 channels_arg_constr.data = NULL;
29980 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29981 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
29982 int64_t channels_arg_conv_16 = channels_arg_vals[q];
29983 LDKChannelDetails channels_arg_conv_16_conv;
29984 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
29985 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
29986 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
29987 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
29988 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
29990 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29991 LDKPublicKey real_node_pubkey_arg_ref;
29992 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
29993 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
29994 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
29995 int64_t ret_ref = 0;
29996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29999 ret_ref = (uintptr_t)ret_var.inner;
30000 if (ret_var.is_owned) {
30006 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
30007 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
30008 int64_t ret_ref = 0;
30009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30012 ret_ref = (uintptr_t)ret_var.inner;
30013 if (ret_var.is_owned) {
30018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30019 LDKPhantomRouteHints arg_conv;
30020 arg_conv.inner = (void*)(arg & (~1));
30021 arg_conv.is_owned = false;
30022 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30023 int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
30027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30028 LDKPhantomRouteHints orig_conv;
30029 orig_conv.inner = (void*)(orig & (~1));
30030 orig_conv.is_owned = false;
30031 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30032 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
30033 int64_t ret_ref = 0;
30034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30037 ret_ref = (uintptr_t)ret_var.inner;
30038 if (ret_var.is_owned) {
30044 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) {
30045 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
30046 CHECK_ACCESS(fee_est_ptr);
30047 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
30048 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
30049 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30050 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
30052 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
30053 CHECK_ACCESS(chain_monitor_ptr);
30054 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30055 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30056 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30057 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30059 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
30060 CHECK_ACCESS(tx_broadcaster_ptr);
30061 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30062 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30063 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30064 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30066 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
30067 CHECK_ACCESS(logger_ptr);
30068 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30069 if (logger_conv.free == LDKLogger_JCalls_free) {
30070 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30071 LDKLogger_JCalls_cloned(&logger_conv);
30073 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30074 CHECK_ACCESS(keys_manager_ptr);
30075 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30076 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30078 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30080 LDKUserConfig config_conv;
30081 config_conv.inner = (void*)(config & (~1));
30082 config_conv.is_owned = (config & 1) || (config == 0);
30083 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
30084 config_conv = UserConfig_clone(&config_conv);
30085 LDKChainParameters params_conv;
30086 params_conv.inner = (void*)(params & (~1));
30087 params_conv.is_owned = (params & 1) || (params == 0);
30088 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
30089 params_conv = ChainParameters_clone(¶ms_conv);
30090 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
30091 int64_t ret_ref = 0;
30092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30095 ret_ref = (uintptr_t)ret_var.inner;
30096 if (ret_var.is_owned) {
30102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
30103 LDKChannelManager this_arg_conv;
30104 this_arg_conv.inner = (void*)(this_arg & (~1));
30105 this_arg_conv.is_owned = false;
30106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30107 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
30108 int64_t ret_ref = 0;
30109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30112 ret_ref = (uintptr_t)ret_var.inner;
30113 if (ret_var.is_owned) {
30119 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) {
30120 LDKChannelManager this_arg_conv;
30121 this_arg_conv.inner = (void*)(this_arg & (~1));
30122 this_arg_conv.is_owned = false;
30123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30124 LDKPublicKey their_network_key_ref;
30125 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
30126 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
30127 LDKUserConfig override_config_conv;
30128 override_config_conv.inner = (void*)(override_config & (~1));
30129 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
30130 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
30131 override_config_conv = UserConfig_clone(&override_config_conv);
30132 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
30133 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
30134 return (int64_t)ret_conv;
30137 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30138 LDKChannelManager this_arg_conv;
30139 this_arg_conv.inner = (void*)(this_arg & (~1));
30140 this_arg_conv.is_owned = false;
30141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30142 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
30143 int64_tArray ret_arr = NULL;
30144 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30145 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30146 for (size_t q = 0; q < ret_var.datalen; q++) {
30147 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30148 int64_t ret_conv_16_ref = 0;
30149 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30150 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30152 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30153 if (ret_conv_16_var.is_owned) {
30154 ret_conv_16_ref |= 1;
30156 ret_arr_ptr[q] = ret_conv_16_ref;
30158 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30159 FREE(ret_var.data);
30163 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30164 LDKChannelManager this_arg_conv;
30165 this_arg_conv.inner = (void*)(this_arg & (~1));
30166 this_arg_conv.is_owned = false;
30167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30168 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
30169 int64_tArray ret_arr = NULL;
30170 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30171 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30172 for (size_t q = 0; q < ret_var.datalen; q++) {
30173 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30174 int64_t ret_conv_16_ref = 0;
30175 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30176 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30177 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30178 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30179 if (ret_conv_16_var.is_owned) {
30180 ret_conv_16_ref |= 1;
30182 ret_arr_ptr[q] = ret_conv_16_ref;
30184 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30185 FREE(ret_var.data);
30189 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) {
30190 LDKChannelManager this_arg_conv;
30191 this_arg_conv.inner = (void*)(this_arg & (~1));
30192 this_arg_conv.is_owned = false;
30193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30194 unsigned char channel_id_arr[32];
30195 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30196 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30197 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30198 LDKPublicKey counterparty_node_id_ref;
30199 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30200 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30201 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30202 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30203 return (int64_t)ret_conv;
30206 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) {
30207 LDKChannelManager this_arg_conv;
30208 this_arg_conv.inner = (void*)(this_arg & (~1));
30209 this_arg_conv.is_owned = false;
30210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30211 unsigned char channel_id_arr[32];
30212 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30213 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30214 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30215 LDKPublicKey counterparty_node_id_ref;
30216 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30217 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30218 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30219 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
30220 return (int64_t)ret_conv;
30223 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) {
30224 LDKChannelManager this_arg_conv;
30225 this_arg_conv.inner = (void*)(this_arg & (~1));
30226 this_arg_conv.is_owned = false;
30227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30228 unsigned char channel_id_arr[32];
30229 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30230 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30231 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30232 LDKPublicKey counterparty_node_id_ref;
30233 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30234 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30235 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30236 *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30237 return (int64_t)ret_conv;
30240 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) {
30241 LDKChannelManager this_arg_conv;
30242 this_arg_conv.inner = (void*)(this_arg & (~1));
30243 this_arg_conv.is_owned = false;
30244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30245 unsigned char channel_id_arr[32];
30246 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30247 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30248 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30249 LDKPublicKey counterparty_node_id_ref;
30250 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30251 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30252 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30253 *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30254 return (int64_t)ret_conv;
30257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30258 LDKChannelManager this_arg_conv;
30259 this_arg_conv.inner = (void*)(this_arg & (~1));
30260 this_arg_conv.is_owned = false;
30261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30262 ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
30265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30266 LDKChannelManager this_arg_conv;
30267 this_arg_conv.inner = (void*)(this_arg & (~1));
30268 this_arg_conv.is_owned = false;
30269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30270 ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
30273 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) {
30274 LDKChannelManager this_arg_conv;
30275 this_arg_conv.inner = (void*)(this_arg & (~1));
30276 this_arg_conv.is_owned = false;
30277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30278 LDKRoute route_conv;
30279 route_conv.inner = (void*)(route & (~1));
30280 route_conv.is_owned = false;
30281 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30282 LDKThirtyTwoBytes payment_hash_ref;
30283 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30284 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30285 LDKThirtyTwoBytes payment_secret_ref;
30286 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30287 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30288 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
30289 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
30290 return (int64_t)ret_conv;
30293 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) {
30294 LDKChannelManager this_arg_conv;
30295 this_arg_conv.inner = (void*)(this_arg & (~1));
30296 this_arg_conv.is_owned = false;
30297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30298 LDKRoute route_conv;
30299 route_conv.inner = (void*)(route & (~1));
30300 route_conv.is_owned = false;
30301 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30302 LDKThirtyTwoBytes payment_id_ref;
30303 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30304 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30305 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30306 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
30307 return (int64_t)ret_conv;
30310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
30311 LDKChannelManager this_arg_conv;
30312 this_arg_conv.inner = (void*)(this_arg & (~1));
30313 this_arg_conv.is_owned = false;
30314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30315 LDKThirtyTwoBytes payment_id_ref;
30316 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30317 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30318 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
30321 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) {
30322 LDKChannelManager this_arg_conv;
30323 this_arg_conv.inner = (void*)(this_arg & (~1));
30324 this_arg_conv.is_owned = false;
30325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30326 LDKRoute route_conv;
30327 route_conv.inner = (void*)(route & (~1));
30328 route_conv.is_owned = false;
30329 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30330 LDKThirtyTwoBytes payment_preimage_ref;
30331 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
30332 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
30333 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
30334 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
30335 return (int64_t)ret_conv;
30338 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) {
30339 LDKChannelManager this_arg_conv;
30340 this_arg_conv.inner = (void*)(this_arg & (~1));
30341 this_arg_conv.is_owned = false;
30342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30343 unsigned char temporary_channel_id_arr[32];
30344 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30345 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30346 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30347 LDKPublicKey counterparty_node_id_ref;
30348 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30349 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30350 LDKTransaction funding_transaction_ref;
30351 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
30352 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
30353 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
30354 funding_transaction_ref.data_is_owned = true;
30355 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30356 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
30357 return (int64_t)ret_conv;
30360 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) {
30361 LDKChannelManager this_arg_conv;
30362 this_arg_conv.inner = (void*)(this_arg & (~1));
30363 this_arg_conv.is_owned = false;
30364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30365 LDKThreeBytes rgb_ref;
30366 CHECK((*env)->GetArrayLength(env, rgb) == 3);
30367 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
30368 LDKThirtyTwoBytes alias_ref;
30369 CHECK((*env)->GetArrayLength(env, alias) == 32);
30370 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
30371 LDKCVec_NetAddressZ addresses_constr;
30372 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
30373 if (addresses_constr.datalen > 0)
30374 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30376 addresses_constr.data = NULL;
30377 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
30378 for (size_t m = 0; m < addresses_constr.datalen; m++) {
30379 int64_t addresses_conv_12 = addresses_vals[m];
30380 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
30381 CHECK_ACCESS(addresses_conv_12_ptr);
30382 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
30383 addresses_constr.data[m] = addresses_conv_12_conv;
30385 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
30386 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
30389 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) {
30390 LDKChannelManager this_arg_conv;
30391 this_arg_conv.inner = (void*)(this_arg & (~1));
30392 this_arg_conv.is_owned = false;
30393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30394 LDKPublicKey counterparty_node_id_ref;
30395 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30396 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30397 LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
30398 channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
30399 if (channel_ids_constr.datalen > 0)
30400 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
30402 channel_ids_constr.data = NULL;
30403 for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
30404 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
30405 LDKThirtyTwoBytes channel_ids_conv_8_ref;
30406 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
30407 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
30408 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
30410 LDKChannelConfig config_conv;
30411 config_conv.inner = (void*)(config & (~1));
30412 config_conv.is_owned = false;
30413 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
30414 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30415 *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
30416 return (int64_t)ret_conv;
30419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
30420 LDKChannelManager 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 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
30427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
30428 LDKChannelManager this_arg_conv;
30429 this_arg_conv.inner = (void*)(this_arg & (~1));
30430 this_arg_conv.is_owned = false;
30431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30432 ChannelManager_timer_tick_occurred(&this_arg_conv);
30435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
30436 LDKChannelManager this_arg_conv;
30437 this_arg_conv.inner = (void*)(this_arg & (~1));
30438 this_arg_conv.is_owned = false;
30439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30440 unsigned char payment_hash_arr[32];
30441 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30442 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
30443 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
30444 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
30447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
30448 LDKChannelManager this_arg_conv;
30449 this_arg_conv.inner = (void*)(this_arg & (~1));
30450 this_arg_conv.is_owned = false;
30451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30452 LDKThirtyTwoBytes payment_preimage_ref;
30453 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
30454 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
30455 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
30458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
30459 LDKChannelManager this_arg_conv;
30460 this_arg_conv.inner = (void*)(this_arg & (~1));
30461 this_arg_conv.is_owned = false;
30462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30463 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30464 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
30468 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) {
30469 LDKChannelManager this_arg_conv;
30470 this_arg_conv.inner = (void*)(this_arg & (~1));
30471 this_arg_conv.is_owned = false;
30472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30473 unsigned char temporary_channel_id_arr[32];
30474 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30475 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30476 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30477 LDKPublicKey counterparty_node_id_ref;
30478 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30479 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30480 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30481 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
30482 return (int64_t)ret_conv;
30485 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) {
30486 LDKChannelManager this_arg_conv;
30487 this_arg_conv.inner = (void*)(this_arg & (~1));
30488 this_arg_conv.is_owned = false;
30489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30490 unsigned char temporary_channel_id_arr[32];
30491 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30492 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30493 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30494 LDKPublicKey counterparty_node_id_ref;
30495 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30496 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30497 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30498 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
30499 return (int64_t)ret_conv;
30502 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) {
30503 LDKChannelManager this_arg_conv;
30504 this_arg_conv.inner = (void*)(this_arg & (~1));
30505 this_arg_conv.is_owned = false;
30506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30507 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30508 CHECK_ACCESS(min_value_msat_ptr);
30509 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30510 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30511 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30512 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30513 return (int64_t)ret_conv;
30516 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) {
30517 LDKChannelManager this_arg_conv;
30518 this_arg_conv.inner = (void*)(this_arg & (~1));
30519 this_arg_conv.is_owned = false;
30520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30521 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30522 CHECK_ACCESS(min_value_msat_ptr);
30523 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30524 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30525 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
30526 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30527 return (int64_t)ret_conv;
30530 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) {
30531 LDKChannelManager this_arg_conv;
30532 this_arg_conv.inner = (void*)(this_arg & (~1));
30533 this_arg_conv.is_owned = false;
30534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30535 LDKThirtyTwoBytes payment_hash_ref;
30536 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30537 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30538 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30539 CHECK_ACCESS(min_value_msat_ptr);
30540 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30541 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30542 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30543 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30544 return (int64_t)ret_conv;
30547 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) {
30548 LDKChannelManager this_arg_conv;
30549 this_arg_conv.inner = (void*)(this_arg & (~1));
30550 this_arg_conv.is_owned = false;
30551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30552 LDKThirtyTwoBytes payment_hash_ref;
30553 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30554 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30555 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30556 CHECK_ACCESS(min_value_msat_ptr);
30557 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30558 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30559 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
30560 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30561 return (int64_t)ret_conv;
30564 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) {
30565 LDKChannelManager this_arg_conv;
30566 this_arg_conv.inner = (void*)(this_arg & (~1));
30567 this_arg_conv.is_owned = false;
30568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30569 LDKThirtyTwoBytes payment_hash_ref;
30570 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30571 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30572 LDKThirtyTwoBytes payment_secret_ref;
30573 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30574 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30575 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
30576 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
30577 return (int64_t)ret_conv;
30580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30581 LDKChannelManager this_arg_conv;
30582 this_arg_conv.inner = (void*)(this_arg & (~1));
30583 this_arg_conv.is_owned = false;
30584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30585 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
30589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
30590 LDKChannelManager this_arg_conv;
30591 this_arg_conv.inner = (void*)(this_arg & (~1));
30592 this_arg_conv.is_owned = false;
30593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30594 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
30595 int64_t ret_ref = 0;
30596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30599 ret_ref = (uintptr_t)ret_var.inner;
30600 if (ret_var.is_owned) {
30606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30607 LDKChannelManager this_arg_conv;
30608 this_arg_conv.inner = (void*)(this_arg & (~1));
30609 this_arg_conv.is_owned = false;
30610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30611 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
30612 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
30613 return (int64_t)ret_ret;
30616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30617 LDKChannelManager this_arg_conv;
30618 this_arg_conv.inner = (void*)(this_arg & (~1));
30619 this_arg_conv.is_owned = false;
30620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30621 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30622 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
30623 return (int64_t)ret_ret;
30626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
30627 LDKChannelManager this_arg_conv;
30628 this_arg_conv.inner = (void*)(this_arg & (~1));
30629 this_arg_conv.is_owned = false;
30630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30631 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30632 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
30633 return (int64_t)ret_ret;
30636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
30637 LDKChannelManager this_arg_conv;
30638 this_arg_conv.inner = (void*)(this_arg & (~1));
30639 this_arg_conv.is_owned = false;
30640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30641 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30642 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
30643 return (int64_t)ret_ret;
30646 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) {
30647 LDKChannelManager this_arg_conv;
30648 this_arg_conv.inner = (void*)(this_arg & (~1));
30649 this_arg_conv.is_owned = false;
30650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30651 jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
30655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
30656 LDKChannelManager this_arg_conv;
30657 this_arg_conv.inner = (void*)(this_arg & (~1));
30658 this_arg_conv.is_owned = false;
30659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30660 ChannelManager_await_persistable_update(&this_arg_conv);
30663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
30664 LDKChannelManager this_arg_conv;
30665 this_arg_conv.inner = (void*)(this_arg & (~1));
30666 this_arg_conv.is_owned = false;
30667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30668 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
30669 int64_t ret_ref = 0;
30670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30673 ret_ref = (uintptr_t)ret_var.inner;
30674 if (ret_var.is_owned) {
30680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
30681 LDKChannelManager this_arg_conv;
30682 this_arg_conv.inner = (void*)(this_arg & (~1));
30683 this_arg_conv.is_owned = false;
30684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30685 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
30686 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
30687 return (int64_t)ret_ret;
30690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30691 LDKCounterpartyForwardingInfo obj_conv;
30692 obj_conv.inner = (void*)(obj & (~1));
30693 obj_conv.is_owned = false;
30694 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30695 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
30696 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30697 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30698 CVec_u8Z_free(ret_var);
30702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30703 LDKu8slice ser_ref;
30704 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30705 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30706 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30707 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
30708 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30709 return (int64_t)ret_conv;
30712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
30713 LDKChannelCounterparty obj_conv;
30714 obj_conv.inner = (void*)(obj & (~1));
30715 obj_conv.is_owned = false;
30716 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30717 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
30718 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30719 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30720 CVec_u8Z_free(ret_var);
30724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30725 LDKu8slice ser_ref;
30726 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30727 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30728 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30729 *ret_conv = ChannelCounterparty_read(ser_ref);
30730 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30731 return (int64_t)ret_conv;
30734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
30735 LDKChannelDetails obj_conv;
30736 obj_conv.inner = (void*)(obj & (~1));
30737 obj_conv.is_owned = false;
30738 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30739 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
30740 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30741 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30742 CVec_u8Z_free(ret_var);
30746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30747 LDKu8slice ser_ref;
30748 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30749 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30750 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30751 *ret_conv = ChannelDetails_read(ser_ref);
30752 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30753 return (int64_t)ret_conv;
30756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
30757 LDKPhantomRouteHints obj_conv;
30758 obj_conv.inner = (void*)(obj & (~1));
30759 obj_conv.is_owned = false;
30760 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30761 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
30762 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30763 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30764 CVec_u8Z_free(ret_var);
30768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30769 LDKu8slice ser_ref;
30770 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30771 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30772 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30773 *ret_conv = PhantomRouteHints_read(ser_ref);
30774 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30775 return (int64_t)ret_conv;
30778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
30779 LDKChannelManager obj_conv;
30780 obj_conv.inner = (void*)(obj & (~1));
30781 obj_conv.is_owned = false;
30782 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30783 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
30784 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30785 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30786 CVec_u8Z_free(ret_var);
30790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30791 LDKChannelManagerReadArgs this_obj_conv;
30792 this_obj_conv.inner = (void*)(this_obj & (~1));
30793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30795 ChannelManagerReadArgs_free(this_obj_conv);
30798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
30799 LDKChannelManagerReadArgs this_ptr_conv;
30800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30801 this_ptr_conv.is_owned = false;
30802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30803 // WARNING: This object doesn't live past this scope, needs clone!
30804 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
30808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30809 LDKChannelManagerReadArgs this_ptr_conv;
30810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30811 this_ptr_conv.is_owned = false;
30812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30813 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30814 CHECK_ACCESS(val_ptr);
30815 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
30816 if (val_conv.free == LDKKeysInterface_JCalls_free) {
30817 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30818 LDKKeysInterface_JCalls_cloned(&val_conv);
30820 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
30823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
30824 LDKChannelManagerReadArgs this_ptr_conv;
30825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30826 this_ptr_conv.is_owned = false;
30827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30828 // WARNING: This object doesn't live past this scope, needs clone!
30829 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
30833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30834 LDKChannelManagerReadArgs this_ptr_conv;
30835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30836 this_ptr_conv.is_owned = false;
30837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30838 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30839 CHECK_ACCESS(val_ptr);
30840 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
30841 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
30842 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30843 LDKFeeEstimator_JCalls_cloned(&val_conv);
30845 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
30848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
30849 LDKChannelManagerReadArgs this_ptr_conv;
30850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30851 this_ptr_conv.is_owned = false;
30852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30853 // WARNING: This object doesn't live past this scope, needs clone!
30854 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
30858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30859 LDKChannelManagerReadArgs this_ptr_conv;
30860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30861 this_ptr_conv.is_owned = false;
30862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30863 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30864 CHECK_ACCESS(val_ptr);
30865 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
30866 if (val_conv.free == LDKWatch_JCalls_free) {
30867 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30868 LDKWatch_JCalls_cloned(&val_conv);
30870 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
30873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
30874 LDKChannelManagerReadArgs this_ptr_conv;
30875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30876 this_ptr_conv.is_owned = false;
30877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30878 // WARNING: This object doesn't live past this scope, needs clone!
30879 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
30883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30884 LDKChannelManagerReadArgs this_ptr_conv;
30885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30886 this_ptr_conv.is_owned = false;
30887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30888 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30889 CHECK_ACCESS(val_ptr);
30890 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
30891 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
30892 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30893 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
30895 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
30898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
30899 LDKChannelManagerReadArgs this_ptr_conv;
30900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30901 this_ptr_conv.is_owned = false;
30902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30903 // WARNING: This object doesn't live past this scope, needs clone!
30904 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
30908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30909 LDKChannelManagerReadArgs this_ptr_conv;
30910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30911 this_ptr_conv.is_owned = false;
30912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30913 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30914 CHECK_ACCESS(val_ptr);
30915 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30916 if (val_conv.free == LDKLogger_JCalls_free) {
30917 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30918 LDKLogger_JCalls_cloned(&val_conv);
30920 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30924 LDKChannelManagerReadArgs this_ptr_conv;
30925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30926 this_ptr_conv.is_owned = false;
30927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30928 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30929 int64_t ret_ref = 0;
30930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30933 ret_ref = (uintptr_t)ret_var.inner;
30934 if (ret_var.is_owned) {
30940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30941 LDKChannelManagerReadArgs this_ptr_conv;
30942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30943 this_ptr_conv.is_owned = false;
30944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30945 LDKUserConfig val_conv;
30946 val_conv.inner = (void*)(val & (~1));
30947 val_conv.is_owned = (val & 1) || (val == 0);
30948 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30949 val_conv = UserConfig_clone(&val_conv);
30950 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30953 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) {
30954 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30955 CHECK_ACCESS(keys_manager_ptr);
30956 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30957 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30959 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30961 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
30962 CHECK_ACCESS(fee_estimator_ptr);
30963 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30964 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30965 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30966 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30968 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
30969 CHECK_ACCESS(chain_monitor_ptr);
30970 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30971 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30972 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30973 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30975 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
30976 CHECK_ACCESS(tx_broadcaster_ptr);
30977 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30978 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30979 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30980 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30982 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
30983 CHECK_ACCESS(logger_ptr);
30984 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30985 if (logger_conv.free == LDKLogger_JCalls_free) {
30986 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30987 LDKLogger_JCalls_cloned(&logger_conv);
30989 LDKUserConfig default_config_conv;
30990 default_config_conv.inner = (void*)(default_config & (~1));
30991 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
30992 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30993 default_config_conv = UserConfig_clone(&default_config_conv);
30994 LDKCVec_ChannelMonitorZ channel_monitors_constr;
30995 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
30996 if (channel_monitors_constr.datalen > 0)
30997 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30999 channel_monitors_constr.data = NULL;
31000 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
31001 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
31002 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
31003 LDKChannelMonitor channel_monitors_conv_16_conv;
31004 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
31005 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
31006 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
31007 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
31009 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
31010 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);
31011 int64_t ret_ref = 0;
31012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31015 ret_ref = (uintptr_t)ret_var.inner;
31016 if (ret_var.is_owned) {
31022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
31023 LDKu8slice ser_ref;
31024 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31025 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31026 LDKChannelManagerReadArgs arg_conv;
31027 arg_conv.inner = (void*)(arg & (~1));
31028 arg_conv.is_owned = (arg & 1) || (arg == 0);
31029 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31030 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
31031 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
31032 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
31033 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31034 return (int64_t)ret_conv;
31037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31038 LDKExpandedKey this_obj_conv;
31039 this_obj_conv.inner = (void*)(this_obj & (~1));
31040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31042 ExpandedKey_free(this_obj_conv);
31045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
31046 unsigned char key_material_arr[32];
31047 CHECK((*env)->GetArrayLength(env, key_material) == 32);
31048 (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
31049 unsigned char (*key_material_ref)[32] = &key_material_arr;
31050 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
31051 int64_t ret_ref = 0;
31052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31055 ret_ref = (uintptr_t)ret_var.inner;
31056 if (ret_var.is_owned) {
31062 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) {
31063 LDKExpandedKey keys_conv;
31064 keys_conv.inner = (void*)(keys & (~1));
31065 keys_conv.is_owned = false;
31066 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31067 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31068 CHECK_ACCESS(min_value_msat_ptr);
31069 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31070 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31071 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
31072 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
31073 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
31074 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31075 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
31076 return (int64_t)ret_conv;
31079 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) {
31080 LDKExpandedKey keys_conv;
31081 keys_conv.inner = (void*)(keys & (~1));
31082 keys_conv.is_owned = false;
31083 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31084 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31085 CHECK_ACCESS(min_value_msat_ptr);
31086 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31087 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31088 LDKThirtyTwoBytes payment_hash_ref;
31089 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31090 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31091 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31092 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
31093 return (int64_t)ret_conv;
31096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31097 LDKDecodeError this_obj_conv;
31098 this_obj_conv.inner = (void*)(this_obj & (~1));
31099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31101 DecodeError_free(this_obj_conv);
31104 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
31105 LDKDecodeError ret_var = DecodeError_clone(arg);
31106 int64_t ret_ref = 0;
31107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31110 ret_ref = (uintptr_t)ret_var.inner;
31111 if (ret_var.is_owned) {
31116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31117 LDKDecodeError arg_conv;
31118 arg_conv.inner = (void*)(arg & (~1));
31119 arg_conv.is_owned = false;
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31121 int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
31125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31126 LDKDecodeError orig_conv;
31127 orig_conv.inner = (void*)(orig & (~1));
31128 orig_conv.is_owned = false;
31129 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31130 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
31131 int64_t ret_ref = 0;
31132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31135 ret_ref = (uintptr_t)ret_var.inner;
31136 if (ret_var.is_owned) {
31142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31143 LDKInit this_obj_conv;
31144 this_obj_conv.inner = (void*)(this_obj & (~1));
31145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31147 Init_free(this_obj_conv);
31150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
31151 LDKInit this_ptr_conv;
31152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31153 this_ptr_conv.is_owned = false;
31154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31155 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
31156 int64_t ret_ref = 0;
31157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31160 ret_ref = (uintptr_t)ret_var.inner;
31161 if (ret_var.is_owned) {
31167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31168 LDKInit this_ptr_conv;
31169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31170 this_ptr_conv.is_owned = false;
31171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31172 LDKInitFeatures val_conv;
31173 val_conv.inner = (void*)(val & (~1));
31174 val_conv.is_owned = (val & 1) || (val == 0);
31175 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31176 val_conv = InitFeatures_clone(&val_conv);
31177 Init_set_features(&this_ptr_conv, val_conv);
31180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
31181 LDKInit this_ptr_conv;
31182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31183 this_ptr_conv.is_owned = false;
31184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31185 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
31186 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
31187 int64_t ret_ref = (uintptr_t)ret_copy;
31191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31192 LDKInit this_ptr_conv;
31193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31194 this_ptr_conv.is_owned = false;
31195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31196 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31197 CHECK_ACCESS(val_ptr);
31198 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
31199 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
31200 Init_set_remote_network_address(&this_ptr_conv, val_conv);
31203 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) {
31204 LDKInitFeatures features_arg_conv;
31205 features_arg_conv.inner = (void*)(features_arg & (~1));
31206 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31207 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31208 features_arg_conv = InitFeatures_clone(&features_arg_conv);
31209 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
31210 CHECK_ACCESS(remote_network_address_arg_ptr);
31211 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
31212 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
31213 int64_t ret_ref = 0;
31214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31217 ret_ref = (uintptr_t)ret_var.inner;
31218 if (ret_var.is_owned) {
31224 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
31225 LDKInit ret_var = Init_clone(arg);
31226 int64_t ret_ref = 0;
31227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31230 ret_ref = (uintptr_t)ret_var.inner;
31231 if (ret_var.is_owned) {
31236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31238 arg_conv.inner = (void*)(arg & (~1));
31239 arg_conv.is_owned = false;
31240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31241 int64_t ret_conv = Init_clone_ptr(&arg_conv);
31245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31247 orig_conv.inner = (void*)(orig & (~1));
31248 orig_conv.is_owned = false;
31249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31250 LDKInit ret_var = Init_clone(&orig_conv);
31251 int64_t ret_ref = 0;
31252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31255 ret_ref = (uintptr_t)ret_var.inner;
31256 if (ret_var.is_owned) {
31262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31263 LDKErrorMessage this_obj_conv;
31264 this_obj_conv.inner = (void*)(this_obj & (~1));
31265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31267 ErrorMessage_free(this_obj_conv);
31270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31271 LDKErrorMessage this_ptr_conv;
31272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31273 this_ptr_conv.is_owned = false;
31274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31275 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31276 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
31280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31281 LDKErrorMessage this_ptr_conv;
31282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31283 this_ptr_conv.is_owned = false;
31284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31285 LDKThirtyTwoBytes val_ref;
31286 CHECK((*env)->GetArrayLength(env, val) == 32);
31287 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31288 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
31291 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
31292 LDKErrorMessage this_ptr_conv;
31293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31294 this_ptr_conv.is_owned = false;
31295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31296 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
31297 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
31303 LDKErrorMessage this_ptr_conv;
31304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31305 this_ptr_conv.is_owned = false;
31306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31307 LDKStr val_conv = java_to_owned_str(env, val);
31308 ErrorMessage_set_data(&this_ptr_conv, val_conv);
31311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
31312 LDKThirtyTwoBytes channel_id_arg_ref;
31313 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31314 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31315 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
31316 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
31317 int64_t ret_ref = 0;
31318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31321 ret_ref = (uintptr_t)ret_var.inner;
31322 if (ret_var.is_owned) {
31328 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
31329 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
31330 int64_t ret_ref = 0;
31331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31334 ret_ref = (uintptr_t)ret_var.inner;
31335 if (ret_var.is_owned) {
31340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31341 LDKErrorMessage arg_conv;
31342 arg_conv.inner = (void*)(arg & (~1));
31343 arg_conv.is_owned = false;
31344 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31345 int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
31349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31350 LDKErrorMessage orig_conv;
31351 orig_conv.inner = (void*)(orig & (~1));
31352 orig_conv.is_owned = false;
31353 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31354 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
31355 int64_t ret_ref = 0;
31356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31359 ret_ref = (uintptr_t)ret_var.inner;
31360 if (ret_var.is_owned) {
31366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31367 LDKWarningMessage this_obj_conv;
31368 this_obj_conv.inner = (void*)(this_obj & (~1));
31369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31371 WarningMessage_free(this_obj_conv);
31374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31375 LDKWarningMessage this_ptr_conv;
31376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31377 this_ptr_conv.is_owned = false;
31378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31379 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31380 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
31384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31385 LDKWarningMessage this_ptr_conv;
31386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31387 this_ptr_conv.is_owned = false;
31388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31389 LDKThirtyTwoBytes val_ref;
31390 CHECK((*env)->GetArrayLength(env, val) == 32);
31391 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31392 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
31395 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
31396 LDKWarningMessage this_ptr_conv;
31397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31398 this_ptr_conv.is_owned = false;
31399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31400 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
31401 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
31407 LDKWarningMessage this_ptr_conv;
31408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31409 this_ptr_conv.is_owned = false;
31410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31411 LDKStr val_conv = java_to_owned_str(env, val);
31412 WarningMessage_set_data(&this_ptr_conv, val_conv);
31415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
31416 LDKThirtyTwoBytes channel_id_arg_ref;
31417 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31418 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31419 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
31420 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
31421 int64_t ret_ref = 0;
31422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31425 ret_ref = (uintptr_t)ret_var.inner;
31426 if (ret_var.is_owned) {
31432 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
31433 LDKWarningMessage ret_var = WarningMessage_clone(arg);
31434 int64_t ret_ref = 0;
31435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31438 ret_ref = (uintptr_t)ret_var.inner;
31439 if (ret_var.is_owned) {
31444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31445 LDKWarningMessage arg_conv;
31446 arg_conv.inner = (void*)(arg & (~1));
31447 arg_conv.is_owned = false;
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31449 int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
31453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31454 LDKWarningMessage orig_conv;
31455 orig_conv.inner = (void*)(orig & (~1));
31456 orig_conv.is_owned = false;
31457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31458 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
31459 int64_t ret_ref = 0;
31460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31463 ret_ref = (uintptr_t)ret_var.inner;
31464 if (ret_var.is_owned) {
31470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31471 LDKPing this_obj_conv;
31472 this_obj_conv.inner = (void*)(this_obj & (~1));
31473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31475 Ping_free(this_obj_conv);
31478 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31479 LDKPing this_ptr_conv;
31480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31481 this_ptr_conv.is_owned = false;
31482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31483 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
31487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31488 LDKPing this_ptr_conv;
31489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31490 this_ptr_conv.is_owned = false;
31491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31492 Ping_set_ponglen(&this_ptr_conv, val);
31495 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31496 LDKPing this_ptr_conv;
31497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31498 this_ptr_conv.is_owned = false;
31499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31500 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
31504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31505 LDKPing this_ptr_conv;
31506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31507 this_ptr_conv.is_owned = false;
31508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31509 Ping_set_byteslen(&this_ptr_conv, val);
31512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
31513 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
31514 int64_t ret_ref = 0;
31515 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31516 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31518 ret_ref = (uintptr_t)ret_var.inner;
31519 if (ret_var.is_owned) {
31525 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
31526 LDKPing ret_var = Ping_clone(arg);
31527 int64_t ret_ref = 0;
31528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31531 ret_ref = (uintptr_t)ret_var.inner;
31532 if (ret_var.is_owned) {
31537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31539 arg_conv.inner = (void*)(arg & (~1));
31540 arg_conv.is_owned = false;
31541 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31542 int64_t ret_conv = Ping_clone_ptr(&arg_conv);
31546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31548 orig_conv.inner = (void*)(orig & (~1));
31549 orig_conv.is_owned = false;
31550 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31551 LDKPing ret_var = Ping_clone(&orig_conv);
31552 int64_t ret_ref = 0;
31553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31556 ret_ref = (uintptr_t)ret_var.inner;
31557 if (ret_var.is_owned) {
31563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31564 LDKPong this_obj_conv;
31565 this_obj_conv.inner = (void*)(this_obj & (~1));
31566 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31568 Pong_free(this_obj_conv);
31571 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31572 LDKPong this_ptr_conv;
31573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31574 this_ptr_conv.is_owned = false;
31575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31576 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
31580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31581 LDKPong this_ptr_conv;
31582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31583 this_ptr_conv.is_owned = false;
31584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31585 Pong_set_byteslen(&this_ptr_conv, val);
31588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
31589 LDKPong ret_var = Pong_new(byteslen_arg);
31590 int64_t ret_ref = 0;
31591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31594 ret_ref = (uintptr_t)ret_var.inner;
31595 if (ret_var.is_owned) {
31601 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
31602 LDKPong ret_var = Pong_clone(arg);
31603 int64_t ret_ref = 0;
31604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31607 ret_ref = (uintptr_t)ret_var.inner;
31608 if (ret_var.is_owned) {
31613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31615 arg_conv.inner = (void*)(arg & (~1));
31616 arg_conv.is_owned = false;
31617 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31618 int64_t ret_conv = Pong_clone_ptr(&arg_conv);
31622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31624 orig_conv.inner = (void*)(orig & (~1));
31625 orig_conv.is_owned = false;
31626 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31627 LDKPong ret_var = Pong_clone(&orig_conv);
31628 int64_t ret_ref = 0;
31629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31632 ret_ref = (uintptr_t)ret_var.inner;
31633 if (ret_var.is_owned) {
31639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31640 LDKOpenChannel this_obj_conv;
31641 this_obj_conv.inner = (void*)(this_obj & (~1));
31642 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31644 OpenChannel_free(this_obj_conv);
31647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31648 LDKOpenChannel this_ptr_conv;
31649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31650 this_ptr_conv.is_owned = false;
31651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31652 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
31657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31658 LDKOpenChannel this_ptr_conv;
31659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31660 this_ptr_conv.is_owned = false;
31661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31662 LDKThirtyTwoBytes val_ref;
31663 CHECK((*env)->GetArrayLength(env, val) == 32);
31664 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31665 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
31668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31669 LDKOpenChannel this_ptr_conv;
31670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31671 this_ptr_conv.is_owned = false;
31672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31673 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31674 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
31678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31679 LDKOpenChannel this_ptr_conv;
31680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31681 this_ptr_conv.is_owned = false;
31682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31683 LDKThirtyTwoBytes val_ref;
31684 CHECK((*env)->GetArrayLength(env, val) == 32);
31685 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31686 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31690 LDKOpenChannel this_ptr_conv;
31691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31692 this_ptr_conv.is_owned = false;
31693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31694 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
31698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31699 LDKOpenChannel this_ptr_conv;
31700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31701 this_ptr_conv.is_owned = false;
31702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31703 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
31706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31707 LDKOpenChannel this_ptr_conv;
31708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31709 this_ptr_conv.is_owned = false;
31710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31711 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
31715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31716 LDKOpenChannel this_ptr_conv;
31717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31718 this_ptr_conv.is_owned = false;
31719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31720 OpenChannel_set_push_msat(&this_ptr_conv, val);
31723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31724 LDKOpenChannel this_ptr_conv;
31725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31726 this_ptr_conv.is_owned = false;
31727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31728 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
31732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31733 LDKOpenChannel this_ptr_conv;
31734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31735 this_ptr_conv.is_owned = false;
31736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31740 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) {
31741 LDKOpenChannel this_ptr_conv;
31742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31743 this_ptr_conv.is_owned = false;
31744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31745 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31749 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) {
31750 LDKOpenChannel this_ptr_conv;
31751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31752 this_ptr_conv.is_owned = false;
31753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31754 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31758 LDKOpenChannel this_ptr_conv;
31759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31760 this_ptr_conv.is_owned = false;
31761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31762 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31767 LDKOpenChannel this_ptr_conv;
31768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31769 this_ptr_conv.is_owned = false;
31770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31771 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31775 LDKOpenChannel this_ptr_conv;
31776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31777 this_ptr_conv.is_owned = false;
31778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31779 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
31783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31784 LDKOpenChannel this_ptr_conv;
31785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31786 this_ptr_conv.is_owned = false;
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31788 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31791 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31792 LDKOpenChannel this_ptr_conv;
31793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31794 this_ptr_conv.is_owned = false;
31795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31796 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31801 LDKOpenChannel this_ptr_conv;
31802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31803 this_ptr_conv.is_owned = false;
31804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31805 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31808 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31809 LDKOpenChannel this_ptr_conv;
31810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31811 this_ptr_conv.is_owned = false;
31812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31813 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31818 LDKOpenChannel this_ptr_conv;
31819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31820 this_ptr_conv.is_owned = false;
31821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31822 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31825 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31826 LDKOpenChannel this_ptr_conv;
31827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31828 this_ptr_conv.is_owned = false;
31829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31830 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31835 LDKOpenChannel this_ptr_conv;
31836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31837 this_ptr_conv.is_owned = false;
31838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31839 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31843 LDKOpenChannel this_ptr_conv;
31844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31845 this_ptr_conv.is_owned = false;
31846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31847 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31853 LDKOpenChannel this_ptr_conv;
31854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31855 this_ptr_conv.is_owned = false;
31856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31857 LDKPublicKey val_ref;
31858 CHECK((*env)->GetArrayLength(env, val) == 33);
31859 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31860 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31864 LDKOpenChannel this_ptr_conv;
31865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31866 this_ptr_conv.is_owned = false;
31867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31869 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31874 LDKOpenChannel this_ptr_conv;
31875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31876 this_ptr_conv.is_owned = false;
31877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31878 LDKPublicKey val_ref;
31879 CHECK((*env)->GetArrayLength(env, val) == 33);
31880 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31881 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31885 LDKOpenChannel this_ptr_conv;
31886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31887 this_ptr_conv.is_owned = false;
31888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31889 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31890 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
31894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31895 LDKOpenChannel this_ptr_conv;
31896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31897 this_ptr_conv.is_owned = false;
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31899 LDKPublicKey val_ref;
31900 CHECK((*env)->GetArrayLength(env, val) == 33);
31901 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31902 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31906 LDKOpenChannel this_ptr_conv;
31907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31908 this_ptr_conv.is_owned = false;
31909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31910 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31916 LDKOpenChannel this_ptr_conv;
31917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31918 this_ptr_conv.is_owned = false;
31919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31920 LDKPublicKey val_ref;
31921 CHECK((*env)->GetArrayLength(env, val) == 33);
31922 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31923 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31927 LDKOpenChannel this_ptr_conv;
31928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31929 this_ptr_conv.is_owned = false;
31930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31931 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31937 LDKOpenChannel this_ptr_conv;
31938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31939 this_ptr_conv.is_owned = false;
31940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31941 LDKPublicKey val_ref;
31942 CHECK((*env)->GetArrayLength(env, val) == 33);
31943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31944 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31948 LDKOpenChannel this_ptr_conv;
31949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31950 this_ptr_conv.is_owned = false;
31951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31952 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31953 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31957 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) {
31958 LDKOpenChannel this_ptr_conv;
31959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31960 this_ptr_conv.is_owned = false;
31961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31962 LDKPublicKey val_ref;
31963 CHECK((*env)->GetArrayLength(env, val) == 33);
31964 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31965 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31968 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31969 LDKOpenChannel this_ptr_conv;
31970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31971 this_ptr_conv.is_owned = false;
31972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31973 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31978 LDKOpenChannel this_ptr_conv;
31979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31980 this_ptr_conv.is_owned = false;
31981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31982 OpenChannel_set_channel_flags(&this_ptr_conv, val);
31985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31986 LDKOpenChannel this_ptr_conv;
31987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31988 this_ptr_conv.is_owned = false;
31989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31990 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31991 int64_t ret_ref = 0;
31992 if ((uintptr_t)ret_var.inner > 4096) {
31993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31996 ret_ref = (uintptr_t)ret_var.inner;
31997 if (ret_var.is_owned) {
32004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32005 LDKOpenChannel this_ptr_conv;
32006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32007 this_ptr_conv.is_owned = false;
32008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32009 LDKChannelTypeFeatures val_conv;
32010 val_conv.inner = (void*)(val & (~1));
32011 val_conv.is_owned = (val & 1) || (val == 0);
32012 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32013 val_conv = ChannelTypeFeatures_clone(&val_conv);
32014 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
32017 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
32018 LDKOpenChannel ret_var = OpenChannel_clone(arg);
32019 int64_t ret_ref = 0;
32020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32023 ret_ref = (uintptr_t)ret_var.inner;
32024 if (ret_var.is_owned) {
32029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32030 LDKOpenChannel arg_conv;
32031 arg_conv.inner = (void*)(arg & (~1));
32032 arg_conv.is_owned = false;
32033 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32034 int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
32038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32039 LDKOpenChannel orig_conv;
32040 orig_conv.inner = (void*)(orig & (~1));
32041 orig_conv.is_owned = false;
32042 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32043 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
32044 int64_t ret_ref = 0;
32045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32048 ret_ref = (uintptr_t)ret_var.inner;
32049 if (ret_var.is_owned) {
32055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32056 LDKAcceptChannel this_obj_conv;
32057 this_obj_conv.inner = (void*)(this_obj & (~1));
32058 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32060 AcceptChannel_free(this_obj_conv);
32063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32064 LDKAcceptChannel this_ptr_conv;
32065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32066 this_ptr_conv.is_owned = false;
32067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32068 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32069 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
32073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32074 LDKAcceptChannel this_ptr_conv;
32075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32076 this_ptr_conv.is_owned = false;
32077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32078 LDKThirtyTwoBytes val_ref;
32079 CHECK((*env)->GetArrayLength(env, val) == 32);
32080 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32081 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32085 LDKAcceptChannel this_ptr_conv;
32086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32087 this_ptr_conv.is_owned = false;
32088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32089 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
32093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32094 LDKAcceptChannel this_ptr_conv;
32095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32096 this_ptr_conv.is_owned = false;
32097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32098 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32101 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) {
32102 LDKAcceptChannel this_ptr_conv;
32103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32104 this_ptr_conv.is_owned = false;
32105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32106 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32110 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) {
32111 LDKAcceptChannel this_ptr_conv;
32112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32113 this_ptr_conv.is_owned = false;
32114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32115 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32119 LDKAcceptChannel this_ptr_conv;
32120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32121 this_ptr_conv.is_owned = false;
32122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32123 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32128 LDKAcceptChannel this_ptr_conv;
32129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32130 this_ptr_conv.is_owned = false;
32131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32132 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32136 LDKAcceptChannel this_ptr_conv;
32137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32138 this_ptr_conv.is_owned = false;
32139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32140 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
32144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32145 LDKAcceptChannel this_ptr_conv;
32146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32147 this_ptr_conv.is_owned = false;
32148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32149 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32152 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
32153 LDKAcceptChannel this_ptr_conv;
32154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32155 this_ptr_conv.is_owned = false;
32156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32157 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
32161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32162 LDKAcceptChannel this_ptr_conv;
32163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32164 this_ptr_conv.is_owned = false;
32165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32166 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
32169 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32170 LDKAcceptChannel this_ptr_conv;
32171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32172 this_ptr_conv.is_owned = false;
32173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32174 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
32178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32179 LDKAcceptChannel this_ptr_conv;
32180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32181 this_ptr_conv.is_owned = false;
32182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32183 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
32186 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32187 LDKAcceptChannel 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 = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
32195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32196 LDKAcceptChannel 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 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32204 LDKAcceptChannel 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32214 LDKAcceptChannel this_ptr_conv;
32215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32216 this_ptr_conv.is_owned = false;
32217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32218 LDKPublicKey val_ref;
32219 CHECK((*env)->GetArrayLength(env, val) == 33);
32220 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32221 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
32224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32225 LDKAcceptChannel this_ptr_conv;
32226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32227 this_ptr_conv.is_owned = false;
32228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32229 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32230 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32235 LDKAcceptChannel this_ptr_conv;
32236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32237 this_ptr_conv.is_owned = false;
32238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239 LDKPublicKey val_ref;
32240 CHECK((*env)->GetArrayLength(env, val) == 33);
32241 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32242 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
32245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32246 LDKAcceptChannel this_ptr_conv;
32247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32248 this_ptr_conv.is_owned = false;
32249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32250 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32251 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
32255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32256 LDKAcceptChannel this_ptr_conv;
32257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32258 this_ptr_conv.is_owned = false;
32259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32260 LDKPublicKey val_ref;
32261 CHECK((*env)->GetArrayLength(env, val) == 33);
32262 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32263 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
32266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32267 LDKAcceptChannel this_ptr_conv;
32268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32269 this_ptr_conv.is_owned = false;
32270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32271 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32272 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32277 LDKAcceptChannel this_ptr_conv;
32278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32279 this_ptr_conv.is_owned = false;
32280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32281 LDKPublicKey val_ref;
32282 CHECK((*env)->GetArrayLength(env, val) == 33);
32283 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32284 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32288 LDKAcceptChannel this_ptr_conv;
32289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32290 this_ptr_conv.is_owned = false;
32291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32292 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
32297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32298 LDKAcceptChannel this_ptr_conv;
32299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32300 this_ptr_conv.is_owned = false;
32301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32302 LDKPublicKey val_ref;
32303 CHECK((*env)->GetArrayLength(env, val) == 33);
32304 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32305 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
32308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32309 LDKAcceptChannel this_ptr_conv;
32310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32311 this_ptr_conv.is_owned = false;
32312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32313 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
32318 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) {
32319 LDKAcceptChannel this_ptr_conv;
32320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32321 this_ptr_conv.is_owned = false;
32322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32323 LDKPublicKey val_ref;
32324 CHECK((*env)->GetArrayLength(env, val) == 33);
32325 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32326 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
32329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
32330 LDKAcceptChannel this_ptr_conv;
32331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32332 this_ptr_conv.is_owned = false;
32333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
32335 int64_t ret_ref = 0;
32336 if ((uintptr_t)ret_var.inner > 4096) {
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) {
32348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32349 LDKAcceptChannel this_ptr_conv;
32350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32351 this_ptr_conv.is_owned = false;
32352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32353 LDKChannelTypeFeatures val_conv;
32354 val_conv.inner = (void*)(val & (~1));
32355 val_conv.is_owned = (val & 1) || (val == 0);
32356 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32357 val_conv = ChannelTypeFeatures_clone(&val_conv);
32358 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
32361 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
32362 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
32363 int64_t ret_ref = 0;
32364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32367 ret_ref = (uintptr_t)ret_var.inner;
32368 if (ret_var.is_owned) {
32373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32374 LDKAcceptChannel arg_conv;
32375 arg_conv.inner = (void*)(arg & (~1));
32376 arg_conv.is_owned = false;
32377 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32378 int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
32382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32383 LDKAcceptChannel orig_conv;
32384 orig_conv.inner = (void*)(orig & (~1));
32385 orig_conv.is_owned = false;
32386 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32387 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
32388 int64_t ret_ref = 0;
32389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32392 ret_ref = (uintptr_t)ret_var.inner;
32393 if (ret_var.is_owned) {
32399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32400 LDKFundingCreated this_obj_conv;
32401 this_obj_conv.inner = (void*)(this_obj & (~1));
32402 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32404 FundingCreated_free(this_obj_conv);
32407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32408 LDKFundingCreated this_ptr_conv;
32409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32410 this_ptr_conv.is_owned = false;
32411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32412 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32413 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
32417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32418 LDKFundingCreated this_ptr_conv;
32419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32420 this_ptr_conv.is_owned = false;
32421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32422 LDKThirtyTwoBytes val_ref;
32423 CHECK((*env)->GetArrayLength(env, val) == 32);
32424 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32425 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
32428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
32429 LDKFundingCreated this_ptr_conv;
32430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32431 this_ptr_conv.is_owned = false;
32432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32433 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
32438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32439 LDKFundingCreated this_ptr_conv;
32440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32441 this_ptr_conv.is_owned = false;
32442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32443 LDKThirtyTwoBytes val_ref;
32444 CHECK((*env)->GetArrayLength(env, val) == 32);
32445 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32446 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
32449 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
32450 LDKFundingCreated this_ptr_conv;
32451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32452 this_ptr_conv.is_owned = false;
32453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32454 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
32458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32459 LDKFundingCreated this_ptr_conv;
32460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32461 this_ptr_conv.is_owned = false;
32462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32463 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
32466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32467 LDKFundingCreated this_ptr_conv;
32468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32469 this_ptr_conv.is_owned = false;
32470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32471 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32472 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
32476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32477 LDKFundingCreated this_ptr_conv;
32478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32479 this_ptr_conv.is_owned = false;
32480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32481 LDKSignature val_ref;
32482 CHECK((*env)->GetArrayLength(env, val) == 64);
32483 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32484 FundingCreated_set_signature(&this_ptr_conv, val_ref);
32487 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) {
32488 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
32489 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
32490 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
32491 LDKThirtyTwoBytes funding_txid_arg_ref;
32492 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
32493 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
32494 LDKSignature signature_arg_ref;
32495 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32496 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32497 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
32498 int64_t ret_ref = 0;
32499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32502 ret_ref = (uintptr_t)ret_var.inner;
32503 if (ret_var.is_owned) {
32509 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
32510 LDKFundingCreated ret_var = FundingCreated_clone(arg);
32511 int64_t ret_ref = 0;
32512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32515 ret_ref = (uintptr_t)ret_var.inner;
32516 if (ret_var.is_owned) {
32521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32522 LDKFundingCreated arg_conv;
32523 arg_conv.inner = (void*)(arg & (~1));
32524 arg_conv.is_owned = false;
32525 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32526 int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
32530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32531 LDKFundingCreated orig_conv;
32532 orig_conv.inner = (void*)(orig & (~1));
32533 orig_conv.is_owned = false;
32534 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32535 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
32536 int64_t ret_ref = 0;
32537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32540 ret_ref = (uintptr_t)ret_var.inner;
32541 if (ret_var.is_owned) {
32547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32548 LDKFundingSigned this_obj_conv;
32549 this_obj_conv.inner = (void*)(this_obj & (~1));
32550 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32552 FundingSigned_free(this_obj_conv);
32555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32556 LDKFundingSigned this_ptr_conv;
32557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32558 this_ptr_conv.is_owned = false;
32559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32560 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32561 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
32565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32566 LDKFundingSigned this_ptr_conv;
32567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32568 this_ptr_conv.is_owned = false;
32569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32570 LDKThirtyTwoBytes val_ref;
32571 CHECK((*env)->GetArrayLength(env, val) == 32);
32572 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32573 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
32576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32577 LDKFundingSigned this_ptr_conv;
32578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32579 this_ptr_conv.is_owned = false;
32580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32581 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32582 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
32586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32587 LDKFundingSigned this_ptr_conv;
32588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32589 this_ptr_conv.is_owned = false;
32590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32591 LDKSignature val_ref;
32592 CHECK((*env)->GetArrayLength(env, val) == 64);
32593 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32594 FundingSigned_set_signature(&this_ptr_conv, val_ref);
32597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
32598 LDKThirtyTwoBytes channel_id_arg_ref;
32599 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32600 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32601 LDKSignature signature_arg_ref;
32602 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32603 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32604 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
32605 int64_t ret_ref = 0;
32606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32609 ret_ref = (uintptr_t)ret_var.inner;
32610 if (ret_var.is_owned) {
32616 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
32617 LDKFundingSigned ret_var = FundingSigned_clone(arg);
32618 int64_t ret_ref = 0;
32619 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32620 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32622 ret_ref = (uintptr_t)ret_var.inner;
32623 if (ret_var.is_owned) {
32628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32629 LDKFundingSigned arg_conv;
32630 arg_conv.inner = (void*)(arg & (~1));
32631 arg_conv.is_owned = false;
32632 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32633 int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
32637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32638 LDKFundingSigned orig_conv;
32639 orig_conv.inner = (void*)(orig & (~1));
32640 orig_conv.is_owned = false;
32641 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32642 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
32643 int64_t ret_ref = 0;
32644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32647 ret_ref = (uintptr_t)ret_var.inner;
32648 if (ret_var.is_owned) {
32654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32655 LDKChannelReady this_obj_conv;
32656 this_obj_conv.inner = (void*)(this_obj & (~1));
32657 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32659 ChannelReady_free(this_obj_conv);
32662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32663 LDKChannelReady this_ptr_conv;
32664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32665 this_ptr_conv.is_owned = false;
32666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32667 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32668 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
32672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32673 LDKChannelReady this_ptr_conv;
32674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32675 this_ptr_conv.is_owned = false;
32676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32677 LDKThirtyTwoBytes val_ref;
32678 CHECK((*env)->GetArrayLength(env, val) == 32);
32679 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32680 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
32683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32684 LDKChannelReady this_ptr_conv;
32685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32686 this_ptr_conv.is_owned = false;
32687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32688 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32689 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32693 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) {
32694 LDKChannelReady 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 LDKPublicKey val_ref;
32699 CHECK((*env)->GetArrayLength(env, val) == 33);
32700 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32701 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32705 LDKChannelReady this_ptr_conv;
32706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32707 this_ptr_conv.is_owned = false;
32708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32709 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32710 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
32711 int64_t ret_ref = (uintptr_t)ret_copy;
32715 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) {
32716 LDKChannelReady this_ptr_conv;
32717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32718 this_ptr_conv.is_owned = false;
32719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32720 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32721 CHECK_ACCESS(val_ptr);
32722 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32723 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
32724 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32727 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) {
32728 LDKThirtyTwoBytes channel_id_arg_ref;
32729 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32730 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32731 LDKPublicKey next_per_commitment_point_arg_ref;
32732 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32733 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32734 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
32735 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32736 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32737 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
32738 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32739 int64_t ret_ref = 0;
32740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32743 ret_ref = (uintptr_t)ret_var.inner;
32744 if (ret_var.is_owned) {
32750 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32751 LDKChannelReady ret_var = ChannelReady_clone(arg);
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) {
32762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32763 LDKChannelReady arg_conv;
32764 arg_conv.inner = (void*)(arg & (~1));
32765 arg_conv.is_owned = false;
32766 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32767 int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32772 LDKChannelReady orig_conv;
32773 orig_conv.inner = (void*)(orig & (~1));
32774 orig_conv.is_owned = false;
32775 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32776 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32777 int64_t ret_ref = 0;
32778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32781 ret_ref = (uintptr_t)ret_var.inner;
32782 if (ret_var.is_owned) {
32788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32789 LDKShutdown this_obj_conv;
32790 this_obj_conv.inner = (void*)(this_obj & (~1));
32791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32793 Shutdown_free(this_obj_conv);
32796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32797 LDKShutdown this_ptr_conv;
32798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32799 this_ptr_conv.is_owned = false;
32800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32801 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32802 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
32806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32807 LDKShutdown this_ptr_conv;
32808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32809 this_ptr_conv.is_owned = false;
32810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32811 LDKThirtyTwoBytes val_ref;
32812 CHECK((*env)->GetArrayLength(env, val) == 32);
32813 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32814 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32818 LDKShutdown this_ptr_conv;
32819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32820 this_ptr_conv.is_owned = false;
32821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32822 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32823 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32824 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32829 LDKShutdown this_ptr_conv;
32830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32831 this_ptr_conv.is_owned = false;
32832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32833 LDKCVec_u8Z val_ref;
32834 val_ref.datalen = (*env)->GetArrayLength(env, val);
32835 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32836 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
32837 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32841 LDKThirtyTwoBytes channel_id_arg_ref;
32842 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32843 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32844 LDKCVec_u8Z scriptpubkey_arg_ref;
32845 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
32846 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32847 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
32848 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32849 int64_t ret_ref = 0;
32850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32853 ret_ref = (uintptr_t)ret_var.inner;
32854 if (ret_var.is_owned) {
32860 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32861 LDKShutdown ret_var = Shutdown_clone(arg);
32862 int64_t ret_ref = 0;
32863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32866 ret_ref = (uintptr_t)ret_var.inner;
32867 if (ret_var.is_owned) {
32872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32873 LDKShutdown arg_conv;
32874 arg_conv.inner = (void*)(arg & (~1));
32875 arg_conv.is_owned = false;
32876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32877 int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32882 LDKShutdown orig_conv;
32883 orig_conv.inner = (void*)(orig & (~1));
32884 orig_conv.is_owned = false;
32885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32886 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32887 int64_t ret_ref = 0;
32888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32891 ret_ref = (uintptr_t)ret_var.inner;
32892 if (ret_var.is_owned) {
32898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32899 LDKClosingSignedFeeRange this_obj_conv;
32900 this_obj_conv.inner = (void*)(this_obj & (~1));
32901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32903 ClosingSignedFeeRange_free(this_obj_conv);
32906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32907 LDKClosingSignedFeeRange this_ptr_conv;
32908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32909 this_ptr_conv.is_owned = false;
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32911 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32916 LDKClosingSignedFeeRange this_ptr_conv;
32917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32918 this_ptr_conv.is_owned = false;
32919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32920 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32924 LDKClosingSignedFeeRange this_ptr_conv;
32925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32926 this_ptr_conv.is_owned = false;
32927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32928 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32933 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32940 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) {
32941 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32942 int64_t ret_ref = 0;
32943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32946 ret_ref = (uintptr_t)ret_var.inner;
32947 if (ret_var.is_owned) {
32953 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32954 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32955 int64_t ret_ref = 0;
32956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32959 ret_ref = (uintptr_t)ret_var.inner;
32960 if (ret_var.is_owned) {
32965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32966 LDKClosingSignedFeeRange arg_conv;
32967 arg_conv.inner = (void*)(arg & (~1));
32968 arg_conv.is_owned = false;
32969 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32970 int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32975 LDKClosingSignedFeeRange orig_conv;
32976 orig_conv.inner = (void*)(orig & (~1));
32977 orig_conv.is_owned = false;
32978 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32979 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32980 int64_t ret_ref = 0;
32981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32984 ret_ref = (uintptr_t)ret_var.inner;
32985 if (ret_var.is_owned) {
32991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32992 LDKClosingSigned this_obj_conv;
32993 this_obj_conv.inner = (void*)(this_obj & (~1));
32994 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32996 ClosingSigned_free(this_obj_conv);
32999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33000 LDKClosingSigned this_ptr_conv;
33001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33002 this_ptr_conv.is_owned = false;
33003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33004 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33005 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
33009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33010 LDKClosingSigned this_ptr_conv;
33011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33012 this_ptr_conv.is_owned = false;
33013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33014 LDKThirtyTwoBytes val_ref;
33015 CHECK((*env)->GetArrayLength(env, val) == 32);
33016 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33017 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
33020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33021 LDKClosingSigned this_ptr_conv;
33022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33023 this_ptr_conv.is_owned = false;
33024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33025 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
33029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33030 LDKClosingSigned this_ptr_conv;
33031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33032 this_ptr_conv.is_owned = false;
33033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33034 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
33037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33038 LDKClosingSigned 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33043 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
33047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33048 LDKClosingSigned this_ptr_conv;
33049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33050 this_ptr_conv.is_owned = false;
33051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33052 LDKSignature val_ref;
33053 CHECK((*env)->GetArrayLength(env, val) == 64);
33054 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33055 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
33058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
33059 LDKClosingSigned this_ptr_conv;
33060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33061 this_ptr_conv.is_owned = false;
33062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33063 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
33064 int64_t ret_ref = 0;
33065 if ((uintptr_t)ret_var.inner > 4096) {
33066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33069 ret_ref = (uintptr_t)ret_var.inner;
33070 if (ret_var.is_owned) {
33077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33078 LDKClosingSigned this_ptr_conv;
33079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33080 this_ptr_conv.is_owned = false;
33081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33082 LDKClosingSignedFeeRange val_conv;
33083 val_conv.inner = (void*)(val & (~1));
33084 val_conv.is_owned = (val & 1) || (val == 0);
33085 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33086 val_conv = ClosingSignedFeeRange_clone(&val_conv);
33087 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
33090 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) {
33091 LDKThirtyTwoBytes channel_id_arg_ref;
33092 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33093 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33094 LDKSignature signature_arg_ref;
33095 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33096 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33097 LDKClosingSignedFeeRange fee_range_arg_conv;
33098 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
33099 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
33100 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
33101 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
33102 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
33103 int64_t ret_ref = 0;
33104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33107 ret_ref = (uintptr_t)ret_var.inner;
33108 if (ret_var.is_owned) {
33114 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
33115 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
33116 int64_t ret_ref = 0;
33117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33120 ret_ref = (uintptr_t)ret_var.inner;
33121 if (ret_var.is_owned) {
33126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33127 LDKClosingSigned arg_conv;
33128 arg_conv.inner = (void*)(arg & (~1));
33129 arg_conv.is_owned = false;
33130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33131 int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
33135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33136 LDKClosingSigned orig_conv;
33137 orig_conv.inner = (void*)(orig & (~1));
33138 orig_conv.is_owned = false;
33139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33140 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
33141 int64_t ret_ref = 0;
33142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33145 ret_ref = (uintptr_t)ret_var.inner;
33146 if (ret_var.is_owned) {
33152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33153 LDKUpdateAddHTLC this_obj_conv;
33154 this_obj_conv.inner = (void*)(this_obj & (~1));
33155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33157 UpdateAddHTLC_free(this_obj_conv);
33160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33161 LDKUpdateAddHTLC this_ptr_conv;
33162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33163 this_ptr_conv.is_owned = false;
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33165 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
33170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33171 LDKUpdateAddHTLC this_ptr_conv;
33172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33173 this_ptr_conv.is_owned = false;
33174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33175 LDKThirtyTwoBytes val_ref;
33176 CHECK((*env)->GetArrayLength(env, val) == 32);
33177 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33178 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
33181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33182 LDKUpdateAddHTLC this_ptr_conv;
33183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33184 this_ptr_conv.is_owned = false;
33185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33186 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
33190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33191 LDKUpdateAddHTLC this_ptr_conv;
33192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33193 this_ptr_conv.is_owned = false;
33194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33195 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
33198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33199 LDKUpdateAddHTLC this_ptr_conv;
33200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33201 this_ptr_conv.is_owned = false;
33202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33203 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
33207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33208 LDKUpdateAddHTLC this_ptr_conv;
33209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33210 this_ptr_conv.is_owned = false;
33211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33212 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
33215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33216 LDKUpdateAddHTLC this_ptr_conv;
33217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33218 this_ptr_conv.is_owned = false;
33219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33220 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
33225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33226 LDKUpdateAddHTLC this_ptr_conv;
33227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33228 this_ptr_conv.is_owned = false;
33229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33230 LDKThirtyTwoBytes val_ref;
33231 CHECK((*env)->GetArrayLength(env, val) == 32);
33232 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33233 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
33236 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
33237 LDKUpdateAddHTLC this_ptr_conv;
33238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33239 this_ptr_conv.is_owned = false;
33240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33241 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
33245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33246 LDKUpdateAddHTLC this_ptr_conv;
33247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33248 this_ptr_conv.is_owned = false;
33249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33250 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
33253 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
33254 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
33255 int64_t ret_ref = 0;
33256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33259 ret_ref = (uintptr_t)ret_var.inner;
33260 if (ret_var.is_owned) {
33265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33266 LDKUpdateAddHTLC arg_conv;
33267 arg_conv.inner = (void*)(arg & (~1));
33268 arg_conv.is_owned = false;
33269 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33270 int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
33274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33275 LDKUpdateAddHTLC orig_conv;
33276 orig_conv.inner = (void*)(orig & (~1));
33277 orig_conv.is_owned = false;
33278 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33279 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
33280 int64_t ret_ref = 0;
33281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33284 ret_ref = (uintptr_t)ret_var.inner;
33285 if (ret_var.is_owned) {
33291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33292 LDKUpdateFulfillHTLC this_obj_conv;
33293 this_obj_conv.inner = (void*)(this_obj & (~1));
33294 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33296 UpdateFulfillHTLC_free(this_obj_conv);
33299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33300 LDKUpdateFulfillHTLC this_ptr_conv;
33301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33302 this_ptr_conv.is_owned = false;
33303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33304 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33305 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
33309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33310 LDKUpdateFulfillHTLC this_ptr_conv;
33311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33312 this_ptr_conv.is_owned = false;
33313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33314 LDKThirtyTwoBytes val_ref;
33315 CHECK((*env)->GetArrayLength(env, val) == 32);
33316 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33317 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
33320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33321 LDKUpdateFulfillHTLC this_ptr_conv;
33322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33323 this_ptr_conv.is_owned = false;
33324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33325 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
33329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33330 LDKUpdateFulfillHTLC this_ptr_conv;
33331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33332 this_ptr_conv.is_owned = false;
33333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33334 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
33337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
33338 LDKUpdateFulfillHTLC this_ptr_conv;
33339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33340 this_ptr_conv.is_owned = false;
33341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33342 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
33347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33348 LDKUpdateFulfillHTLC this_ptr_conv;
33349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33350 this_ptr_conv.is_owned = false;
33351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33352 LDKThirtyTwoBytes val_ref;
33353 CHECK((*env)->GetArrayLength(env, val) == 32);
33354 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33355 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
33358 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) {
33359 LDKThirtyTwoBytes channel_id_arg_ref;
33360 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33361 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33362 LDKThirtyTwoBytes payment_preimage_arg_ref;
33363 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
33364 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
33365 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
33366 int64_t ret_ref = 0;
33367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33370 ret_ref = (uintptr_t)ret_var.inner;
33371 if (ret_var.is_owned) {
33377 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
33378 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
33379 int64_t ret_ref = 0;
33380 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33381 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33383 ret_ref = (uintptr_t)ret_var.inner;
33384 if (ret_var.is_owned) {
33389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33390 LDKUpdateFulfillHTLC arg_conv;
33391 arg_conv.inner = (void*)(arg & (~1));
33392 arg_conv.is_owned = false;
33393 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33394 int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
33398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33399 LDKUpdateFulfillHTLC orig_conv;
33400 orig_conv.inner = (void*)(orig & (~1));
33401 orig_conv.is_owned = false;
33402 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33403 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
33404 int64_t ret_ref = 0;
33405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33408 ret_ref = (uintptr_t)ret_var.inner;
33409 if (ret_var.is_owned) {
33415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33416 LDKUpdateFailHTLC this_obj_conv;
33417 this_obj_conv.inner = (void*)(this_obj & (~1));
33418 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33420 UpdateFailHTLC_free(this_obj_conv);
33423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33424 LDKUpdateFailHTLC 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33429 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
33433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33434 LDKUpdateFailHTLC this_ptr_conv;
33435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33436 this_ptr_conv.is_owned = false;
33437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33438 LDKThirtyTwoBytes val_ref;
33439 CHECK((*env)->GetArrayLength(env, val) == 32);
33440 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33441 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
33444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33445 LDKUpdateFailHTLC this_ptr_conv;
33446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33447 this_ptr_conv.is_owned = false;
33448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33449 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
33453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33454 LDKUpdateFailHTLC this_ptr_conv;
33455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33456 this_ptr_conv.is_owned = false;
33457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33458 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
33461 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
33462 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
33463 int64_t ret_ref = 0;
33464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33467 ret_ref = (uintptr_t)ret_var.inner;
33468 if (ret_var.is_owned) {
33473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33474 LDKUpdateFailHTLC arg_conv;
33475 arg_conv.inner = (void*)(arg & (~1));
33476 arg_conv.is_owned = false;
33477 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33478 int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
33482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33483 LDKUpdateFailHTLC orig_conv;
33484 orig_conv.inner = (void*)(orig & (~1));
33485 orig_conv.is_owned = false;
33486 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33487 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
33488 int64_t ret_ref = 0;
33489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33492 ret_ref = (uintptr_t)ret_var.inner;
33493 if (ret_var.is_owned) {
33499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33500 LDKUpdateFailMalformedHTLC this_obj_conv;
33501 this_obj_conv.inner = (void*)(this_obj & (~1));
33502 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33504 UpdateFailMalformedHTLC_free(this_obj_conv);
33507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33508 LDKUpdateFailMalformedHTLC this_ptr_conv;
33509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33510 this_ptr_conv.is_owned = false;
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33513 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
33517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33518 LDKUpdateFailMalformedHTLC this_ptr_conv;
33519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33520 this_ptr_conv.is_owned = false;
33521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33522 LDKThirtyTwoBytes val_ref;
33523 CHECK((*env)->GetArrayLength(env, val) == 32);
33524 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33525 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
33528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33529 LDKUpdateFailMalformedHTLC this_ptr_conv;
33530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33531 this_ptr_conv.is_owned = false;
33532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33533 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
33537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33538 LDKUpdateFailMalformedHTLC this_ptr_conv;
33539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33540 this_ptr_conv.is_owned = false;
33541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33542 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
33545 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
33546 LDKUpdateFailMalformedHTLC this_ptr_conv;
33547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33548 this_ptr_conv.is_owned = false;
33549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33550 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
33554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33555 LDKUpdateFailMalformedHTLC this_ptr_conv;
33556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33557 this_ptr_conv.is_owned = false;
33558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33559 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
33562 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
33563 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
33564 int64_t ret_ref = 0;
33565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33568 ret_ref = (uintptr_t)ret_var.inner;
33569 if (ret_var.is_owned) {
33574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33575 LDKUpdateFailMalformedHTLC arg_conv;
33576 arg_conv.inner = (void*)(arg & (~1));
33577 arg_conv.is_owned = false;
33578 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33579 int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
33583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33584 LDKUpdateFailMalformedHTLC orig_conv;
33585 orig_conv.inner = (void*)(orig & (~1));
33586 orig_conv.is_owned = false;
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33588 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
33589 int64_t ret_ref = 0;
33590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33593 ret_ref = (uintptr_t)ret_var.inner;
33594 if (ret_var.is_owned) {
33600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33601 LDKCommitmentSigned this_obj_conv;
33602 this_obj_conv.inner = (void*)(this_obj & (~1));
33603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33605 CommitmentSigned_free(this_obj_conv);
33608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33609 LDKCommitmentSigned this_ptr_conv;
33610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33611 this_ptr_conv.is_owned = false;
33612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33614 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
33618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33619 LDKCommitmentSigned this_ptr_conv;
33620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33621 this_ptr_conv.is_owned = false;
33622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33623 LDKThirtyTwoBytes val_ref;
33624 CHECK((*env)->GetArrayLength(env, val) == 32);
33625 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33626 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33630 LDKCommitmentSigned this_ptr_conv;
33631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33632 this_ptr_conv.is_owned = false;
33633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33634 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33635 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
33639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33640 LDKCommitmentSigned this_ptr_conv;
33641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33642 this_ptr_conv.is_owned = false;
33643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33644 LDKSignature val_ref;
33645 CHECK((*env)->GetArrayLength(env, val) == 64);
33646 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33647 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
33651 LDKCommitmentSigned this_ptr_conv;
33652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33653 this_ptr_conv.is_owned = false;
33654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655 LDKCVec_SignatureZ val_constr;
33656 val_constr.datalen = (*env)->GetArrayLength(env, val);
33657 if (val_constr.datalen > 0)
33658 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33660 val_constr.data = NULL;
33661 for (size_t i = 0; i < val_constr.datalen; i++) {
33662 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
33663 LDKSignature val_conv_8_ref;
33664 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
33665 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
33666 val_constr.data[i] = val_conv_8_ref;
33668 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33671 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) {
33672 LDKThirtyTwoBytes channel_id_arg_ref;
33673 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33674 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33675 LDKSignature signature_arg_ref;
33676 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33677 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33678 LDKCVec_SignatureZ htlc_signatures_arg_constr;
33679 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
33680 if (htlc_signatures_arg_constr.datalen > 0)
33681 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33683 htlc_signatures_arg_constr.data = NULL;
33684 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
33685 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
33686 LDKSignature htlc_signatures_arg_conv_8_ref;
33687 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
33688 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
33689 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
33691 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33692 int64_t ret_ref = 0;
33693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33696 ret_ref = (uintptr_t)ret_var.inner;
33697 if (ret_var.is_owned) {
33703 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33704 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33705 int64_t ret_ref = 0;
33706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33709 ret_ref = (uintptr_t)ret_var.inner;
33710 if (ret_var.is_owned) {
33715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33716 LDKCommitmentSigned arg_conv;
33717 arg_conv.inner = (void*)(arg & (~1));
33718 arg_conv.is_owned = false;
33719 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33720 int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33725 LDKCommitmentSigned orig_conv;
33726 orig_conv.inner = (void*)(orig & (~1));
33727 orig_conv.is_owned = false;
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33729 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33730 int64_t ret_ref = 0;
33731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33734 ret_ref = (uintptr_t)ret_var.inner;
33735 if (ret_var.is_owned) {
33741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33742 LDKRevokeAndACK this_obj_conv;
33743 this_obj_conv.inner = (void*)(this_obj & (~1));
33744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33746 RevokeAndACK_free(this_obj_conv);
33749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33750 LDKRevokeAndACK this_ptr_conv;
33751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33752 this_ptr_conv.is_owned = false;
33753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
33759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33760 LDKRevokeAndACK this_ptr_conv;
33761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33762 this_ptr_conv.is_owned = false;
33763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33764 LDKThirtyTwoBytes val_ref;
33765 CHECK((*env)->GetArrayLength(env, val) == 32);
33766 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33767 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33771 LDKRevokeAndACK this_ptr_conv;
33772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33773 this_ptr_conv.is_owned = false;
33774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33775 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
33780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33781 LDKRevokeAndACK this_ptr_conv;
33782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33783 this_ptr_conv.is_owned = false;
33784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33785 LDKThirtyTwoBytes val_ref;
33786 CHECK((*env)->GetArrayLength(env, val) == 32);
33787 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33788 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33792 LDKRevokeAndACK this_ptr_conv;
33793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33794 this_ptr_conv.is_owned = false;
33795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33796 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33797 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33801 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) {
33802 LDKRevokeAndACK this_ptr_conv;
33803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33804 this_ptr_conv.is_owned = false;
33805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33806 LDKPublicKey val_ref;
33807 CHECK((*env)->GetArrayLength(env, val) == 33);
33808 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33809 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33812 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) {
33813 LDKThirtyTwoBytes channel_id_arg_ref;
33814 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33815 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33816 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33817 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
33818 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
33819 LDKPublicKey next_per_commitment_point_arg_ref;
33820 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33821 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33822 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33823 int64_t ret_ref = 0;
33824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33827 ret_ref = (uintptr_t)ret_var.inner;
33828 if (ret_var.is_owned) {
33834 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33835 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33836 int64_t ret_ref = 0;
33837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33840 ret_ref = (uintptr_t)ret_var.inner;
33841 if (ret_var.is_owned) {
33846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33847 LDKRevokeAndACK arg_conv;
33848 arg_conv.inner = (void*)(arg & (~1));
33849 arg_conv.is_owned = false;
33850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33851 int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33856 LDKRevokeAndACK orig_conv;
33857 orig_conv.inner = (void*)(orig & (~1));
33858 orig_conv.is_owned = false;
33859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33860 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33861 int64_t ret_ref = 0;
33862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33865 ret_ref = (uintptr_t)ret_var.inner;
33866 if (ret_var.is_owned) {
33872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33873 LDKUpdateFee this_obj_conv;
33874 this_obj_conv.inner = (void*)(this_obj & (~1));
33875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33877 UpdateFee_free(this_obj_conv);
33880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33881 LDKUpdateFee this_ptr_conv;
33882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33883 this_ptr_conv.is_owned = false;
33884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33885 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33886 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
33890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33891 LDKUpdateFee this_ptr_conv;
33892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33893 this_ptr_conv.is_owned = false;
33894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33895 LDKThirtyTwoBytes val_ref;
33896 CHECK((*env)->GetArrayLength(env, val) == 32);
33897 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33898 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33901 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
33902 LDKUpdateFee this_ptr_conv;
33903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33904 this_ptr_conv.is_owned = false;
33905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33906 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33911 LDKUpdateFee this_ptr_conv;
33912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33913 this_ptr_conv.is_owned = false;
33914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33915 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33918 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) {
33919 LDKThirtyTwoBytes channel_id_arg_ref;
33920 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33921 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33922 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33923 int64_t ret_ref = 0;
33924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33927 ret_ref = (uintptr_t)ret_var.inner;
33928 if (ret_var.is_owned) {
33934 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33935 LDKUpdateFee ret_var = UpdateFee_clone(arg);
33936 int64_t ret_ref = 0;
33937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33940 ret_ref = (uintptr_t)ret_var.inner;
33941 if (ret_var.is_owned) {
33946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33947 LDKUpdateFee arg_conv;
33948 arg_conv.inner = (void*)(arg & (~1));
33949 arg_conv.is_owned = false;
33950 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33951 int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33956 LDKUpdateFee orig_conv;
33957 orig_conv.inner = (void*)(orig & (~1));
33958 orig_conv.is_owned = false;
33959 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33960 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33961 int64_t ret_ref = 0;
33962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33965 ret_ref = (uintptr_t)ret_var.inner;
33966 if (ret_var.is_owned) {
33972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33973 LDKDataLossProtect this_obj_conv;
33974 this_obj_conv.inner = (void*)(this_obj & (~1));
33975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33977 DataLossProtect_free(this_obj_conv);
33980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33981 LDKDataLossProtect this_ptr_conv;
33982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33983 this_ptr_conv.is_owned = false;
33984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33985 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33986 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
33990 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) {
33991 LDKDataLossProtect this_ptr_conv;
33992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33993 this_ptr_conv.is_owned = false;
33994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33995 LDKThirtyTwoBytes val_ref;
33996 CHECK((*env)->GetArrayLength(env, val) == 32);
33997 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33998 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
34001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34002 LDKDataLossProtect this_ptr_conv;
34003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34004 this_ptr_conv.is_owned = false;
34005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34006 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34007 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
34011 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) {
34012 LDKDataLossProtect this_ptr_conv;
34013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34014 this_ptr_conv.is_owned = false;
34015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34016 LDKPublicKey val_ref;
34017 CHECK((*env)->GetArrayLength(env, val) == 33);
34018 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34019 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
34022 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) {
34023 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
34024 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
34025 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
34026 LDKPublicKey my_current_per_commitment_point_arg_ref;
34027 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
34028 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
34029 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
34030 int64_t ret_ref = 0;
34031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34034 ret_ref = (uintptr_t)ret_var.inner;
34035 if (ret_var.is_owned) {
34041 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
34042 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
34043 int64_t ret_ref = 0;
34044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34047 ret_ref = (uintptr_t)ret_var.inner;
34048 if (ret_var.is_owned) {
34053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34054 LDKDataLossProtect arg_conv;
34055 arg_conv.inner = (void*)(arg & (~1));
34056 arg_conv.is_owned = false;
34057 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34058 int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
34062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34063 LDKDataLossProtect orig_conv;
34064 orig_conv.inner = (void*)(orig & (~1));
34065 orig_conv.is_owned = false;
34066 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34067 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
34068 int64_t ret_ref = 0;
34069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34072 ret_ref = (uintptr_t)ret_var.inner;
34073 if (ret_var.is_owned) {
34079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34080 LDKChannelReestablish this_obj_conv;
34081 this_obj_conv.inner = (void*)(this_obj & (~1));
34082 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34084 ChannelReestablish_free(this_obj_conv);
34087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34088 LDKChannelReestablish this_ptr_conv;
34089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34090 this_ptr_conv.is_owned = false;
34091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34092 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34093 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
34097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34098 LDKChannelReestablish this_ptr_conv;
34099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34100 this_ptr_conv.is_owned = false;
34101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34102 LDKThirtyTwoBytes val_ref;
34103 CHECK((*env)->GetArrayLength(env, val) == 32);
34104 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34105 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
34108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34109 LDKChannelReestablish this_ptr_conv;
34110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34111 this_ptr_conv.is_owned = false;
34112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34113 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
34117 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) {
34118 LDKChannelReestablish this_ptr_conv;
34119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34120 this_ptr_conv.is_owned = false;
34121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34122 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
34125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34126 LDKChannelReestablish this_ptr_conv;
34127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34128 this_ptr_conv.is_owned = false;
34129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
34134 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) {
34135 LDKChannelReestablish this_ptr_conv;
34136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34137 this_ptr_conv.is_owned = false;
34138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34139 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
34142 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
34143 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
34144 int64_t ret_ref = 0;
34145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34148 ret_ref = (uintptr_t)ret_var.inner;
34149 if (ret_var.is_owned) {
34154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34155 LDKChannelReestablish arg_conv;
34156 arg_conv.inner = (void*)(arg & (~1));
34157 arg_conv.is_owned = false;
34158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34159 int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
34163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34164 LDKChannelReestablish orig_conv;
34165 orig_conv.inner = (void*)(orig & (~1));
34166 orig_conv.is_owned = false;
34167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34168 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
34169 int64_t ret_ref = 0;
34170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34173 ret_ref = (uintptr_t)ret_var.inner;
34174 if (ret_var.is_owned) {
34180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34181 LDKAnnouncementSignatures this_obj_conv;
34182 this_obj_conv.inner = (void*)(this_obj & (~1));
34183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34185 AnnouncementSignatures_free(this_obj_conv);
34188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34189 LDKAnnouncementSignatures this_ptr_conv;
34190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34191 this_ptr_conv.is_owned = false;
34192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34193 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
34198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34199 LDKAnnouncementSignatures this_ptr_conv;
34200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34201 this_ptr_conv.is_owned = false;
34202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34203 LDKThirtyTwoBytes val_ref;
34204 CHECK((*env)->GetArrayLength(env, val) == 32);
34205 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34206 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
34209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34210 LDKAnnouncementSignatures this_ptr_conv;
34211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34212 this_ptr_conv.is_owned = false;
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34214 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
34218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34219 LDKAnnouncementSignatures this_ptr_conv;
34220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34221 this_ptr_conv.is_owned = false;
34222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34223 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
34226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34227 LDKAnnouncementSignatures this_ptr_conv;
34228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34229 this_ptr_conv.is_owned = false;
34230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34231 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34232 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
34236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34237 LDKAnnouncementSignatures 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 LDKSignature val_ref;
34242 CHECK((*env)->GetArrayLength(env, val) == 64);
34243 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34244 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
34247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34248 LDKAnnouncementSignatures this_ptr_conv;
34249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34250 this_ptr_conv.is_owned = false;
34251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34252 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
34257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34258 LDKAnnouncementSignatures this_ptr_conv;
34259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34260 this_ptr_conv.is_owned = false;
34261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34262 LDKSignature val_ref;
34263 CHECK((*env)->GetArrayLength(env, val) == 64);
34264 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34265 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
34268 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) {
34269 LDKThirtyTwoBytes channel_id_arg_ref;
34270 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34271 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34272 LDKSignature node_signature_arg_ref;
34273 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
34274 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
34275 LDKSignature bitcoin_signature_arg_ref;
34276 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
34277 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
34278 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
34279 int64_t ret_ref = 0;
34280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34283 ret_ref = (uintptr_t)ret_var.inner;
34284 if (ret_var.is_owned) {
34290 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
34291 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
34292 int64_t ret_ref = 0;
34293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34296 ret_ref = (uintptr_t)ret_var.inner;
34297 if (ret_var.is_owned) {
34302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34303 LDKAnnouncementSignatures arg_conv;
34304 arg_conv.inner = (void*)(arg & (~1));
34305 arg_conv.is_owned = false;
34306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34307 int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
34311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34312 LDKAnnouncementSignatures orig_conv;
34313 orig_conv.inner = (void*)(orig & (~1));
34314 orig_conv.is_owned = false;
34315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34316 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
34317 int64_t ret_ref = 0;
34318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34321 ret_ref = (uintptr_t)ret_var.inner;
34322 if (ret_var.is_owned) {
34328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34329 if ((this_ptr & 1) != 0) return;
34330 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34331 CHECK_ACCESS(this_ptr_ptr);
34332 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
34333 FREE((void*)this_ptr);
34334 NetAddress_free(this_ptr_conv);
34337 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
34338 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34339 *ret_copy = NetAddress_clone(arg);
34340 int64_t ret_ref = (uintptr_t)ret_copy;
34343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34344 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
34345 int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
34349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34350 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
34351 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34352 *ret_copy = NetAddress_clone(orig_conv);
34353 int64_t ret_ref = (uintptr_t)ret_copy;
34357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
34358 LDKFourBytes addr_ref;
34359 CHECK((*env)->GetArrayLength(env, addr) == 4);
34360 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
34361 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34362 *ret_copy = NetAddress_ipv4(addr_ref, port);
34363 int64_t ret_ref = (uintptr_t)ret_copy;
34367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
34368 LDKSixteenBytes addr_ref;
34369 CHECK((*env)->GetArrayLength(env, addr) == 16);
34370 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
34371 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34372 *ret_copy = NetAddress_ipv6(addr_ref, port);
34373 int64_t ret_ref = (uintptr_t)ret_copy;
34377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
34378 LDKTwelveBytes a_ref;
34379 CHECK((*env)->GetArrayLength(env, a) == 12);
34380 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
34381 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34382 *ret_copy = NetAddress_onion_v2(a_ref);
34383 int64_t ret_ref = (uintptr_t)ret_copy;
34387 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) {
34388 LDKThirtyTwoBytes ed25519_pubkey_ref;
34389 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
34390 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
34391 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34392 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
34393 int64_t ret_ref = (uintptr_t)ret_copy;
34397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
34398 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
34399 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
34400 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34401 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34402 CVec_u8Z_free(ret_var);
34406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34407 LDKu8slice ser_ref;
34408 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34409 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34410 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
34411 *ret_conv = NetAddress_read(ser_ref);
34412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34413 return (int64_t)ret_conv;
34416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34417 LDKUnsignedNodeAnnouncement this_obj_conv;
34418 this_obj_conv.inner = (void*)(this_obj & (~1));
34419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34421 UnsignedNodeAnnouncement_free(this_obj_conv);
34424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34425 LDKUnsignedNodeAnnouncement this_ptr_conv;
34426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34427 this_ptr_conv.is_owned = false;
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34429 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
34430 int64_t ret_ref = 0;
34431 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34432 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34434 ret_ref = (uintptr_t)ret_var.inner;
34435 if (ret_var.is_owned) {
34441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34442 LDKUnsignedNodeAnnouncement this_ptr_conv;
34443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34444 this_ptr_conv.is_owned = false;
34445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34446 LDKNodeFeatures val_conv;
34447 val_conv.inner = (void*)(val & (~1));
34448 val_conv.is_owned = (val & 1) || (val == 0);
34449 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34450 val_conv = NodeFeatures_clone(&val_conv);
34451 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
34454 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34455 LDKUnsignedNodeAnnouncement this_ptr_conv;
34456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34457 this_ptr_conv.is_owned = false;
34458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34459 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
34463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34464 LDKUnsignedNodeAnnouncement this_ptr_conv;
34465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34466 this_ptr_conv.is_owned = false;
34467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34468 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
34471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34472 LDKUnsignedNodeAnnouncement this_ptr_conv;
34473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34474 this_ptr_conv.is_owned = false;
34475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34476 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34477 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
34481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34482 LDKUnsignedNodeAnnouncement this_ptr_conv;
34483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34484 this_ptr_conv.is_owned = false;
34485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34486 LDKPublicKey val_ref;
34487 CHECK((*env)->GetArrayLength(env, val) == 33);
34488 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34489 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
34492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
34493 LDKUnsignedNodeAnnouncement this_ptr_conv;
34494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34495 this_ptr_conv.is_owned = false;
34496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34497 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
34498 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
34502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34503 LDKUnsignedNodeAnnouncement this_ptr_conv;
34504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34505 this_ptr_conv.is_owned = false;
34506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34507 LDKThreeBytes val_ref;
34508 CHECK((*env)->GetArrayLength(env, val) == 3);
34509 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
34510 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
34514 LDKUnsignedNodeAnnouncement this_ptr_conv;
34515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34516 this_ptr_conv.is_owned = false;
34517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34518 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
34523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34524 LDKUnsignedNodeAnnouncement this_ptr_conv;
34525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34526 this_ptr_conv.is_owned = false;
34527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34528 LDKThirtyTwoBytes val_ref;
34529 CHECK((*env)->GetArrayLength(env, val) == 32);
34530 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34531 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
34534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34535 LDKUnsignedNodeAnnouncement this_ptr_conv;
34536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34537 this_ptr_conv.is_owned = false;
34538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34539 LDKCVec_NetAddressZ val_constr;
34540 val_constr.datalen = (*env)->GetArrayLength(env, val);
34541 if (val_constr.datalen > 0)
34542 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34544 val_constr.data = NULL;
34545 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34546 for (size_t m = 0; m < val_constr.datalen; m++) {
34547 int64_t val_conv_12 = val_vals[m];
34548 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
34549 CHECK_ACCESS(val_conv_12_ptr);
34550 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34551 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
34552 val_constr.data[m] = val_conv_12_conv;
34554 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34555 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34558 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34559 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34560 int64_t ret_ref = 0;
34561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34564 ret_ref = (uintptr_t)ret_var.inner;
34565 if (ret_var.is_owned) {
34570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34571 LDKUnsignedNodeAnnouncement arg_conv;
34572 arg_conv.inner = (void*)(arg & (~1));
34573 arg_conv.is_owned = false;
34574 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34575 int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34580 LDKUnsignedNodeAnnouncement orig_conv;
34581 orig_conv.inner = (void*)(orig & (~1));
34582 orig_conv.is_owned = false;
34583 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34584 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34585 int64_t ret_ref = 0;
34586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34589 ret_ref = (uintptr_t)ret_var.inner;
34590 if (ret_var.is_owned) {
34596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34597 LDKNodeAnnouncement this_obj_conv;
34598 this_obj_conv.inner = (void*)(this_obj & (~1));
34599 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34601 NodeAnnouncement_free(this_obj_conv);
34604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34605 LDKNodeAnnouncement this_ptr_conv;
34606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34607 this_ptr_conv.is_owned = false;
34608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34609 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34610 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
34614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34615 LDKNodeAnnouncement this_ptr_conv;
34616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34617 this_ptr_conv.is_owned = false;
34618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34619 LDKSignature val_ref;
34620 CHECK((*env)->GetArrayLength(env, val) == 64);
34621 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34622 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34626 LDKNodeAnnouncement this_ptr_conv;
34627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34628 this_ptr_conv.is_owned = false;
34629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34630 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34631 int64_t ret_ref = 0;
34632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34635 ret_ref = (uintptr_t)ret_var.inner;
34636 if (ret_var.is_owned) {
34642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34643 LDKNodeAnnouncement this_ptr_conv;
34644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34645 this_ptr_conv.is_owned = false;
34646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34647 LDKUnsignedNodeAnnouncement val_conv;
34648 val_conv.inner = (void*)(val & (~1));
34649 val_conv.is_owned = (val & 1) || (val == 0);
34650 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34651 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34652 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34656 LDKSignature signature_arg_ref;
34657 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34658 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34659 LDKUnsignedNodeAnnouncement contents_arg_conv;
34660 contents_arg_conv.inner = (void*)(contents_arg & (~1));
34661 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
34662 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34663 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34664 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34665 int64_t ret_ref = 0;
34666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34669 ret_ref = (uintptr_t)ret_var.inner;
34670 if (ret_var.is_owned) {
34676 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34677 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34678 int64_t ret_ref = 0;
34679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34682 ret_ref = (uintptr_t)ret_var.inner;
34683 if (ret_var.is_owned) {
34688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34689 LDKNodeAnnouncement arg_conv;
34690 arg_conv.inner = (void*)(arg & (~1));
34691 arg_conv.is_owned = false;
34692 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34693 int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34698 LDKNodeAnnouncement orig_conv;
34699 orig_conv.inner = (void*)(orig & (~1));
34700 orig_conv.is_owned = false;
34701 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34702 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34703 int64_t ret_ref = 0;
34704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34707 ret_ref = (uintptr_t)ret_var.inner;
34708 if (ret_var.is_owned) {
34714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34715 LDKUnsignedChannelAnnouncement this_obj_conv;
34716 this_obj_conv.inner = (void*)(this_obj & (~1));
34717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34719 UnsignedChannelAnnouncement_free(this_obj_conv);
34722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34723 LDKUnsignedChannelAnnouncement this_ptr_conv;
34724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34725 this_ptr_conv.is_owned = false;
34726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34727 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34728 int64_t ret_ref = 0;
34729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34732 ret_ref = (uintptr_t)ret_var.inner;
34733 if (ret_var.is_owned) {
34739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34740 LDKUnsignedChannelAnnouncement this_ptr_conv;
34741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34742 this_ptr_conv.is_owned = false;
34743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34744 LDKChannelFeatures val_conv;
34745 val_conv.inner = (void*)(val & (~1));
34746 val_conv.is_owned = (val & 1) || (val == 0);
34747 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34748 val_conv = ChannelFeatures_clone(&val_conv);
34749 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34753 LDKUnsignedChannelAnnouncement this_ptr_conv;
34754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34755 this_ptr_conv.is_owned = false;
34756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34757 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34758 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
34762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34763 LDKUnsignedChannelAnnouncement this_ptr_conv;
34764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34765 this_ptr_conv.is_owned = false;
34766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34767 LDKThirtyTwoBytes val_ref;
34768 CHECK((*env)->GetArrayLength(env, val) == 32);
34769 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34770 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34774 LDKUnsignedChannelAnnouncement this_ptr_conv;
34775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34776 this_ptr_conv.is_owned = false;
34777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34778 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34783 LDKUnsignedChannelAnnouncement this_ptr_conv;
34784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34785 this_ptr_conv.is_owned = false;
34786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34787 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34791 LDKUnsignedChannelAnnouncement this_ptr_conv;
34792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34793 this_ptr_conv.is_owned = false;
34794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34795 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34796 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
34800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34801 LDKUnsignedChannelAnnouncement this_ptr_conv;
34802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34803 this_ptr_conv.is_owned = false;
34804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34805 LDKPublicKey val_ref;
34806 CHECK((*env)->GetArrayLength(env, val) == 33);
34807 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34808 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
34811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34812 LDKUnsignedChannelAnnouncement this_ptr_conv;
34813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34814 this_ptr_conv.is_owned = false;
34815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34816 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34817 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
34821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34822 LDKUnsignedChannelAnnouncement this_ptr_conv;
34823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34824 this_ptr_conv.is_owned = false;
34825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34826 LDKPublicKey val_ref;
34827 CHECK((*env)->GetArrayLength(env, val) == 33);
34828 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34829 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
34832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34833 LDKUnsignedChannelAnnouncement this_ptr_conv;
34834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34835 this_ptr_conv.is_owned = false;
34836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34837 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
34842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34843 LDKUnsignedChannelAnnouncement this_ptr_conv;
34844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34845 this_ptr_conv.is_owned = false;
34846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34847 LDKPublicKey val_ref;
34848 CHECK((*env)->GetArrayLength(env, val) == 33);
34849 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34850 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
34853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34854 LDKUnsignedChannelAnnouncement this_ptr_conv;
34855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34856 this_ptr_conv.is_owned = false;
34857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34858 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34859 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
34863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34864 LDKUnsignedChannelAnnouncement this_ptr_conv;
34865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34866 this_ptr_conv.is_owned = false;
34867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34868 LDKPublicKey val_ref;
34869 CHECK((*env)->GetArrayLength(env, val) == 33);
34870 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34871 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
34874 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34875 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34876 int64_t ret_ref = 0;
34877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34880 ret_ref = (uintptr_t)ret_var.inner;
34881 if (ret_var.is_owned) {
34886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34887 LDKUnsignedChannelAnnouncement arg_conv;
34888 arg_conv.inner = (void*)(arg & (~1));
34889 arg_conv.is_owned = false;
34890 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34891 int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34896 LDKUnsignedChannelAnnouncement orig_conv;
34897 orig_conv.inner = (void*)(orig & (~1));
34898 orig_conv.is_owned = false;
34899 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34900 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34901 int64_t ret_ref = 0;
34902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34905 ret_ref = (uintptr_t)ret_var.inner;
34906 if (ret_var.is_owned) {
34912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34913 LDKChannelAnnouncement this_obj_conv;
34914 this_obj_conv.inner = (void*)(this_obj & (~1));
34915 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34917 ChannelAnnouncement_free(this_obj_conv);
34920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34921 LDKChannelAnnouncement this_ptr_conv;
34922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34923 this_ptr_conv.is_owned = false;
34924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34925 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34926 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
34930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34931 LDKChannelAnnouncement this_ptr_conv;
34932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34933 this_ptr_conv.is_owned = false;
34934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34935 LDKSignature val_ref;
34936 CHECK((*env)->GetArrayLength(env, val) == 64);
34937 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34938 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34942 LDKChannelAnnouncement this_ptr_conv;
34943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34944 this_ptr_conv.is_owned = false;
34945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34946 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
34951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34952 LDKChannelAnnouncement this_ptr_conv;
34953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34954 this_ptr_conv.is_owned = false;
34955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34956 LDKSignature val_ref;
34957 CHECK((*env)->GetArrayLength(env, val) == 64);
34958 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34959 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34963 LDKChannelAnnouncement this_ptr_conv;
34964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34965 this_ptr_conv.is_owned = false;
34966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34967 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34968 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
34972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34973 LDKChannelAnnouncement this_ptr_conv;
34974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34975 this_ptr_conv.is_owned = false;
34976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34977 LDKSignature val_ref;
34978 CHECK((*env)->GetArrayLength(env, val) == 64);
34979 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34980 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34984 LDKChannelAnnouncement this_ptr_conv;
34985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34986 this_ptr_conv.is_owned = false;
34987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34988 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34989 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
34993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34994 LDKChannelAnnouncement this_ptr_conv;
34995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34996 this_ptr_conv.is_owned = false;
34997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34998 LDKSignature val_ref;
34999 CHECK((*env)->GetArrayLength(env, val) == 64);
35000 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35001 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
35004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35005 LDKChannelAnnouncement this_ptr_conv;
35006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35007 this_ptr_conv.is_owned = false;
35008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35009 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
35010 int64_t ret_ref = 0;
35011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35014 ret_ref = (uintptr_t)ret_var.inner;
35015 if (ret_var.is_owned) {
35021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35022 LDKChannelAnnouncement this_ptr_conv;
35023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35024 this_ptr_conv.is_owned = false;
35025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35026 LDKUnsignedChannelAnnouncement val_conv;
35027 val_conv.inner = (void*)(val & (~1));
35028 val_conv.is_owned = (val & 1) || (val == 0);
35029 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35030 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
35031 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
35034 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) {
35035 LDKSignature node_signature_1_arg_ref;
35036 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
35037 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
35038 LDKSignature node_signature_2_arg_ref;
35039 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
35040 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
35041 LDKSignature bitcoin_signature_1_arg_ref;
35042 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
35043 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
35044 LDKSignature bitcoin_signature_2_arg_ref;
35045 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
35046 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
35047 LDKUnsignedChannelAnnouncement contents_arg_conv;
35048 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35049 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35050 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35051 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
35052 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);
35053 int64_t ret_ref = 0;
35054 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35055 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35057 ret_ref = (uintptr_t)ret_var.inner;
35058 if (ret_var.is_owned) {
35064 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
35065 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
35066 int64_t ret_ref = 0;
35067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35070 ret_ref = (uintptr_t)ret_var.inner;
35071 if (ret_var.is_owned) {
35076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35077 LDKChannelAnnouncement arg_conv;
35078 arg_conv.inner = (void*)(arg & (~1));
35079 arg_conv.is_owned = false;
35080 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35081 int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
35085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35086 LDKChannelAnnouncement orig_conv;
35087 orig_conv.inner = (void*)(orig & (~1));
35088 orig_conv.is_owned = false;
35089 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35090 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
35091 int64_t ret_ref = 0;
35092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35095 ret_ref = (uintptr_t)ret_var.inner;
35096 if (ret_var.is_owned) {
35102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35103 LDKUnsignedChannelUpdate this_obj_conv;
35104 this_obj_conv.inner = (void*)(this_obj & (~1));
35105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35107 UnsignedChannelUpdate_free(this_obj_conv);
35110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35111 LDKUnsignedChannelUpdate this_ptr_conv;
35112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35113 this_ptr_conv.is_owned = false;
35114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35115 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35116 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
35120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35121 LDKUnsignedChannelUpdate this_ptr_conv;
35122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35123 this_ptr_conv.is_owned = false;
35124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35125 LDKThirtyTwoBytes val_ref;
35126 CHECK((*env)->GetArrayLength(env, val) == 32);
35127 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35128 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
35131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35132 LDKUnsignedChannelUpdate this_ptr_conv;
35133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35134 this_ptr_conv.is_owned = false;
35135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35136 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
35140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35141 LDKUnsignedChannelUpdate this_ptr_conv;
35142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35143 this_ptr_conv.is_owned = false;
35144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35145 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
35148 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35149 LDKUnsignedChannelUpdate this_ptr_conv;
35150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35151 this_ptr_conv.is_owned = false;
35152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35153 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
35157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35158 LDKUnsignedChannelUpdate this_ptr_conv;
35159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35160 this_ptr_conv.is_owned = false;
35161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35162 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
35165 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
35166 LDKUnsignedChannelUpdate this_ptr_conv;
35167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35168 this_ptr_conv.is_owned = false;
35169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35170 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
35174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
35175 LDKUnsignedChannelUpdate this_ptr_conv;
35176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35177 this_ptr_conv.is_owned = false;
35178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35179 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
35182 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
35183 LDKUnsignedChannelUpdate this_ptr_conv;
35184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35185 this_ptr_conv.is_owned = false;
35186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35187 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
35191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35192 LDKUnsignedChannelUpdate this_ptr_conv;
35193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35194 this_ptr_conv.is_owned = false;
35195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35196 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
35199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35200 LDKUnsignedChannelUpdate this_ptr_conv;
35201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35202 this_ptr_conv.is_owned = false;
35203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35204 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
35208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35209 LDKUnsignedChannelUpdate this_ptr_conv;
35210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35211 this_ptr_conv.is_owned = false;
35212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35213 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
35216 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35217 LDKUnsignedChannelUpdate this_ptr_conv;
35218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35219 this_ptr_conv.is_owned = false;
35220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35221 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
35225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35226 LDKUnsignedChannelUpdate this_ptr_conv;
35227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35228 this_ptr_conv.is_owned = false;
35229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35230 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
35233 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
35234 LDKUnsignedChannelUpdate this_ptr_conv;
35235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35236 this_ptr_conv.is_owned = false;
35237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35238 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
35242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35243 LDKUnsignedChannelUpdate this_ptr_conv;
35244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35245 this_ptr_conv.is_owned = false;
35246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35247 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
35250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35251 LDKUnsignedChannelUpdate this_ptr_conv;
35252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35253 this_ptr_conv.is_owned = false;
35254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35255 LDKCVec_u8Z val_ref;
35256 val_ref.datalen = (*env)->GetArrayLength(env, val);
35257 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35258 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
35259 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
35262 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
35263 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
35264 int64_t ret_ref = 0;
35265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35268 ret_ref = (uintptr_t)ret_var.inner;
35269 if (ret_var.is_owned) {
35274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35275 LDKUnsignedChannelUpdate arg_conv;
35276 arg_conv.inner = (void*)(arg & (~1));
35277 arg_conv.is_owned = false;
35278 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35279 int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
35283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35284 LDKUnsignedChannelUpdate orig_conv;
35285 orig_conv.inner = (void*)(orig & (~1));
35286 orig_conv.is_owned = false;
35287 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35288 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
35289 int64_t ret_ref = 0;
35290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35293 ret_ref = (uintptr_t)ret_var.inner;
35294 if (ret_var.is_owned) {
35300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35301 LDKChannelUpdate this_obj_conv;
35302 this_obj_conv.inner = (void*)(this_obj & (~1));
35303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35305 ChannelUpdate_free(this_obj_conv);
35308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35309 LDKChannelUpdate this_ptr_conv;
35310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35311 this_ptr_conv.is_owned = false;
35312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35313 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
35318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35319 LDKChannelUpdate this_ptr_conv;
35320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35321 this_ptr_conv.is_owned = false;
35322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35323 LDKSignature val_ref;
35324 CHECK((*env)->GetArrayLength(env, val) == 64);
35325 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35326 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
35329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35330 LDKChannelUpdate this_ptr_conv;
35331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35332 this_ptr_conv.is_owned = false;
35333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35334 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
35335 int64_t ret_ref = 0;
35336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35339 ret_ref = (uintptr_t)ret_var.inner;
35340 if (ret_var.is_owned) {
35346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35347 LDKChannelUpdate this_ptr_conv;
35348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35349 this_ptr_conv.is_owned = false;
35350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35351 LDKUnsignedChannelUpdate val_conv;
35352 val_conv.inner = (void*)(val & (~1));
35353 val_conv.is_owned = (val & 1) || (val == 0);
35354 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35355 val_conv = UnsignedChannelUpdate_clone(&val_conv);
35356 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
35359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
35360 LDKSignature signature_arg_ref;
35361 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
35362 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
35363 LDKUnsignedChannelUpdate contents_arg_conv;
35364 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35365 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35366 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35367 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35368 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35369 int64_t ret_ref = 0;
35370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35373 ret_ref = (uintptr_t)ret_var.inner;
35374 if (ret_var.is_owned) {
35380 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35381 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35382 int64_t ret_ref = 0;
35383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35386 ret_ref = (uintptr_t)ret_var.inner;
35387 if (ret_var.is_owned) {
35392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35393 LDKChannelUpdate arg_conv;
35394 arg_conv.inner = (void*)(arg & (~1));
35395 arg_conv.is_owned = false;
35396 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35397 int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35402 LDKChannelUpdate orig_conv;
35403 orig_conv.inner = (void*)(orig & (~1));
35404 orig_conv.is_owned = false;
35405 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35406 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35407 int64_t ret_ref = 0;
35408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35411 ret_ref = (uintptr_t)ret_var.inner;
35412 if (ret_var.is_owned) {
35418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35419 LDKQueryChannelRange this_obj_conv;
35420 this_obj_conv.inner = (void*)(this_obj & (~1));
35421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35423 QueryChannelRange_free(this_obj_conv);
35426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35427 LDKQueryChannelRange this_ptr_conv;
35428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35429 this_ptr_conv.is_owned = false;
35430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35431 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35432 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
35436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35437 LDKQueryChannelRange this_ptr_conv;
35438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35439 this_ptr_conv.is_owned = false;
35440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35441 LDKThirtyTwoBytes val_ref;
35442 CHECK((*env)->GetArrayLength(env, val) == 32);
35443 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35444 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35447 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35448 LDKQueryChannelRange this_ptr_conv;
35449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35450 this_ptr_conv.is_owned = false;
35451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35452 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35457 LDKQueryChannelRange this_ptr_conv;
35458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35459 this_ptr_conv.is_owned = false;
35460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35461 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35464 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35465 LDKQueryChannelRange this_ptr_conv;
35466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35467 this_ptr_conv.is_owned = false;
35468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35469 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35474 LDKQueryChannelRange this_ptr_conv;
35475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35476 this_ptr_conv.is_owned = false;
35477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35478 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35481 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) {
35482 LDKThirtyTwoBytes chain_hash_arg_ref;
35483 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35484 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35485 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35486 int64_t ret_ref = 0;
35487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35490 ret_ref = (uintptr_t)ret_var.inner;
35491 if (ret_var.is_owned) {
35497 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35498 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35499 int64_t ret_ref = 0;
35500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35503 ret_ref = (uintptr_t)ret_var.inner;
35504 if (ret_var.is_owned) {
35509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35510 LDKQueryChannelRange arg_conv;
35511 arg_conv.inner = (void*)(arg & (~1));
35512 arg_conv.is_owned = false;
35513 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35514 int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35519 LDKQueryChannelRange orig_conv;
35520 orig_conv.inner = (void*)(orig & (~1));
35521 orig_conv.is_owned = false;
35522 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35523 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35524 int64_t ret_ref = 0;
35525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35528 ret_ref = (uintptr_t)ret_var.inner;
35529 if (ret_var.is_owned) {
35535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35536 LDKReplyChannelRange this_obj_conv;
35537 this_obj_conv.inner = (void*)(this_obj & (~1));
35538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35540 ReplyChannelRange_free(this_obj_conv);
35543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35544 LDKReplyChannelRange this_ptr_conv;
35545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35546 this_ptr_conv.is_owned = false;
35547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35548 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35549 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
35553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35554 LDKReplyChannelRange this_ptr_conv;
35555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35556 this_ptr_conv.is_owned = false;
35557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35558 LDKThirtyTwoBytes val_ref;
35559 CHECK((*env)->GetArrayLength(env, val) == 32);
35560 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35561 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35564 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35565 LDKReplyChannelRange this_ptr_conv;
35566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35567 this_ptr_conv.is_owned = false;
35568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35569 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35574 LDKReplyChannelRange this_ptr_conv;
35575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35576 this_ptr_conv.is_owned = false;
35577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35578 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35581 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35582 LDKReplyChannelRange this_ptr_conv;
35583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35584 this_ptr_conv.is_owned = false;
35585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35586 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35591 LDKReplyChannelRange this_ptr_conv;
35592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35593 this_ptr_conv.is_owned = false;
35594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35595 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
35599 LDKReplyChannelRange this_ptr_conv;
35600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35601 this_ptr_conv.is_owned = false;
35602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35603 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35608 LDKReplyChannelRange this_ptr_conv;
35609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35610 this_ptr_conv.is_owned = false;
35611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35612 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35616 LDKReplyChannelRange this_ptr_conv;
35617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35618 this_ptr_conv.is_owned = false;
35619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35620 LDKCVec_u64Z val_constr;
35621 val_constr.datalen = (*env)->GetArrayLength(env, val);
35622 if (val_constr.datalen > 0)
35623 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35625 val_constr.data = NULL;
35626 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35627 for (size_t g = 0; g < val_constr.datalen; g++) {
35628 int64_t val_conv_6 = val_vals[g];
35629 val_constr.data[g] = val_conv_6;
35631 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35632 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35635 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) {
35636 LDKThirtyTwoBytes chain_hash_arg_ref;
35637 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35638 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35639 LDKCVec_u64Z short_channel_ids_arg_constr;
35640 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35641 if (short_channel_ids_arg_constr.datalen > 0)
35642 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35644 short_channel_ids_arg_constr.data = NULL;
35645 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35646 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35647 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35648 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35650 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35651 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35652 int64_t ret_ref = 0;
35653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35656 ret_ref = (uintptr_t)ret_var.inner;
35657 if (ret_var.is_owned) {
35663 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35664 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35665 int64_t ret_ref = 0;
35666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35669 ret_ref = (uintptr_t)ret_var.inner;
35670 if (ret_var.is_owned) {
35675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35676 LDKReplyChannelRange arg_conv;
35677 arg_conv.inner = (void*)(arg & (~1));
35678 arg_conv.is_owned = false;
35679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35680 int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35685 LDKReplyChannelRange orig_conv;
35686 orig_conv.inner = (void*)(orig & (~1));
35687 orig_conv.is_owned = false;
35688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35689 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35690 int64_t ret_ref = 0;
35691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35694 ret_ref = (uintptr_t)ret_var.inner;
35695 if (ret_var.is_owned) {
35701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35702 LDKQueryShortChannelIds this_obj_conv;
35703 this_obj_conv.inner = (void*)(this_obj & (~1));
35704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35706 QueryShortChannelIds_free(this_obj_conv);
35709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35710 LDKQueryShortChannelIds this_ptr_conv;
35711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35712 this_ptr_conv.is_owned = false;
35713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35714 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
35719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35720 LDKQueryShortChannelIds this_ptr_conv;
35721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35722 this_ptr_conv.is_owned = false;
35723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35724 LDKThirtyTwoBytes val_ref;
35725 CHECK((*env)->GetArrayLength(env, val) == 32);
35726 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35727 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35731 LDKQueryShortChannelIds this_ptr_conv;
35732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35733 this_ptr_conv.is_owned = false;
35734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35735 LDKCVec_u64Z val_constr;
35736 val_constr.datalen = (*env)->GetArrayLength(env, val);
35737 if (val_constr.datalen > 0)
35738 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35740 val_constr.data = NULL;
35741 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35742 for (size_t g = 0; g < val_constr.datalen; g++) {
35743 int64_t val_conv_6 = val_vals[g];
35744 val_constr.data[g] = val_conv_6;
35746 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35747 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35750 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) {
35751 LDKThirtyTwoBytes chain_hash_arg_ref;
35752 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35753 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35754 LDKCVec_u64Z short_channel_ids_arg_constr;
35755 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35756 if (short_channel_ids_arg_constr.datalen > 0)
35757 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35759 short_channel_ids_arg_constr.data = NULL;
35760 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35761 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35762 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35763 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35765 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35766 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35767 int64_t ret_ref = 0;
35768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35771 ret_ref = (uintptr_t)ret_var.inner;
35772 if (ret_var.is_owned) {
35778 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35779 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35780 int64_t ret_ref = 0;
35781 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35782 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35784 ret_ref = (uintptr_t)ret_var.inner;
35785 if (ret_var.is_owned) {
35790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35791 LDKQueryShortChannelIds arg_conv;
35792 arg_conv.inner = (void*)(arg & (~1));
35793 arg_conv.is_owned = false;
35794 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35795 int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35800 LDKQueryShortChannelIds orig_conv;
35801 orig_conv.inner = (void*)(orig & (~1));
35802 orig_conv.is_owned = false;
35803 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35804 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35805 int64_t ret_ref = 0;
35806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35809 ret_ref = (uintptr_t)ret_var.inner;
35810 if (ret_var.is_owned) {
35816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35817 LDKReplyShortChannelIdsEnd this_obj_conv;
35818 this_obj_conv.inner = (void*)(this_obj & (~1));
35819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35821 ReplyShortChannelIdsEnd_free(this_obj_conv);
35824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35825 LDKReplyShortChannelIdsEnd this_ptr_conv;
35826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35827 this_ptr_conv.is_owned = false;
35828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35829 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35830 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
35834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35835 LDKReplyShortChannelIdsEnd this_ptr_conv;
35836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35837 this_ptr_conv.is_owned = false;
35838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35839 LDKThirtyTwoBytes val_ref;
35840 CHECK((*env)->GetArrayLength(env, val) == 32);
35841 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35842 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
35846 LDKReplyShortChannelIdsEnd this_ptr_conv;
35847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35848 this_ptr_conv.is_owned = false;
35849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35850 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35855 LDKReplyShortChannelIdsEnd this_ptr_conv;
35856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35857 this_ptr_conv.is_owned = false;
35858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35859 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
35863 LDKThirtyTwoBytes chain_hash_arg_ref;
35864 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35865 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35866 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35867 int64_t ret_ref = 0;
35868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35871 ret_ref = (uintptr_t)ret_var.inner;
35872 if (ret_var.is_owned) {
35878 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35879 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35880 int64_t ret_ref = 0;
35881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35884 ret_ref = (uintptr_t)ret_var.inner;
35885 if (ret_var.is_owned) {
35890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35891 LDKReplyShortChannelIdsEnd arg_conv;
35892 arg_conv.inner = (void*)(arg & (~1));
35893 arg_conv.is_owned = false;
35894 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35895 int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35900 LDKReplyShortChannelIdsEnd orig_conv;
35901 orig_conv.inner = (void*)(orig & (~1));
35902 orig_conv.is_owned = false;
35903 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35904 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35905 int64_t ret_ref = 0;
35906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35909 ret_ref = (uintptr_t)ret_var.inner;
35910 if (ret_var.is_owned) {
35916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35917 LDKGossipTimestampFilter this_obj_conv;
35918 this_obj_conv.inner = (void*)(this_obj & (~1));
35919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35921 GossipTimestampFilter_free(this_obj_conv);
35924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35925 LDKGossipTimestampFilter 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_tArray ret_arr = (*env)->NewByteArray(env, 32);
35930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
35934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35935 LDKGossipTimestampFilter this_ptr_conv;
35936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35937 this_ptr_conv.is_owned = false;
35938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35939 LDKThirtyTwoBytes val_ref;
35940 CHECK((*env)->GetArrayLength(env, val) == 32);
35941 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35942 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35945 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35946 LDKGossipTimestampFilter this_ptr_conv;
35947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35948 this_ptr_conv.is_owned = false;
35949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35950 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35955 LDKGossipTimestampFilter this_ptr_conv;
35956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35957 this_ptr_conv.is_owned = false;
35958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35959 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35962 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
35963 LDKGossipTimestampFilter this_ptr_conv;
35964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35965 this_ptr_conv.is_owned = false;
35966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35967 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35972 LDKGossipTimestampFilter this_ptr_conv;
35973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35974 this_ptr_conv.is_owned = false;
35975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35976 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35979 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) {
35980 LDKThirtyTwoBytes chain_hash_arg_ref;
35981 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35982 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35983 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35984 int64_t ret_ref = 0;
35985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35988 ret_ref = (uintptr_t)ret_var.inner;
35989 if (ret_var.is_owned) {
35995 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35996 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35997 int64_t ret_ref = 0;
35998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36001 ret_ref = (uintptr_t)ret_var.inner;
36002 if (ret_var.is_owned) {
36007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36008 LDKGossipTimestampFilter arg_conv;
36009 arg_conv.inner = (void*)(arg & (~1));
36010 arg_conv.is_owned = false;
36011 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36012 int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
36016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36017 LDKGossipTimestampFilter orig_conv;
36018 orig_conv.inner = (void*)(orig & (~1));
36019 orig_conv.is_owned = false;
36020 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36021 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
36022 int64_t ret_ref = 0;
36023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36026 ret_ref = (uintptr_t)ret_var.inner;
36027 if (ret_var.is_owned) {
36033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36034 if ((this_ptr & 1) != 0) return;
36035 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36036 CHECK_ACCESS(this_ptr_ptr);
36037 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
36038 FREE((void*)this_ptr);
36039 ErrorAction_free(this_ptr_conv);
36042 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
36043 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36044 *ret_copy = ErrorAction_clone(arg);
36045 int64_t ret_ref = (uintptr_t)ret_copy;
36048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36049 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
36050 int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
36054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36055 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
36056 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36057 *ret_copy = ErrorAction_clone(orig_conv);
36058 int64_t ret_ref = (uintptr_t)ret_copy;
36062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
36063 LDKErrorMessage msg_conv;
36064 msg_conv.inner = (void*)(msg & (~1));
36065 msg_conv.is_owned = (msg & 1) || (msg == 0);
36066 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36067 msg_conv = ErrorMessage_clone(&msg_conv);
36068 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36069 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
36070 int64_t ret_ref = (uintptr_t)ret_copy;
36074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
36075 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36076 *ret_copy = ErrorAction_ignore_error();
36077 int64_t ret_ref = (uintptr_t)ret_copy;
36081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
36082 LDKLevel a_conv = LDKLevel_from_java(env, a);
36083 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36084 *ret_copy = ErrorAction_ignore_and_log(a_conv);
36085 int64_t ret_ref = (uintptr_t)ret_copy;
36089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
36090 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36091 *ret_copy = ErrorAction_ignore_duplicate_gossip();
36092 int64_t ret_ref = (uintptr_t)ret_copy;
36096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
36097 LDKErrorMessage msg_conv;
36098 msg_conv.inner = (void*)(msg & (~1));
36099 msg_conv.is_owned = (msg & 1) || (msg == 0);
36100 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36101 msg_conv = ErrorMessage_clone(&msg_conv);
36102 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36103 *ret_copy = ErrorAction_send_error_message(msg_conv);
36104 int64_t ret_ref = (uintptr_t)ret_copy;
36108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
36109 LDKWarningMessage msg_conv;
36110 msg_conv.inner = (void*)(msg & (~1));
36111 msg_conv.is_owned = (msg & 1) || (msg == 0);
36112 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36113 msg_conv = WarningMessage_clone(&msg_conv);
36114 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
36115 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36116 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
36117 int64_t ret_ref = (uintptr_t)ret_copy;
36121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36122 LDKLightningError this_obj_conv;
36123 this_obj_conv.inner = (void*)(this_obj & (~1));
36124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36126 LightningError_free(this_obj_conv);
36129 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
36130 LDKLightningError this_ptr_conv;
36131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36132 this_ptr_conv.is_owned = false;
36133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36134 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
36135 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
36140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
36141 LDKLightningError this_ptr_conv;
36142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36143 this_ptr_conv.is_owned = false;
36144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36145 LDKStr val_conv = java_to_owned_str(env, val);
36146 LightningError_set_err(&this_ptr_conv, val_conv);
36149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
36150 LDKLightningError this_ptr_conv;
36151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36152 this_ptr_conv.is_owned = false;
36153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36154 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36155 *ret_copy = LightningError_get_action(&this_ptr_conv);
36156 int64_t ret_ref = (uintptr_t)ret_copy;
36160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36161 LDKLightningError this_ptr_conv;
36162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36163 this_ptr_conv.is_owned = false;
36164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36165 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36166 CHECK_ACCESS(val_ptr);
36167 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
36168 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
36169 LightningError_set_action(&this_ptr_conv, val_conv);
36172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
36173 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
36174 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
36175 CHECK_ACCESS(action_arg_ptr);
36176 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
36177 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
36178 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
36179 int64_t ret_ref = 0;
36180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36183 ret_ref = (uintptr_t)ret_var.inner;
36184 if (ret_var.is_owned) {
36190 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
36191 LDKLightningError ret_var = LightningError_clone(arg);
36192 int64_t ret_ref = 0;
36193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36196 ret_ref = (uintptr_t)ret_var.inner;
36197 if (ret_var.is_owned) {
36202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36203 LDKLightningError arg_conv;
36204 arg_conv.inner = (void*)(arg & (~1));
36205 arg_conv.is_owned = false;
36206 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36207 int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
36211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36212 LDKLightningError orig_conv;
36213 orig_conv.inner = (void*)(orig & (~1));
36214 orig_conv.is_owned = false;
36215 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36216 LDKLightningError ret_var = LightningError_clone(&orig_conv);
36217 int64_t ret_ref = 0;
36218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36221 ret_ref = (uintptr_t)ret_var.inner;
36222 if (ret_var.is_owned) {
36228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36229 LDKCommitmentUpdate this_obj_conv;
36230 this_obj_conv.inner = (void*)(this_obj & (~1));
36231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36233 CommitmentUpdate_free(this_obj_conv);
36236 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36237 LDKCommitmentUpdate this_ptr_conv;
36238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36239 this_ptr_conv.is_owned = false;
36240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36241 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
36242 int64_tArray ret_arr = NULL;
36243 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36244 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36245 for (size_t p = 0; p < ret_var.datalen; p++) {
36246 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
36247 int64_t ret_conv_15_ref = 0;
36248 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36249 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
36251 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
36252 if (ret_conv_15_var.is_owned) {
36253 ret_conv_15_ref |= 1;
36255 ret_arr_ptr[p] = ret_conv_15_ref;
36257 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36258 FREE(ret_var.data);
36262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36263 LDKCommitmentUpdate this_ptr_conv;
36264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36265 this_ptr_conv.is_owned = false;
36266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36267 LDKCVec_UpdateAddHTLCZ val_constr;
36268 val_constr.datalen = (*env)->GetArrayLength(env, val);
36269 if (val_constr.datalen > 0)
36270 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36272 val_constr.data = NULL;
36273 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36274 for (size_t p = 0; p < val_constr.datalen; p++) {
36275 int64_t val_conv_15 = val_vals[p];
36276 LDKUpdateAddHTLC val_conv_15_conv;
36277 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
36278 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
36279 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
36280 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
36281 val_constr.data[p] = val_conv_15_conv;
36283 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36284 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
36287 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36288 LDKCommitmentUpdate this_ptr_conv;
36289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36290 this_ptr_conv.is_owned = false;
36291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36292 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
36293 int64_tArray ret_arr = NULL;
36294 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36295 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36296 for (size_t t = 0; t < ret_var.datalen; t++) {
36297 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
36298 int64_t ret_conv_19_ref = 0;
36299 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36300 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
36302 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
36303 if (ret_conv_19_var.is_owned) {
36304 ret_conv_19_ref |= 1;
36306 ret_arr_ptr[t] = ret_conv_19_ref;
36308 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36309 FREE(ret_var.data);
36313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36314 LDKCommitmentUpdate this_ptr_conv;
36315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36316 this_ptr_conv.is_owned = false;
36317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36318 LDKCVec_UpdateFulfillHTLCZ val_constr;
36319 val_constr.datalen = (*env)->GetArrayLength(env, val);
36320 if (val_constr.datalen > 0)
36321 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36323 val_constr.data = NULL;
36324 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36325 for (size_t t = 0; t < val_constr.datalen; t++) {
36326 int64_t val_conv_19 = val_vals[t];
36327 LDKUpdateFulfillHTLC val_conv_19_conv;
36328 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
36329 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
36330 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
36331 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
36332 val_constr.data[t] = val_conv_19_conv;
36334 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36335 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
36338 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36339 LDKCommitmentUpdate this_ptr_conv;
36340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36341 this_ptr_conv.is_owned = false;
36342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36343 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
36344 int64_tArray ret_arr = NULL;
36345 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36346 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36347 for (size_t q = 0; q < ret_var.datalen; q++) {
36348 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
36349 int64_t ret_conv_16_ref = 0;
36350 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36351 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
36353 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
36354 if (ret_conv_16_var.is_owned) {
36355 ret_conv_16_ref |= 1;
36357 ret_arr_ptr[q] = ret_conv_16_ref;
36359 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36360 FREE(ret_var.data);
36364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36365 LDKCommitmentUpdate this_ptr_conv;
36366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36367 this_ptr_conv.is_owned = false;
36368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36369 LDKCVec_UpdateFailHTLCZ val_constr;
36370 val_constr.datalen = (*env)->GetArrayLength(env, val);
36371 if (val_constr.datalen > 0)
36372 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36374 val_constr.data = NULL;
36375 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36376 for (size_t q = 0; q < val_constr.datalen; q++) {
36377 int64_t val_conv_16 = val_vals[q];
36378 LDKUpdateFailHTLC val_conv_16_conv;
36379 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
36380 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
36381 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36382 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36383 val_constr.data[q] = val_conv_16_conv;
36385 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36386 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36389 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36390 LDKCommitmentUpdate 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 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36395 int64_tArray ret_arr = NULL;
36396 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36397 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36398 for (size_t z = 0; z < ret_var.datalen; z++) {
36399 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36400 int64_t ret_conv_25_ref = 0;
36401 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36402 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36404 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
36405 if (ret_conv_25_var.is_owned) {
36406 ret_conv_25_ref |= 1;
36408 ret_arr_ptr[z] = ret_conv_25_ref;
36410 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36411 FREE(ret_var.data);
36415 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) {
36416 LDKCommitmentUpdate 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 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36421 val_constr.datalen = (*env)->GetArrayLength(env, val);
36422 if (val_constr.datalen > 0)
36423 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36425 val_constr.data = NULL;
36426 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36427 for (size_t z = 0; z < val_constr.datalen; z++) {
36428 int64_t val_conv_25 = val_vals[z];
36429 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36430 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
36431 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
36432 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36433 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36434 val_constr.data[z] = val_conv_25_conv;
36436 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36437 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
36441 LDKCommitmentUpdate this_ptr_conv;
36442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36443 this_ptr_conv.is_owned = false;
36444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36445 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36446 int64_t ret_ref = 0;
36447 if ((uintptr_t)ret_var.inner > 4096) {
36448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36451 ret_ref = (uintptr_t)ret_var.inner;
36452 if (ret_var.is_owned) {
36459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36460 LDKCommitmentUpdate this_ptr_conv;
36461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36462 this_ptr_conv.is_owned = false;
36463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36464 LDKUpdateFee val_conv;
36465 val_conv.inner = (void*)(val & (~1));
36466 val_conv.is_owned = (val & 1) || (val == 0);
36467 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36468 val_conv = UpdateFee_clone(&val_conv);
36469 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
36473 LDKCommitmentUpdate this_ptr_conv;
36474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36475 this_ptr_conv.is_owned = false;
36476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36477 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36490 LDKCommitmentUpdate this_ptr_conv;
36491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36492 this_ptr_conv.is_owned = false;
36493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36494 LDKCommitmentSigned val_conv;
36495 val_conv.inner = (void*)(val & (~1));
36496 val_conv.is_owned = (val & 1) || (val == 0);
36497 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36498 val_conv = CommitmentSigned_clone(&val_conv);
36499 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36502 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) {
36503 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36504 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
36505 if (update_add_htlcs_arg_constr.datalen > 0)
36506 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36508 update_add_htlcs_arg_constr.data = NULL;
36509 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
36510 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36511 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36512 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36513 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
36514 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
36515 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36516 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36517 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36519 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
36520 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36521 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
36522 if (update_fulfill_htlcs_arg_constr.datalen > 0)
36523 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36525 update_fulfill_htlcs_arg_constr.data = NULL;
36526 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
36527 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36528 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36529 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36530 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
36531 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
36532 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36533 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36534 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36536 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
36537 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36538 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
36539 if (update_fail_htlcs_arg_constr.datalen > 0)
36540 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36542 update_fail_htlcs_arg_constr.data = NULL;
36543 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
36544 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36545 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36546 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36547 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
36548 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
36549 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36550 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36551 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36553 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
36554 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36555 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
36556 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36557 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36559 update_fail_malformed_htlcs_arg_constr.data = NULL;
36560 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
36561 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36562 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36563 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36564 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
36565 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);
36566 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36567 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36568 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36570 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
36571 LDKUpdateFee update_fee_arg_conv;
36572 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
36573 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
36574 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36575 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36576 LDKCommitmentSigned commitment_signed_arg_conv;
36577 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
36578 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
36579 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36580 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36581 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);
36582 int64_t ret_ref = 0;
36583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36586 ret_ref = (uintptr_t)ret_var.inner;
36587 if (ret_var.is_owned) {
36593 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36594 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36595 int64_t ret_ref = 0;
36596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36599 ret_ref = (uintptr_t)ret_var.inner;
36600 if (ret_var.is_owned) {
36605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36606 LDKCommitmentUpdate arg_conv;
36607 arg_conv.inner = (void*)(arg & (~1));
36608 arg_conv.is_owned = false;
36609 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36610 int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36615 LDKCommitmentUpdate orig_conv;
36616 orig_conv.inner = (void*)(orig & (~1));
36617 orig_conv.is_owned = false;
36618 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36619 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36620 int64_t ret_ref = 0;
36621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36624 ret_ref = (uintptr_t)ret_var.inner;
36625 if (ret_var.is_owned) {
36631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36632 if ((this_ptr & 1) != 0) return;
36633 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36634 CHECK_ACCESS(this_ptr_ptr);
36635 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36636 FREE((void*)this_ptr);
36637 ChannelMessageHandler_free(this_ptr_conv);
36640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36641 if ((this_ptr & 1) != 0) return;
36642 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36643 CHECK_ACCESS(this_ptr_ptr);
36644 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36645 FREE((void*)this_ptr);
36646 RoutingMessageHandler_free(this_ptr_conv);
36649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36650 LDKAcceptChannel obj_conv;
36651 obj_conv.inner = (void*)(obj & (~1));
36652 obj_conv.is_owned = false;
36653 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36654 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36655 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36656 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36657 CVec_u8Z_free(ret_var);
36661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36662 LDKu8slice ser_ref;
36663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36665 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36666 *ret_conv = AcceptChannel_read(ser_ref);
36667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36668 return (int64_t)ret_conv;
36671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36672 LDKAnnouncementSignatures obj_conv;
36673 obj_conv.inner = (void*)(obj & (~1));
36674 obj_conv.is_owned = false;
36675 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36676 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36677 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36678 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36679 CVec_u8Z_free(ret_var);
36683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36684 LDKu8slice ser_ref;
36685 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36686 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36687 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36688 *ret_conv = AnnouncementSignatures_read(ser_ref);
36689 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36690 return (int64_t)ret_conv;
36693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
36694 LDKChannelReestablish obj_conv;
36695 obj_conv.inner = (void*)(obj & (~1));
36696 obj_conv.is_owned = false;
36697 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36698 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36701 CVec_u8Z_free(ret_var);
36705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36706 LDKu8slice ser_ref;
36707 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36708 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36709 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36710 *ret_conv = ChannelReestablish_read(ser_ref);
36711 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36712 return (int64_t)ret_conv;
36715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36716 LDKClosingSigned obj_conv;
36717 obj_conv.inner = (void*)(obj & (~1));
36718 obj_conv.is_owned = false;
36719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36720 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36723 CVec_u8Z_free(ret_var);
36727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36728 LDKu8slice ser_ref;
36729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36731 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36732 *ret_conv = ClosingSigned_read(ser_ref);
36733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36734 return (int64_t)ret_conv;
36737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36738 LDKClosingSignedFeeRange obj_conv;
36739 obj_conv.inner = (void*)(obj & (~1));
36740 obj_conv.is_owned = false;
36741 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36742 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36743 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36744 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36745 CVec_u8Z_free(ret_var);
36749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36750 LDKu8slice ser_ref;
36751 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36752 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36753 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36754 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36755 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36756 return (int64_t)ret_conv;
36759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36760 LDKCommitmentSigned obj_conv;
36761 obj_conv.inner = (void*)(obj & (~1));
36762 obj_conv.is_owned = false;
36763 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36764 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36767 CVec_u8Z_free(ret_var);
36771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36772 LDKu8slice ser_ref;
36773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36775 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36776 *ret_conv = CommitmentSigned_read(ser_ref);
36777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36778 return (int64_t)ret_conv;
36781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
36782 LDKFundingCreated obj_conv;
36783 obj_conv.inner = (void*)(obj & (~1));
36784 obj_conv.is_owned = false;
36785 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36786 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36787 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36788 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36789 CVec_u8Z_free(ret_var);
36793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36794 LDKu8slice ser_ref;
36795 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36796 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36797 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36798 *ret_conv = FundingCreated_read(ser_ref);
36799 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36800 return (int64_t)ret_conv;
36803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36804 LDKFundingSigned obj_conv;
36805 obj_conv.inner = (void*)(obj & (~1));
36806 obj_conv.is_owned = false;
36807 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36808 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36809 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36810 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36811 CVec_u8Z_free(ret_var);
36815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36816 LDKu8slice ser_ref;
36817 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36818 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36819 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36820 *ret_conv = FundingSigned_read(ser_ref);
36821 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36822 return (int64_t)ret_conv;
36825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
36826 LDKChannelReady obj_conv;
36827 obj_conv.inner = (void*)(obj & (~1));
36828 obj_conv.is_owned = false;
36829 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36830 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36831 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36832 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36833 CVec_u8Z_free(ret_var);
36837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36838 LDKu8slice ser_ref;
36839 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36840 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36841 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36842 *ret_conv = ChannelReady_read(ser_ref);
36843 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36844 return (int64_t)ret_conv;
36847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
36849 obj_conv.inner = (void*)(obj & (~1));
36850 obj_conv.is_owned = false;
36851 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36852 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36853 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36854 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36855 CVec_u8Z_free(ret_var);
36859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36860 LDKu8slice ser_ref;
36861 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36862 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36863 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36864 *ret_conv = Init_read(ser_ref);
36865 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36866 return (int64_t)ret_conv;
36869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36870 LDKOpenChannel obj_conv;
36871 obj_conv.inner = (void*)(obj & (~1));
36872 obj_conv.is_owned = false;
36873 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36874 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36875 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36876 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36877 CVec_u8Z_free(ret_var);
36881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36882 LDKu8slice ser_ref;
36883 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36884 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36885 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36886 *ret_conv = OpenChannel_read(ser_ref);
36887 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36888 return (int64_t)ret_conv;
36891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
36892 LDKRevokeAndACK obj_conv;
36893 obj_conv.inner = (void*)(obj & (~1));
36894 obj_conv.is_owned = false;
36895 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36896 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36897 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36898 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36899 CVec_u8Z_free(ret_var);
36903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36904 LDKu8slice ser_ref;
36905 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36906 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36907 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36908 *ret_conv = RevokeAndACK_read(ser_ref);
36909 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36910 return (int64_t)ret_conv;
36913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
36914 LDKShutdown obj_conv;
36915 obj_conv.inner = (void*)(obj & (~1));
36916 obj_conv.is_owned = false;
36917 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36918 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36919 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36920 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36921 CVec_u8Z_free(ret_var);
36925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36926 LDKu8slice ser_ref;
36927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36929 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36930 *ret_conv = Shutdown_read(ser_ref);
36931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36932 return (int64_t)ret_conv;
36935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36936 LDKUpdateFailHTLC obj_conv;
36937 obj_conv.inner = (void*)(obj & (~1));
36938 obj_conv.is_owned = false;
36939 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36940 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36941 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36942 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36943 CVec_u8Z_free(ret_var);
36947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36948 LDKu8slice ser_ref;
36949 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36950 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36951 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36952 *ret_conv = UpdateFailHTLC_read(ser_ref);
36953 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36954 return (int64_t)ret_conv;
36957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36958 LDKUpdateFailMalformedHTLC obj_conv;
36959 obj_conv.inner = (void*)(obj & (~1));
36960 obj_conv.is_owned = false;
36961 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36962 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36963 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36964 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36965 CVec_u8Z_free(ret_var);
36969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36970 LDKu8slice ser_ref;
36971 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36972 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36973 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36974 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36975 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36976 return (int64_t)ret_conv;
36979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
36980 LDKUpdateFee obj_conv;
36981 obj_conv.inner = (void*)(obj & (~1));
36982 obj_conv.is_owned = false;
36983 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36984 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36985 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36986 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36987 CVec_u8Z_free(ret_var);
36991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36992 LDKu8slice ser_ref;
36993 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36994 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36995 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36996 *ret_conv = UpdateFee_read(ser_ref);
36997 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36998 return (int64_t)ret_conv;
37001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37002 LDKUpdateFulfillHTLC obj_conv;
37003 obj_conv.inner = (void*)(obj & (~1));
37004 obj_conv.is_owned = false;
37005 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37006 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
37007 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37008 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37009 CVec_u8Z_free(ret_var);
37013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37014 LDKu8slice ser_ref;
37015 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37016 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37017 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
37018 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
37019 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37020 return (int64_t)ret_conv;
37023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37024 LDKUpdateAddHTLC obj_conv;
37025 obj_conv.inner = (void*)(obj & (~1));
37026 obj_conv.is_owned = false;
37027 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37028 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
37029 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37030 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37031 CVec_u8Z_free(ret_var);
37035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37036 LDKu8slice ser_ref;
37037 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37038 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37039 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
37040 *ret_conv = UpdateAddHTLC_read(ser_ref);
37041 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37042 return (int64_t)ret_conv;
37045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
37047 obj_conv.inner = (void*)(obj & (~1));
37048 obj_conv.is_owned = false;
37049 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37050 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
37051 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37052 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37053 CVec_u8Z_free(ret_var);
37057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37058 LDKu8slice ser_ref;
37059 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37060 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37061 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
37062 *ret_conv = Ping_read(ser_ref);
37063 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37064 return (int64_t)ret_conv;
37067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
37069 obj_conv.inner = (void*)(obj & (~1));
37070 obj_conv.is_owned = false;
37071 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37072 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
37073 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37074 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37075 CVec_u8Z_free(ret_var);
37079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37080 LDKu8slice ser_ref;
37081 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37082 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37083 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
37084 *ret_conv = Pong_read(ser_ref);
37085 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37086 return (int64_t)ret_conv;
37089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37090 LDKUnsignedChannelAnnouncement obj_conv;
37091 obj_conv.inner = (void*)(obj & (~1));
37092 obj_conv.is_owned = false;
37093 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37094 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
37095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37097 CVec_u8Z_free(ret_var);
37101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37102 LDKu8slice ser_ref;
37103 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37104 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37105 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
37106 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
37107 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37108 return (int64_t)ret_conv;
37111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37112 LDKChannelAnnouncement obj_conv;
37113 obj_conv.inner = (void*)(obj & (~1));
37114 obj_conv.is_owned = false;
37115 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37116 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
37117 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37118 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37119 CVec_u8Z_free(ret_var);
37123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37124 LDKu8slice ser_ref;
37125 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37126 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37127 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
37128 *ret_conv = ChannelAnnouncement_read(ser_ref);
37129 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37130 return (int64_t)ret_conv;
37133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37134 LDKUnsignedChannelUpdate obj_conv;
37135 obj_conv.inner = (void*)(obj & (~1));
37136 obj_conv.is_owned = false;
37137 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37138 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
37139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37141 CVec_u8Z_free(ret_var);
37145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37146 LDKu8slice ser_ref;
37147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37149 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
37150 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
37151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37152 return (int64_t)ret_conv;
37155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37156 LDKChannelUpdate obj_conv;
37157 obj_conv.inner = (void*)(obj & (~1));
37158 obj_conv.is_owned = false;
37159 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37160 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
37161 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37162 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37163 CVec_u8Z_free(ret_var);
37167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37168 LDKu8slice ser_ref;
37169 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37170 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37171 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
37172 *ret_conv = ChannelUpdate_read(ser_ref);
37173 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37174 return (int64_t)ret_conv;
37177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
37178 LDKErrorMessage obj_conv;
37179 obj_conv.inner = (void*)(obj & (~1));
37180 obj_conv.is_owned = false;
37181 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37182 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
37183 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37184 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37185 CVec_u8Z_free(ret_var);
37189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37190 LDKu8slice ser_ref;
37191 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37192 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37193 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
37194 *ret_conv = ErrorMessage_read(ser_ref);
37195 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37196 return (int64_t)ret_conv;
37199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
37200 LDKWarningMessage obj_conv;
37201 obj_conv.inner = (void*)(obj & (~1));
37202 obj_conv.is_owned = false;
37203 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37204 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
37205 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37206 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37207 CVec_u8Z_free(ret_var);
37211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37212 LDKu8slice ser_ref;
37213 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37214 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37215 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
37216 *ret_conv = WarningMessage_read(ser_ref);
37217 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37218 return (int64_t)ret_conv;
37221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37222 LDKUnsignedNodeAnnouncement obj_conv;
37223 obj_conv.inner = (void*)(obj & (~1));
37224 obj_conv.is_owned = false;
37225 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37226 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
37227 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37228 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37229 CVec_u8Z_free(ret_var);
37233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37234 LDKu8slice ser_ref;
37235 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37236 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37237 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
37238 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
37239 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37240 return (int64_t)ret_conv;
37243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37244 LDKNodeAnnouncement obj_conv;
37245 obj_conv.inner = (void*)(obj & (~1));
37246 obj_conv.is_owned = false;
37247 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37248 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
37249 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37250 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37251 CVec_u8Z_free(ret_var);
37255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37256 LDKu8slice ser_ref;
37257 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37258 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37259 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
37260 *ret_conv = NodeAnnouncement_read(ser_ref);
37261 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37262 return (int64_t)ret_conv;
37265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37266 LDKu8slice ser_ref;
37267 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37268 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37269 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
37270 *ret_conv = QueryShortChannelIds_read(ser_ref);
37271 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37272 return (int64_t)ret_conv;
37275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
37276 LDKQueryShortChannelIds obj_conv;
37277 obj_conv.inner = (void*)(obj & (~1));
37278 obj_conv.is_owned = false;
37279 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37280 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
37281 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37282 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37283 CVec_u8Z_free(ret_var);
37287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
37288 LDKReplyShortChannelIdsEnd obj_conv;
37289 obj_conv.inner = (void*)(obj & (~1));
37290 obj_conv.is_owned = false;
37291 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37292 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
37293 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37294 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37295 CVec_u8Z_free(ret_var);
37299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37300 LDKu8slice ser_ref;
37301 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37302 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37303 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
37304 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
37305 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37306 return (int64_t)ret_conv;
37309 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
37310 LDKQueryChannelRange this_arg_conv;
37311 this_arg_conv.inner = (void*)(this_arg & (~1));
37312 this_arg_conv.is_owned = false;
37313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37314 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
37318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
37319 LDKQueryChannelRange obj_conv;
37320 obj_conv.inner = (void*)(obj & (~1));
37321 obj_conv.is_owned = false;
37322 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37323 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
37324 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37325 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37326 CVec_u8Z_free(ret_var);
37330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37331 LDKu8slice ser_ref;
37332 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37333 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37334 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
37335 *ret_conv = QueryChannelRange_read(ser_ref);
37336 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37337 return (int64_t)ret_conv;
37340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37341 LDKu8slice ser_ref;
37342 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37343 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37344 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
37345 *ret_conv = ReplyChannelRange_read(ser_ref);
37346 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37347 return (int64_t)ret_conv;
37350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
37351 LDKReplyChannelRange obj_conv;
37352 obj_conv.inner = (void*)(obj & (~1));
37353 obj_conv.is_owned = false;
37354 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37355 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
37356 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37357 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37358 CVec_u8Z_free(ret_var);
37362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
37363 LDKGossipTimestampFilter obj_conv;
37364 obj_conv.inner = (void*)(obj & (~1));
37365 obj_conv.is_owned = false;
37366 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37367 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37368 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37369 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37370 CVec_u8Z_free(ret_var);
37374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37375 LDKu8slice ser_ref;
37376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37378 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37379 *ret_conv = GossipTimestampFilter_read(ser_ref);
37380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37381 return (int64_t)ret_conv;
37384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37385 if ((this_ptr & 1) != 0) return;
37386 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37387 CHECK_ACCESS(this_ptr_ptr);
37388 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37389 FREE((void*)this_ptr);
37390 CustomMessageHandler_free(this_ptr_conv);
37393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37394 LDKIgnoringMessageHandler this_obj_conv;
37395 this_obj_conv.inner = (void*)(this_obj & (~1));
37396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37398 IgnoringMessageHandler_free(this_obj_conv);
37401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
37402 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37403 int64_t ret_ref = 0;
37404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37407 ret_ref = (uintptr_t)ret_var.inner;
37408 if (ret_var.is_owned) {
37414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37415 LDKIgnoringMessageHandler this_arg_conv;
37416 this_arg_conv.inner = (void*)(this_arg & (~1));
37417 this_arg_conv.is_owned = false;
37418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37419 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37420 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37421 return (int64_t)ret_ret;
37424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37425 LDKIgnoringMessageHandler this_arg_conv;
37426 this_arg_conv.inner = (void*)(this_arg & (~1));
37427 this_arg_conv.is_owned = false;
37428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37429 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37430 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37431 return (int64_t)ret_ret;
37434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
37435 LDKIgnoringMessageHandler this_arg_conv;
37436 this_arg_conv.inner = (void*)(this_arg & (~1));
37437 this_arg_conv.is_owned = false;
37438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37439 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37440 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37441 return (int64_t)ret_ret;
37444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37445 LDKIgnoringMessageHandler this_arg_conv;
37446 this_arg_conv.inner = (void*)(this_arg & (~1));
37447 this_arg_conv.is_owned = false;
37448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37449 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37450 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37451 return (int64_t)ret_ret;
37454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37455 LDKErroringMessageHandler this_obj_conv;
37456 this_obj_conv.inner = (void*)(this_obj & (~1));
37457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37459 ErroringMessageHandler_free(this_obj_conv);
37462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
37463 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
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 int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37476 LDKErroringMessageHandler this_arg_conv;
37477 this_arg_conv.inner = (void*)(this_arg & (~1));
37478 this_arg_conv.is_owned = false;
37479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37480 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37481 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37482 return (int64_t)ret_ret;
37485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37486 LDKErroringMessageHandler this_arg_conv;
37487 this_arg_conv.inner = (void*)(this_arg & (~1));
37488 this_arg_conv.is_owned = false;
37489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37490 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37491 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37492 return (int64_t)ret_ret;
37495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37496 LDKMessageHandler this_obj_conv;
37497 this_obj_conv.inner = (void*)(this_obj & (~1));
37498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37500 MessageHandler_free(this_obj_conv);
37503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
37504 LDKMessageHandler this_ptr_conv;
37505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37506 this_ptr_conv.is_owned = false;
37507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37508 // WARNING: This object doesn't live past this scope, needs clone!
37509 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
37513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37514 LDKMessageHandler this_ptr_conv;
37515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37516 this_ptr_conv.is_owned = false;
37517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37518 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37519 CHECK_ACCESS(val_ptr);
37520 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37521 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37522 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37523 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37525 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
37529 LDKMessageHandler this_ptr_conv;
37530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37531 this_ptr_conv.is_owned = false;
37532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37533 // WARNING: This object doesn't live past this scope, needs clone!
37534 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
37538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37539 LDKMessageHandler this_ptr_conv;
37540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37541 this_ptr_conv.is_owned = false;
37542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37543 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37544 CHECK_ACCESS(val_ptr);
37545 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37546 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37547 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37548 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37550 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37553 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) {
37554 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
37555 CHECK_ACCESS(chan_handler_arg_ptr);
37556 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37557 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37558 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37559 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37561 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
37562 CHECK_ACCESS(route_handler_arg_ptr);
37563 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37564 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37565 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37566 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37568 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
37569 int64_t ret_ref = 0;
37570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37573 ret_ref = (uintptr_t)ret_var.inner;
37574 if (ret_var.is_owned) {
37580 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37581 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37582 *ret_ret = SocketDescriptor_clone(arg);
37583 return (int64_t)ret_ret;
37585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37586 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37587 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37588 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37589 int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37594 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
37595 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
37596 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37597 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37598 *ret_ret = SocketDescriptor_clone(orig_conv);
37599 return (int64_t)ret_ret;
37602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37603 if ((this_ptr & 1) != 0) return;
37604 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37605 CHECK_ACCESS(this_ptr_ptr);
37606 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37607 FREE((void*)this_ptr);
37608 SocketDescriptor_free(this_ptr_conv);
37611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37612 LDKPeerHandleError this_obj_conv;
37613 this_obj_conv.inner = (void*)(this_obj & (~1));
37614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37616 PeerHandleError_free(this_obj_conv);
37619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
37620 LDKPeerHandleError this_ptr_conv;
37621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37622 this_ptr_conv.is_owned = false;
37623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37624 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
37628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37629 LDKPeerHandleError this_ptr_conv;
37630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37631 this_ptr_conv.is_owned = false;
37632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37633 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
37636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
37637 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
37638 int64_t ret_ref = 0;
37639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37642 ret_ref = (uintptr_t)ret_var.inner;
37643 if (ret_var.is_owned) {
37649 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37650 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37651 int64_t ret_ref = 0;
37652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37655 ret_ref = (uintptr_t)ret_var.inner;
37656 if (ret_var.is_owned) {
37661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37662 LDKPeerHandleError arg_conv;
37663 arg_conv.inner = (void*)(arg & (~1));
37664 arg_conv.is_owned = false;
37665 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37666 int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37671 LDKPeerHandleError orig_conv;
37672 orig_conv.inner = (void*)(orig & (~1));
37673 orig_conv.is_owned = false;
37674 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37675 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37676 int64_t ret_ref = 0;
37677 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37678 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37680 ret_ref = (uintptr_t)ret_var.inner;
37681 if (ret_var.is_owned) {
37687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37688 LDKPeerManager this_obj_conv;
37689 this_obj_conv.inner = (void*)(this_obj & (~1));
37690 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37692 PeerManager_free(this_obj_conv);
37695 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) {
37696 LDKMessageHandler message_handler_conv;
37697 message_handler_conv.inner = (void*)(message_handler & (~1));
37698 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
37699 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37700 // WARNING: we need a move here but no clone is available for LDKMessageHandler
37701 LDKSecretKey our_node_secret_ref;
37702 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
37703 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
37704 unsigned char ephemeral_random_data_arr[32];
37705 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
37706 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
37707 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37708 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
37709 CHECK_ACCESS(logger_ptr);
37710 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37711 if (logger_conv.free == LDKLogger_JCalls_free) {
37712 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37713 LDKLogger_JCalls_cloned(&logger_conv);
37715 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
37716 CHECK_ACCESS(custom_message_handler_ptr);
37717 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37718 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37719 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37720 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37722 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
37723 int64_t ret_ref = 0;
37724 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37725 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37727 ret_ref = (uintptr_t)ret_var.inner;
37728 if (ret_var.is_owned) {
37734 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
37735 LDKPeerManager this_arg_conv;
37736 this_arg_conv.inner = (void*)(this_arg & (~1));
37737 this_arg_conv.is_owned = false;
37738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37739 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37740 jobjectArray ret_arr = NULL;
37741 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37743 for (size_t i = 0; i < ret_var.datalen; i++) {
37744 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
37745 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
37746 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
37749 FREE(ret_var.data);
37753 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) {
37754 LDKPeerManager this_arg_conv;
37755 this_arg_conv.inner = (void*)(this_arg & (~1));
37756 this_arg_conv.is_owned = false;
37757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37758 LDKPublicKey their_node_id_ref;
37759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
37760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
37761 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37762 CHECK_ACCESS(descriptor_ptr);
37763 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37764 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37765 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37766 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37768 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
37769 CHECK_ACCESS(remote_network_address_ptr);
37770 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37771 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37772 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37773 return (int64_t)ret_conv;
37776 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) {
37777 LDKPeerManager this_arg_conv;
37778 this_arg_conv.inner = (void*)(this_arg & (~1));
37779 this_arg_conv.is_owned = false;
37780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37781 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37782 CHECK_ACCESS(descriptor_ptr);
37783 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37784 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37785 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37786 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37788 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
37789 CHECK_ACCESS(remote_network_address_ptr);
37790 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37791 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37792 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37793 return (int64_t)ret_conv;
37796 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) {
37797 LDKPeerManager this_arg_conv;
37798 this_arg_conv.inner = (void*)(this_arg & (~1));
37799 this_arg_conv.is_owned = false;
37800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37801 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37802 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
37803 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37804 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37805 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37806 return (int64_t)ret_conv;
37809 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) {
37810 LDKPeerManager this_arg_conv;
37811 this_arg_conv.inner = (void*)(this_arg & (~1));
37812 this_arg_conv.is_owned = false;
37813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37814 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
37815 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
37816 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37817 LDKu8slice data_ref;
37818 data_ref.datalen = (*env)->GetArrayLength(env, data);
37819 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
37820 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37821 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37822 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
37823 return (int64_t)ret_conv;
37826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37827 LDKPeerManager this_arg_conv;
37828 this_arg_conv.inner = (void*)(this_arg & (~1));
37829 this_arg_conv.is_owned = false;
37830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37831 PeerManager_process_events(&this_arg_conv);
37834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
37835 LDKPeerManager this_arg_conv;
37836 this_arg_conv.inner = (void*)(this_arg & (~1));
37837 this_arg_conv.is_owned = false;
37838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37839 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37840 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
37841 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37842 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37845 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) {
37846 LDKPeerManager this_arg_conv;
37847 this_arg_conv.inner = (void*)(this_arg & (~1));
37848 this_arg_conv.is_owned = false;
37849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37850 LDKPublicKey node_id_ref;
37851 CHECK((*env)->GetArrayLength(env, node_id) == 33);
37852 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37853 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
37856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
37857 LDKPeerManager this_arg_conv;
37858 this_arg_conv.inner = (void*)(this_arg & (~1));
37859 this_arg_conv.is_owned = false;
37860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37861 PeerManager_disconnect_all_peers(&this_arg_conv);
37864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
37865 LDKPeerManager this_arg_conv;
37866 this_arg_conv.inner = (void*)(this_arg & (~1));
37867 this_arg_conv.is_owned = false;
37868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37869 PeerManager_timer_tick_occurred(&this_arg_conv);
37872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37873 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37878 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
37883 unsigned char commitment_seed_arr[32];
37884 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
37885 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
37886 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37887 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
37892 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) {
37893 LDKCVec_u8Z to_holder_script_ref;
37894 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37895 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37896 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37897 LDKCVec_u8Z to_counterparty_script_ref;
37898 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37899 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37900 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37901 LDKOutPoint funding_outpoint_conv;
37902 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37903 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37904 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37905 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37906 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);
37907 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37908 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37909 Transaction_free(ret_var);
37913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37914 LDKCounterpartyCommitmentSecrets this_obj_conv;
37915 this_obj_conv.inner = (void*)(this_obj & (~1));
37916 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37918 CounterpartyCommitmentSecrets_free(this_obj_conv);
37921 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37922 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37923 int64_t ret_ref = 0;
37924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37927 ret_ref = (uintptr_t)ret_var.inner;
37928 if (ret_var.is_owned) {
37933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37934 LDKCounterpartyCommitmentSecrets arg_conv;
37935 arg_conv.inner = (void*)(arg & (~1));
37936 arg_conv.is_owned = false;
37937 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37938 int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37943 LDKCounterpartyCommitmentSecrets orig_conv;
37944 orig_conv.inner = (void*)(orig & (~1));
37945 orig_conv.is_owned = false;
37946 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37947 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37948 int64_t ret_ref = 0;
37949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37952 ret_ref = (uintptr_t)ret_var.inner;
37953 if (ret_var.is_owned) {
37959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
37960 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37961 int64_t ret_ref = 0;
37962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37965 ret_ref = (uintptr_t)ret_var.inner;
37966 if (ret_var.is_owned) {
37972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
37973 LDKCounterpartyCommitmentSecrets this_arg_conv;
37974 this_arg_conv.inner = (void*)(this_arg & (~1));
37975 this_arg_conv.is_owned = false;
37976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37977 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37981 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) {
37982 LDKCounterpartyCommitmentSecrets this_arg_conv;
37983 this_arg_conv.inner = (void*)(this_arg & (~1));
37984 this_arg_conv.is_owned = false;
37985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37986 LDKThirtyTwoBytes secret_ref;
37987 CHECK((*env)->GetArrayLength(env, secret) == 32);
37988 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
37989 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37990 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37991 return (int64_t)ret_conv;
37994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
37995 LDKCounterpartyCommitmentSecrets this_arg_conv;
37996 this_arg_conv.inner = (void*)(this_arg & (~1));
37997 this_arg_conv.is_owned = false;
37998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37999 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
38004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
38005 LDKCounterpartyCommitmentSecrets obj_conv;
38006 obj_conv.inner = (void*)(obj & (~1));
38007 obj_conv.is_owned = false;
38008 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38009 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
38010 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38011 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38012 CVec_u8Z_free(ret_var);
38016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38017 LDKu8slice ser_ref;
38018 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38019 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38020 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
38021 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
38022 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38023 return (int64_t)ret_conv;
38026 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) {
38027 LDKPublicKey per_commitment_point_ref;
38028 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38029 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38030 unsigned char base_secret_arr[32];
38031 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
38032 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
38033 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
38034 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38035 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
38036 return (int64_t)ret_conv;
38039 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) {
38040 LDKPublicKey per_commitment_point_ref;
38041 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38042 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38043 LDKPublicKey base_point_ref;
38044 CHECK((*env)->GetArrayLength(env, base_point) == 33);
38045 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
38046 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38047 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
38048 return (int64_t)ret_conv;
38051 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) {
38052 unsigned char per_commitment_secret_arr[32];
38053 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
38054 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
38055 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
38056 unsigned char countersignatory_revocation_base_secret_arr[32];
38057 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
38058 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
38059 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
38060 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38061 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
38062 return (int64_t)ret_conv;
38065 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) {
38066 LDKPublicKey per_commitment_point_ref;
38067 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38068 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38069 LDKPublicKey countersignatory_revocation_base_point_ref;
38070 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
38071 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
38072 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38073 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
38074 return (int64_t)ret_conv;
38077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38078 LDKTxCreationKeys this_obj_conv;
38079 this_obj_conv.inner = (void*)(this_obj & (~1));
38080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38082 TxCreationKeys_free(this_obj_conv);
38085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
38086 LDKTxCreationKeys this_ptr_conv;
38087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38088 this_ptr_conv.is_owned = false;
38089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38090 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
38095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38096 LDKTxCreationKeys this_ptr_conv;
38097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38098 this_ptr_conv.is_owned = false;
38099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38100 LDKPublicKey val_ref;
38101 CHECK((*env)->GetArrayLength(env, val) == 33);
38102 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38103 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
38106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38107 LDKTxCreationKeys this_ptr_conv;
38108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38109 this_ptr_conv.is_owned = false;
38110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38111 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38112 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
38116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38117 LDKTxCreationKeys this_ptr_conv;
38118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38119 this_ptr_conv.is_owned = false;
38120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38121 LDKPublicKey val_ref;
38122 CHECK((*env)->GetArrayLength(env, val) == 33);
38123 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38124 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38128 LDKTxCreationKeys this_ptr_conv;
38129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38130 this_ptr_conv.is_owned = false;
38131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38132 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38133 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
38137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38138 LDKTxCreationKeys this_ptr_conv;
38139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38140 this_ptr_conv.is_owned = false;
38141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38142 LDKPublicKey val_ref;
38143 CHECK((*env)->GetArrayLength(env, val) == 33);
38144 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38145 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38149 LDKTxCreationKeys this_ptr_conv;
38150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38151 this_ptr_conv.is_owned = false;
38152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38153 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38154 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
38158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38159 LDKTxCreationKeys this_ptr_conv;
38160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38161 this_ptr_conv.is_owned = false;
38162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38163 LDKPublicKey val_ref;
38164 CHECK((*env)->GetArrayLength(env, val) == 33);
38165 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38166 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
38169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38170 LDKTxCreationKeys this_ptr_conv;
38171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38172 this_ptr_conv.is_owned = false;
38173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38174 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
38179 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) {
38180 LDKTxCreationKeys this_ptr_conv;
38181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38182 this_ptr_conv.is_owned = false;
38183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38184 LDKPublicKey val_ref;
38185 CHECK((*env)->GetArrayLength(env, val) == 33);
38186 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38187 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
38190 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) {
38191 LDKPublicKey per_commitment_point_arg_ref;
38192 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
38193 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
38194 LDKPublicKey revocation_key_arg_ref;
38195 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
38196 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
38197 LDKPublicKey broadcaster_htlc_key_arg_ref;
38198 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
38199 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
38200 LDKPublicKey countersignatory_htlc_key_arg_ref;
38201 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
38202 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
38203 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
38204 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
38205 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
38206 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);
38207 int64_t ret_ref = 0;
38208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38211 ret_ref = (uintptr_t)ret_var.inner;
38212 if (ret_var.is_owned) {
38218 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
38219 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
38220 int64_t ret_ref = 0;
38221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38224 ret_ref = (uintptr_t)ret_var.inner;
38225 if (ret_var.is_owned) {
38230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38231 LDKTxCreationKeys arg_conv;
38232 arg_conv.inner = (void*)(arg & (~1));
38233 arg_conv.is_owned = false;
38234 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38235 int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
38239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38240 LDKTxCreationKeys orig_conv;
38241 orig_conv.inner = (void*)(orig & (~1));
38242 orig_conv.is_owned = false;
38243 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38244 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
38245 int64_t ret_ref = 0;
38246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38249 ret_ref = (uintptr_t)ret_var.inner;
38250 if (ret_var.is_owned) {
38256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
38257 LDKTxCreationKeys obj_conv;
38258 obj_conv.inner = (void*)(obj & (~1));
38259 obj_conv.is_owned = false;
38260 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38261 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
38262 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38263 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38264 CVec_u8Z_free(ret_var);
38268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38269 LDKu8slice ser_ref;
38270 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38271 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38272 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
38273 *ret_conv = TxCreationKeys_read(ser_ref);
38274 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38275 return (int64_t)ret_conv;
38278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38279 LDKChannelPublicKeys this_obj_conv;
38280 this_obj_conv.inner = (void*)(this_obj & (~1));
38281 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38283 ChannelPublicKeys_free(this_obj_conv);
38286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
38287 LDKChannelPublicKeys this_ptr_conv;
38288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38289 this_ptr_conv.is_owned = false;
38290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38291 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38292 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
38296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38297 LDKChannelPublicKeys this_ptr_conv;
38298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38299 this_ptr_conv.is_owned = false;
38300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38301 LDKPublicKey val_ref;
38302 CHECK((*env)->GetArrayLength(env, val) == 33);
38303 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38304 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
38307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38308 LDKChannelPublicKeys this_ptr_conv;
38309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38310 this_ptr_conv.is_owned = false;
38311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38312 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38313 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
38317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38318 LDKChannelPublicKeys this_ptr_conv;
38319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38320 this_ptr_conv.is_owned = false;
38321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38322 LDKPublicKey val_ref;
38323 CHECK((*env)->GetArrayLength(env, val) == 33);
38324 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38325 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
38328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
38329 LDKChannelPublicKeys this_ptr_conv;
38330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38331 this_ptr_conv.is_owned = false;
38332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38333 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
38338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38339 LDKChannelPublicKeys this_ptr_conv;
38340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38341 this_ptr_conv.is_owned = false;
38342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38343 LDKPublicKey val_ref;
38344 CHECK((*env)->GetArrayLength(env, val) == 33);
38345 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38346 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
38349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38350 LDKChannelPublicKeys this_ptr_conv;
38351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38352 this_ptr_conv.is_owned = false;
38353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38354 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
38359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38360 LDKChannelPublicKeys this_ptr_conv;
38361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38362 this_ptr_conv.is_owned = false;
38363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38364 LDKPublicKey val_ref;
38365 CHECK((*env)->GetArrayLength(env, val) == 33);
38366 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38367 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38371 LDKChannelPublicKeys this_ptr_conv;
38372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38373 this_ptr_conv.is_owned = false;
38374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38375 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
38380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38381 LDKChannelPublicKeys this_ptr_conv;
38382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38383 this_ptr_conv.is_owned = false;
38384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38385 LDKPublicKey val_ref;
38386 CHECK((*env)->GetArrayLength(env, val) == 33);
38387 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38388 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38391 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) {
38392 LDKPublicKey funding_pubkey_arg_ref;
38393 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
38394 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
38395 LDKPublicKey revocation_basepoint_arg_ref;
38396 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
38397 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
38398 LDKPublicKey payment_point_arg_ref;
38399 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
38400 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
38401 LDKPublicKey delayed_payment_basepoint_arg_ref;
38402 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
38403 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
38404 LDKPublicKey htlc_basepoint_arg_ref;
38405 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
38406 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
38407 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);
38408 int64_t ret_ref = 0;
38409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38412 ret_ref = (uintptr_t)ret_var.inner;
38413 if (ret_var.is_owned) {
38419 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38420 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38421 int64_t ret_ref = 0;
38422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38425 ret_ref = (uintptr_t)ret_var.inner;
38426 if (ret_var.is_owned) {
38431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38432 LDKChannelPublicKeys arg_conv;
38433 arg_conv.inner = (void*)(arg & (~1));
38434 arg_conv.is_owned = false;
38435 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38436 int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38441 LDKChannelPublicKeys orig_conv;
38442 orig_conv.inner = (void*)(orig & (~1));
38443 orig_conv.is_owned = false;
38444 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38445 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38446 int64_t ret_ref = 0;
38447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38450 ret_ref = (uintptr_t)ret_var.inner;
38451 if (ret_var.is_owned) {
38457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
38458 LDKChannelPublicKeys obj_conv;
38459 obj_conv.inner = (void*)(obj & (~1));
38460 obj_conv.is_owned = false;
38461 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38462 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38465 CVec_u8Z_free(ret_var);
38469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38470 LDKu8slice ser_ref;
38471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38473 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38474 *ret_conv = ChannelPublicKeys_read(ser_ref);
38475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38476 return (int64_t)ret_conv;
38479 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) {
38480 LDKPublicKey per_commitment_point_ref;
38481 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38482 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38483 LDKPublicKey broadcaster_delayed_payment_base_ref;
38484 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
38485 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
38486 LDKPublicKey broadcaster_htlc_base_ref;
38487 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
38488 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
38489 LDKPublicKey countersignatory_revocation_base_ref;
38490 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
38491 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
38492 LDKPublicKey countersignatory_htlc_base_ref;
38493 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
38494 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
38495 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
38496 *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);
38497 return (int64_t)ret_conv;
38500 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) {
38501 LDKPublicKey per_commitment_point_ref;
38502 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38503 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38504 LDKChannelPublicKeys broadcaster_keys_conv;
38505 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
38506 broadcaster_keys_conv.is_owned = false;
38507 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38508 LDKChannelPublicKeys countersignatory_keys_conv;
38509 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
38510 countersignatory_keys_conv.is_owned = false;
38511 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38512 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
38513 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38514 return (int64_t)ret_conv;
38517 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) {
38518 LDKPublicKey revocation_key_ref;
38519 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38520 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38521 LDKPublicKey broadcaster_delayed_payment_key_ref;
38522 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38523 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38524 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38525 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38526 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38527 CVec_u8Z_free(ret_var);
38531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38532 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_free(this_obj_conv);
38539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
38540 LDKHTLCOutputInCommitment this_ptr_conv;
38541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38542 this_ptr_conv.is_owned = false;
38543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38544 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38549 LDKHTLCOutputInCommitment this_ptr_conv;
38550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38551 this_ptr_conv.is_owned = false;
38552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38553 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38557 LDKHTLCOutputInCommitment this_ptr_conv;
38558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38559 this_ptr_conv.is_owned = false;
38560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38561 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38566 LDKHTLCOutputInCommitment this_ptr_conv;
38567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38568 this_ptr_conv.is_owned = false;
38569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38570 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38573 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
38574 LDKHTLCOutputInCommitment this_ptr_conv;
38575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38576 this_ptr_conv.is_owned = false;
38577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38578 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38583 LDKHTLCOutputInCommitment this_ptr_conv;
38584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38585 this_ptr_conv.is_owned = false;
38586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38587 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
38591 LDKHTLCOutputInCommitment this_ptr_conv;
38592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38593 this_ptr_conv.is_owned = false;
38594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38595 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38596 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
38600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38601 LDKHTLCOutputInCommitment this_ptr_conv;
38602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38603 this_ptr_conv.is_owned = false;
38604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38605 LDKThirtyTwoBytes val_ref;
38606 CHECK((*env)->GetArrayLength(env, val) == 32);
38607 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38608 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38612 LDKHTLCOutputInCommitment this_ptr_conv;
38613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38614 this_ptr_conv.is_owned = false;
38615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38616 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38617 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38618 int64_t ret_ref = (uintptr_t)ret_copy;
38622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38623 LDKHTLCOutputInCommitment this_ptr_conv;
38624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38625 this_ptr_conv.is_owned = false;
38626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38627 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38628 CHECK_ACCESS(val_ptr);
38629 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38630 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
38631 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38634 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) {
38635 LDKThirtyTwoBytes payment_hash_arg_ref;
38636 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
38637 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
38638 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
38639 CHECK_ACCESS(transaction_output_index_arg_ptr);
38640 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38641 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
38642 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38643 int64_t ret_ref = 0;
38644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38647 ret_ref = (uintptr_t)ret_var.inner;
38648 if (ret_var.is_owned) {
38654 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38655 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38656 int64_t ret_ref = 0;
38657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38660 ret_ref = (uintptr_t)ret_var.inner;
38661 if (ret_var.is_owned) {
38666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38667 LDKHTLCOutputInCommitment arg_conv;
38668 arg_conv.inner = (void*)(arg & (~1));
38669 arg_conv.is_owned = false;
38670 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38671 int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38676 LDKHTLCOutputInCommitment orig_conv;
38677 orig_conv.inner = (void*)(orig & (~1));
38678 orig_conv.is_owned = false;
38679 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38680 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38681 int64_t ret_ref = 0;
38682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38685 ret_ref = (uintptr_t)ret_var.inner;
38686 if (ret_var.is_owned) {
38692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
38693 LDKHTLCOutputInCommitment obj_conv;
38694 obj_conv.inner = (void*)(obj & (~1));
38695 obj_conv.is_owned = false;
38696 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38697 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38700 CVec_u8Z_free(ret_var);
38704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38705 LDKu8slice ser_ref;
38706 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38707 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38708 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38709 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38711 return (int64_t)ret_conv;
38714 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) {
38715 LDKHTLCOutputInCommitment htlc_conv;
38716 htlc_conv.inner = (void*)(htlc & (~1));
38717 htlc_conv.is_owned = false;
38718 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38719 LDKTxCreationKeys keys_conv;
38720 keys_conv.inner = (void*)(keys & (~1));
38721 keys_conv.is_owned = false;
38722 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38723 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38724 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38725 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38726 CVec_u8Z_free(ret_var);
38730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
38731 LDKPublicKey broadcaster_ref;
38732 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
38733 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
38734 LDKPublicKey countersignatory_ref;
38735 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
38736 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
38737 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38738 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38739 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38740 CVec_u8Z_free(ret_var);
38744 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) {
38745 unsigned char commitment_txid_arr[32];
38746 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
38747 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
38748 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
38749 LDKHTLCOutputInCommitment htlc_conv;
38750 htlc_conv.inner = (void*)(htlc & (~1));
38751 htlc_conv.is_owned = false;
38752 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38753 LDKPublicKey broadcaster_delayed_payment_key_ref;
38754 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38755 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38756 LDKPublicKey revocation_key_ref;
38757 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38758 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38759 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);
38760 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38761 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38762 Transaction_free(ret_var);
38766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
38767 LDKPublicKey funding_pubkey_ref;
38768 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
38769 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
38770 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38771 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38772 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38773 CVec_u8Z_free(ret_var);
38777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38778 LDKChannelTransactionParameters this_obj_conv;
38779 this_obj_conv.inner = (void*)(this_obj & (~1));
38780 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38782 ChannelTransactionParameters_free(this_obj_conv);
38785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38786 LDKChannelTransactionParameters this_ptr_conv;
38787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38788 this_ptr_conv.is_owned = false;
38789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38790 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38791 int64_t ret_ref = 0;
38792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38795 ret_ref = (uintptr_t)ret_var.inner;
38796 if (ret_var.is_owned) {
38802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38803 LDKChannelTransactionParameters this_ptr_conv;
38804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38805 this_ptr_conv.is_owned = false;
38806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38807 LDKChannelPublicKeys val_conv;
38808 val_conv.inner = (void*)(val & (~1));
38809 val_conv.is_owned = (val & 1) || (val == 0);
38810 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38811 val_conv = ChannelPublicKeys_clone(&val_conv);
38812 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38815 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38816 LDKChannelTransactionParameters this_ptr_conv;
38817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38818 this_ptr_conv.is_owned = false;
38819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38820 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38824 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) {
38825 LDKChannelTransactionParameters this_ptr_conv;
38826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38827 this_ptr_conv.is_owned = false;
38828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38829 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
38833 LDKChannelTransactionParameters this_ptr_conv;
38834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38835 this_ptr_conv.is_owned = false;
38836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38837 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38842 LDKChannelTransactionParameters this_ptr_conv;
38843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38844 this_ptr_conv.is_owned = false;
38845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38846 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
38850 LDKChannelTransactionParameters this_ptr_conv;
38851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38852 this_ptr_conv.is_owned = false;
38853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38854 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38855 int64_t ret_ref = 0;
38856 if ((uintptr_t)ret_var.inner > 4096) {
38857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38860 ret_ref = (uintptr_t)ret_var.inner;
38861 if (ret_var.is_owned) {
38868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38869 LDKChannelTransactionParameters this_ptr_conv;
38870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38871 this_ptr_conv.is_owned = false;
38872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38873 LDKCounterpartyChannelTransactionParameters val_conv;
38874 val_conv.inner = (void*)(val & (~1));
38875 val_conv.is_owned = (val & 1) || (val == 0);
38876 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38877 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38878 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38882 LDKChannelTransactionParameters this_ptr_conv;
38883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38884 this_ptr_conv.is_owned = false;
38885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38886 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38887 int64_t ret_ref = 0;
38888 if ((uintptr_t)ret_var.inner > 4096) {
38889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38892 ret_ref = (uintptr_t)ret_var.inner;
38893 if (ret_var.is_owned) {
38900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38901 LDKChannelTransactionParameters this_ptr_conv;
38902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38903 this_ptr_conv.is_owned = false;
38904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38905 LDKOutPoint val_conv;
38906 val_conv.inner = (void*)(val & (~1));
38907 val_conv.is_owned = (val & 1) || (val == 0);
38908 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38909 val_conv = OutPoint_clone(&val_conv);
38910 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38913 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
38914 LDKChannelTransactionParameters this_ptr_conv;
38915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38916 this_ptr_conv.is_owned = false;
38917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38918 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38923 LDKChannelTransactionParameters this_ptr_conv;
38924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38925 this_ptr_conv.is_owned = false;
38926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38927 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
38928 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38931 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) {
38932 LDKChannelPublicKeys holder_pubkeys_arg_conv;
38933 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
38934 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
38935 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38936 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38937 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38938 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
38939 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
38940 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38941 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38942 LDKOutPoint funding_outpoint_arg_conv;
38943 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
38944 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
38945 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38946 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38947 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
38948 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);
38949 int64_t ret_ref = 0;
38950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38953 ret_ref = (uintptr_t)ret_var.inner;
38954 if (ret_var.is_owned) {
38960 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38961 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38962 int64_t ret_ref = 0;
38963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38966 ret_ref = (uintptr_t)ret_var.inner;
38967 if (ret_var.is_owned) {
38972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38973 LDKChannelTransactionParameters arg_conv;
38974 arg_conv.inner = (void*)(arg & (~1));
38975 arg_conv.is_owned = false;
38976 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38977 int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38982 LDKChannelTransactionParameters orig_conv;
38983 orig_conv.inner = (void*)(orig & (~1));
38984 orig_conv.is_owned = false;
38985 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38986 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38987 int64_t ret_ref = 0;
38988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38991 ret_ref = (uintptr_t)ret_var.inner;
38992 if (ret_var.is_owned) {
38998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38999 LDKCounterpartyChannelTransactionParameters this_obj_conv;
39000 this_obj_conv.inner = (void*)(this_obj & (~1));
39001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39003 CounterpartyChannelTransactionParameters_free(this_obj_conv);
39006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
39007 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39009 this_ptr_conv.is_owned = false;
39010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39011 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39012 int64_t ret_ref = 0;
39013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39016 ret_ref = (uintptr_t)ret_var.inner;
39017 if (ret_var.is_owned) {
39023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39024 LDKCounterpartyChannelTransactionParameters 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 LDKChannelPublicKeys val_conv;
39029 val_conv.inner = (void*)(val & (~1));
39030 val_conv.is_owned = (val & 1) || (val == 0);
39031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39032 val_conv = ChannelPublicKeys_clone(&val_conv);
39033 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39036 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39037 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39039 this_ptr_conv.is_owned = false;
39040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39041 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39046 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39048 this_ptr_conv.is_owned = false;
39049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39050 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39053 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) {
39054 LDKChannelPublicKeys pubkeys_arg_conv;
39055 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
39056 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
39057 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39058 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39059 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39060 int64_t ret_ref = 0;
39061 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39062 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39064 ret_ref = (uintptr_t)ret_var.inner;
39065 if (ret_var.is_owned) {
39071 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39072 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39073 int64_t ret_ref = 0;
39074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39077 ret_ref = (uintptr_t)ret_var.inner;
39078 if (ret_var.is_owned) {
39083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39084 LDKCounterpartyChannelTransactionParameters arg_conv;
39085 arg_conv.inner = (void*)(arg & (~1));
39086 arg_conv.is_owned = false;
39087 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39088 int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39093 LDKCounterpartyChannelTransactionParameters orig_conv;
39094 orig_conv.inner = (void*)(orig & (~1));
39095 orig_conv.is_owned = false;
39096 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39097 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39098 int64_t ret_ref = 0;
39099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39102 ret_ref = (uintptr_t)ret_var.inner;
39103 if (ret_var.is_owned) {
39109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
39110 LDKChannelTransactionParameters this_arg_conv;
39111 this_arg_conv.inner = (void*)(this_arg & (~1));
39112 this_arg_conv.is_owned = false;
39113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39114 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39119 LDKChannelTransactionParameters this_arg_conv;
39120 this_arg_conv.inner = (void*)(this_arg & (~1));
39121 this_arg_conv.is_owned = false;
39122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39123 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39124 int64_t ret_ref = 0;
39125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39128 ret_ref = (uintptr_t)ret_var.inner;
39129 if (ret_var.is_owned) {
39135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39136 LDKChannelTransactionParameters this_arg_conv;
39137 this_arg_conv.inner = (void*)(this_arg & (~1));
39138 this_arg_conv.is_owned = false;
39139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39140 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39141 int64_t ret_ref = 0;
39142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39145 ret_ref = (uintptr_t)ret_var.inner;
39146 if (ret_var.is_owned) {
39152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
39153 LDKCounterpartyChannelTransactionParameters obj_conv;
39154 obj_conv.inner = (void*)(obj & (~1));
39155 obj_conv.is_owned = false;
39156 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39157 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
39158 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39159 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39160 CVec_u8Z_free(ret_var);
39164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39165 LDKu8slice ser_ref;
39166 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39167 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39168 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
39169 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
39170 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39171 return (int64_t)ret_conv;
39174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
39175 LDKChannelTransactionParameters obj_conv;
39176 obj_conv.inner = (void*)(obj & (~1));
39177 obj_conv.is_owned = false;
39178 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39179 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
39180 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39181 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39182 CVec_u8Z_free(ret_var);
39186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39187 LDKu8slice ser_ref;
39188 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39189 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39190 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
39191 *ret_conv = ChannelTransactionParameters_read(ser_ref);
39192 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39193 return (int64_t)ret_conv;
39196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39197 LDKDirectedChannelTransactionParameters this_obj_conv;
39198 this_obj_conv.inner = (void*)(this_obj & (~1));
39199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39201 DirectedChannelTransactionParameters_free(this_obj_conv);
39204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
39205 LDKDirectedChannelTransactionParameters this_arg_conv;
39206 this_arg_conv.inner = (void*)(this_arg & (~1));
39207 this_arg_conv.is_owned = false;
39208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39209 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
39210 int64_t ret_ref = 0;
39211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39214 ret_ref = (uintptr_t)ret_var.inner;
39215 if (ret_var.is_owned) {
39221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
39222 LDKDirectedChannelTransactionParameters this_arg_conv;
39223 this_arg_conv.inner = (void*)(this_arg & (~1));
39224 this_arg_conv.is_owned = false;
39225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39226 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
39227 int64_t ret_ref = 0;
39228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39231 ret_ref = (uintptr_t)ret_var.inner;
39232 if (ret_var.is_owned) {
39238 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
39239 LDKDirectedChannelTransactionParameters this_arg_conv;
39240 this_arg_conv.inner = (void*)(this_arg & (~1));
39241 this_arg_conv.is_owned = false;
39242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39243 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
39247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
39248 LDKDirectedChannelTransactionParameters this_arg_conv;
39249 this_arg_conv.inner = (void*)(this_arg & (~1));
39250 this_arg_conv.is_owned = false;
39251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39252 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
39256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
39257 LDKDirectedChannelTransactionParameters this_arg_conv;
39258 this_arg_conv.inner = (void*)(this_arg & (~1));
39259 this_arg_conv.is_owned = false;
39260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39261 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
39262 int64_t ret_ref = 0;
39263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39266 ret_ref = (uintptr_t)ret_var.inner;
39267 if (ret_var.is_owned) {
39273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
39274 LDKDirectedChannelTransactionParameters this_arg_conv;
39275 this_arg_conv.inner = (void*)(this_arg & (~1));
39276 this_arg_conv.is_owned = false;
39277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39278 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
39282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39283 LDKHolderCommitmentTransaction this_obj_conv;
39284 this_obj_conv.inner = (void*)(this_obj & (~1));
39285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39287 HolderCommitmentTransaction_free(this_obj_conv);
39290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
39291 LDKHolderCommitmentTransaction this_ptr_conv;
39292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39293 this_ptr_conv.is_owned = false;
39294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39295 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39296 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
39300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39301 LDKHolderCommitmentTransaction this_ptr_conv;
39302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39303 this_ptr_conv.is_owned = false;
39304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39305 LDKSignature val_ref;
39306 CHECK((*env)->GetArrayLength(env, val) == 64);
39307 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
39308 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
39311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
39312 LDKHolderCommitmentTransaction this_ptr_conv;
39313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39314 this_ptr_conv.is_owned = false;
39315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39316 LDKCVec_SignatureZ val_constr;
39317 val_constr.datalen = (*env)->GetArrayLength(env, val);
39318 if (val_constr.datalen > 0)
39319 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39321 val_constr.data = NULL;
39322 for (size_t i = 0; i < val_constr.datalen; i++) {
39323 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
39324 LDKSignature val_conv_8_ref;
39325 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
39326 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
39327 val_constr.data[i] = val_conv_8_ref;
39329 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
39332 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
39333 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
39334 int64_t ret_ref = 0;
39335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39338 ret_ref = (uintptr_t)ret_var.inner;
39339 if (ret_var.is_owned) {
39344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39345 LDKHolderCommitmentTransaction arg_conv;
39346 arg_conv.inner = (void*)(arg & (~1));
39347 arg_conv.is_owned = false;
39348 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39349 int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
39353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39354 LDKHolderCommitmentTransaction orig_conv;
39355 orig_conv.inner = (void*)(orig & (~1));
39356 orig_conv.is_owned = false;
39357 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39358 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
39359 int64_t ret_ref = 0;
39360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39363 ret_ref = (uintptr_t)ret_var.inner;
39364 if (ret_var.is_owned) {
39370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39371 LDKHolderCommitmentTransaction obj_conv;
39372 obj_conv.inner = (void*)(obj & (~1));
39373 obj_conv.is_owned = false;
39374 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39375 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39376 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39377 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39378 CVec_u8Z_free(ret_var);
39382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39383 LDKu8slice ser_ref;
39384 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39385 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39386 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39387 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39388 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39389 return (int64_t)ret_conv;
39392 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) {
39393 LDKCommitmentTransaction commitment_tx_conv;
39394 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
39395 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
39396 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39397 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39398 LDKSignature counterparty_sig_ref;
39399 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
39400 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
39401 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39402 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
39403 if (counterparty_htlc_sigs_constr.datalen > 0)
39404 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39406 counterparty_htlc_sigs_constr.data = NULL;
39407 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
39408 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
39409 LDKSignature counterparty_htlc_sigs_conv_8_ref;
39410 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
39411 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
39412 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
39414 LDKPublicKey holder_funding_key_ref;
39415 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
39416 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
39417 LDKPublicKey counterparty_funding_key_ref;
39418 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
39419 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
39420 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39421 int64_t ret_ref = 0;
39422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39425 ret_ref = (uintptr_t)ret_var.inner;
39426 if (ret_var.is_owned) {
39432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39433 LDKBuiltCommitmentTransaction this_obj_conv;
39434 this_obj_conv.inner = (void*)(this_obj & (~1));
39435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39437 BuiltCommitmentTransaction_free(this_obj_conv);
39440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
39441 LDKBuiltCommitmentTransaction this_ptr_conv;
39442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39443 this_ptr_conv.is_owned = false;
39444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39445 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39448 Transaction_free(ret_var);
39452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39453 LDKBuiltCommitmentTransaction this_ptr_conv;
39454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39455 this_ptr_conv.is_owned = false;
39456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39457 LDKTransaction val_ref;
39458 val_ref.datalen = (*env)->GetArrayLength(env, val);
39459 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39460 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39461 val_ref.data_is_owned = true;
39462 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
39466 LDKBuiltCommitmentTransaction this_ptr_conv;
39467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39468 this_ptr_conv.is_owned = false;
39469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39470 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
39475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39476 LDKBuiltCommitmentTransaction this_ptr_conv;
39477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39478 this_ptr_conv.is_owned = false;
39479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39480 LDKThirtyTwoBytes val_ref;
39481 CHECK((*env)->GetArrayLength(env, val) == 32);
39482 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39483 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
39487 LDKTransaction transaction_arg_ref;
39488 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
39489 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39490 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
39491 transaction_arg_ref.data_is_owned = true;
39492 LDKThirtyTwoBytes txid_arg_ref;
39493 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
39494 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
39495 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39496 int64_t ret_ref = 0;
39497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39500 ret_ref = (uintptr_t)ret_var.inner;
39501 if (ret_var.is_owned) {
39507 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39508 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39509 int64_t ret_ref = 0;
39510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39513 ret_ref = (uintptr_t)ret_var.inner;
39514 if (ret_var.is_owned) {
39519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39520 LDKBuiltCommitmentTransaction arg_conv;
39521 arg_conv.inner = (void*)(arg & (~1));
39522 arg_conv.is_owned = false;
39523 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39524 int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39529 LDKBuiltCommitmentTransaction orig_conv;
39530 orig_conv.inner = (void*)(orig & (~1));
39531 orig_conv.is_owned = false;
39532 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39533 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39534 int64_t ret_ref = 0;
39535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39538 ret_ref = (uintptr_t)ret_var.inner;
39539 if (ret_var.is_owned) {
39545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39546 LDKBuiltCommitmentTransaction obj_conv;
39547 obj_conv.inner = (void*)(obj & (~1));
39548 obj_conv.is_owned = false;
39549 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39550 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39551 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39552 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39553 CVec_u8Z_free(ret_var);
39557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39558 LDKu8slice ser_ref;
39559 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39560 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39561 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39562 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39563 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39564 return (int64_t)ret_conv;
39567 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) {
39568 LDKBuiltCommitmentTransaction this_arg_conv;
39569 this_arg_conv.inner = (void*)(this_arg & (~1));
39570 this_arg_conv.is_owned = false;
39571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39572 LDKu8slice funding_redeemscript_ref;
39573 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39574 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39575 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39577 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39581 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) {
39582 LDKBuiltCommitmentTransaction this_arg_conv;
39583 this_arg_conv.inner = (void*)(this_arg & (~1));
39584 this_arg_conv.is_owned = false;
39585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39586 unsigned char funding_key_arr[32];
39587 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39588 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39589 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39590 LDKu8slice funding_redeemscript_ref;
39591 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39592 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39593 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39594 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39595 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39600 LDKClosingTransaction this_obj_conv;
39601 this_obj_conv.inner = (void*)(this_obj & (~1));
39602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39604 ClosingTransaction_free(this_obj_conv);
39607 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39608 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39609 int64_t ret_ref = 0;
39610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39613 ret_ref = (uintptr_t)ret_var.inner;
39614 if (ret_var.is_owned) {
39619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39620 LDKClosingTransaction arg_conv;
39621 arg_conv.inner = (void*)(arg & (~1));
39622 arg_conv.is_owned = false;
39623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39624 int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39629 LDKClosingTransaction orig_conv;
39630 orig_conv.inner = (void*)(orig & (~1));
39631 orig_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39633 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39634 int64_t ret_ref = 0;
39635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39638 ret_ref = (uintptr_t)ret_var.inner;
39639 if (ret_var.is_owned) {
39645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
39646 LDKClosingTransaction o_conv;
39647 o_conv.inner = (void*)(o & (~1));
39648 o_conv.is_owned = false;
39649 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39650 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39654 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) {
39655 LDKCVec_u8Z to_holder_script_ref;
39656 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
39657 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39658 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
39659 LDKCVec_u8Z to_counterparty_script_ref;
39660 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
39661 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39662 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
39663 LDKOutPoint funding_outpoint_conv;
39664 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
39665 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
39666 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39667 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39668 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39669 int64_t ret_ref = 0;
39670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39673 ret_ref = (uintptr_t)ret_var.inner;
39674 if (ret_var.is_owned) {
39680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39681 LDKClosingTransaction this_arg_conv;
39682 this_arg_conv.inner = (void*)(this_arg & (~1));
39683 this_arg_conv.is_owned = false;
39684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39685 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39686 int64_t ret_ref = 0;
39687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39690 ret_ref = (uintptr_t)ret_var.inner;
39691 if (ret_var.is_owned) {
39697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
39698 LDKClosingTransaction this_arg_conv;
39699 this_arg_conv.inner = (void*)(this_arg & (~1));
39700 this_arg_conv.is_owned = false;
39701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39702 LDKOutPoint funding_outpoint_conv;
39703 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
39704 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
39705 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39706 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39707 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39708 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39709 return (int64_t)ret_conv;
39712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39713 LDKClosingTransaction this_arg_conv;
39714 this_arg_conv.inner = (void*)(this_arg & (~1));
39715 this_arg_conv.is_owned = false;
39716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39717 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39722 LDKClosingTransaction this_arg_conv;
39723 this_arg_conv.inner = (void*)(this_arg & (~1));
39724 this_arg_conv.is_owned = false;
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39726 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39731 LDKClosingTransaction this_arg_conv;
39732 this_arg_conv.inner = (void*)(this_arg & (~1));
39733 this_arg_conv.is_owned = false;
39734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39735 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39736 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39737 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39742 LDKClosingTransaction this_arg_conv;
39743 this_arg_conv.inner = (void*)(this_arg & (~1));
39744 this_arg_conv.is_owned = false;
39745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39746 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39747 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39748 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39753 LDKTrustedClosingTransaction this_obj_conv;
39754 this_obj_conv.inner = (void*)(this_obj & (~1));
39755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39757 TrustedClosingTransaction_free(this_obj_conv);
39760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39761 LDKTrustedClosingTransaction this_arg_conv;
39762 this_arg_conv.inner = (void*)(this_arg & (~1));
39763 this_arg_conv.is_owned = false;
39764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39765 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39766 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39767 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39768 Transaction_free(ret_var);
39772 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) {
39773 LDKTrustedClosingTransaction this_arg_conv;
39774 this_arg_conv.inner = (void*)(this_arg & (~1));
39775 this_arg_conv.is_owned = false;
39776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39777 LDKu8slice funding_redeemscript_ref;
39778 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39779 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39780 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39782 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39786 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) {
39787 LDKTrustedClosingTransaction this_arg_conv;
39788 this_arg_conv.inner = (void*)(this_arg & (~1));
39789 this_arg_conv.is_owned = false;
39790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39791 unsigned char funding_key_arr[32];
39792 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39793 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39794 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39795 LDKu8slice funding_redeemscript_ref;
39796 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39797 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39798 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39799 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39800 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39805 LDKCommitmentTransaction this_obj_conv;
39806 this_obj_conv.inner = (void*)(this_obj & (~1));
39807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39809 CommitmentTransaction_free(this_obj_conv);
39812 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39813 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39814 int64_t ret_ref = 0;
39815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39818 ret_ref = (uintptr_t)ret_var.inner;
39819 if (ret_var.is_owned) {
39824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39825 LDKCommitmentTransaction arg_conv;
39826 arg_conv.inner = (void*)(arg & (~1));
39827 arg_conv.is_owned = false;
39828 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39829 int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39834 LDKCommitmentTransaction orig_conv;
39835 orig_conv.inner = (void*)(orig & (~1));
39836 orig_conv.is_owned = false;
39837 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39838 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39839 int64_t ret_ref = 0;
39840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39843 ret_ref = (uintptr_t)ret_var.inner;
39844 if (ret_var.is_owned) {
39850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39851 LDKCommitmentTransaction obj_conv;
39852 obj_conv.inner = (void*)(obj & (~1));
39853 obj_conv.is_owned = false;
39854 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39855 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39856 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39857 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39858 CVec_u8Z_free(ret_var);
39862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39863 LDKu8slice ser_ref;
39864 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39865 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39866 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39867 *ret_conv = CommitmentTransaction_read(ser_ref);
39868 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39869 return (int64_t)ret_conv;
39872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
39873 LDKCommitmentTransaction this_arg_conv;
39874 this_arg_conv.inner = (void*)(this_arg & (~1));
39875 this_arg_conv.is_owned = false;
39876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39877 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39882 LDKCommitmentTransaction this_arg_conv;
39883 this_arg_conv.inner = (void*)(this_arg & (~1));
39884 this_arg_conv.is_owned = false;
39885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39886 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39891 LDKCommitmentTransaction this_arg_conv;
39892 this_arg_conv.inner = (void*)(this_arg & (~1));
39893 this_arg_conv.is_owned = false;
39894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39895 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39899 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
39900 LDKCommitmentTransaction this_arg_conv;
39901 this_arg_conv.inner = (void*)(this_arg & (~1));
39902 this_arg_conv.is_owned = false;
39903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39904 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39909 LDKCommitmentTransaction this_arg_conv;
39910 this_arg_conv.inner = (void*)(this_arg & (~1));
39911 this_arg_conv.is_owned = false;
39912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39913 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39914 int64_t ret_ref = 0;
39915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39918 ret_ref = (uintptr_t)ret_var.inner;
39919 if (ret_var.is_owned) {
39925 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) {
39926 LDKCommitmentTransaction this_arg_conv;
39927 this_arg_conv.inner = (void*)(this_arg & (~1));
39928 this_arg_conv.is_owned = false;
39929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39930 LDKDirectedChannelTransactionParameters channel_parameters_conv;
39931 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
39932 channel_parameters_conv.is_owned = false;
39933 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39934 LDKChannelPublicKeys broadcaster_keys_conv;
39935 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
39936 broadcaster_keys_conv.is_owned = false;
39937 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39938 LDKChannelPublicKeys countersignatory_keys_conv;
39939 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
39940 countersignatory_keys_conv.is_owned = false;
39941 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39942 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39943 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39944 return (int64_t)ret_conv;
39947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39948 LDKTrustedCommitmentTransaction this_obj_conv;
39949 this_obj_conv.inner = (void*)(this_obj & (~1));
39950 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39952 TrustedCommitmentTransaction_free(this_obj_conv);
39955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
39956 LDKTrustedCommitmentTransaction this_arg_conv;
39957 this_arg_conv.inner = (void*)(this_arg & (~1));
39958 this_arg_conv.is_owned = false;
39959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39960 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39961 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
39965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39966 LDKTrustedCommitmentTransaction this_arg_conv;
39967 this_arg_conv.inner = (void*)(this_arg & (~1));
39968 this_arg_conv.is_owned = false;
39969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39970 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39971 int64_t ret_ref = 0;
39972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39975 ret_ref = (uintptr_t)ret_var.inner;
39976 if (ret_var.is_owned) {
39982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
39983 LDKTrustedCommitmentTransaction this_arg_conv;
39984 this_arg_conv.inner = (void*)(this_arg & (~1));
39985 this_arg_conv.is_owned = false;
39986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39987 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39988 int64_t ret_ref = 0;
39989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39992 ret_ref = (uintptr_t)ret_var.inner;
39993 if (ret_var.is_owned) {
39999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40000 LDKTrustedCommitmentTransaction this_arg_conv;
40001 this_arg_conv.inner = (void*)(this_arg & (~1));
40002 this_arg_conv.is_owned = false;
40003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40004 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40008 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) {
40009 LDKTrustedCommitmentTransaction this_arg_conv;
40010 this_arg_conv.inner = (void*)(this_arg & (~1));
40011 this_arg_conv.is_owned = false;
40012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40013 unsigned char htlc_base_key_arr[32];
40014 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
40015 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
40016 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40017 LDKDirectedChannelTransactionParameters channel_parameters_conv;
40018 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
40019 channel_parameters_conv.is_owned = false;
40020 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40021 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40022 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
40023 return (int64_t)ret_conv;
40026 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) {
40027 LDKPublicKey broadcaster_payment_basepoint_ref;
40028 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
40029 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
40030 LDKPublicKey countersignatory_payment_basepoint_ref;
40031 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
40032 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
40033 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40038 LDKInitFeatures a_conv;
40039 a_conv.inner = (void*)(a & (~1));
40040 a_conv.is_owned = false;
40041 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40042 LDKInitFeatures b_conv;
40043 b_conv.inner = (void*)(b & (~1));
40044 b_conv.is_owned = false;
40045 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40046 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40051 LDKNodeFeatures a_conv;
40052 a_conv.inner = (void*)(a & (~1));
40053 a_conv.is_owned = false;
40054 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40055 LDKNodeFeatures b_conv;
40056 b_conv.inner = (void*)(b & (~1));
40057 b_conv.is_owned = false;
40058 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40059 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40064 LDKChannelFeatures a_conv;
40065 a_conv.inner = (void*)(a & (~1));
40066 a_conv.is_owned = false;
40067 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40068 LDKChannelFeatures b_conv;
40069 b_conv.inner = (void*)(b & (~1));
40070 b_conv.is_owned = false;
40071 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40072 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40077 LDKInvoiceFeatures a_conv;
40078 a_conv.inner = (void*)(a & (~1));
40079 a_conv.is_owned = false;
40080 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40081 LDKInvoiceFeatures b_conv;
40082 b_conv.inner = (void*)(b & (~1));
40083 b_conv.is_owned = false;
40084 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40085 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40090 LDKChannelTypeFeatures a_conv;
40091 a_conv.inner = (void*)(a & (~1));
40092 a_conv.is_owned = false;
40093 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40094 LDKChannelTypeFeatures b_conv;
40095 b_conv.inner = (void*)(b & (~1));
40096 b_conv.is_owned = false;
40097 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40098 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40102 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40103 LDKInitFeatures ret_var = InitFeatures_clone(arg);
40104 int64_t ret_ref = 0;
40105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40108 ret_ref = (uintptr_t)ret_var.inner;
40109 if (ret_var.is_owned) {
40114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40115 LDKInitFeatures arg_conv;
40116 arg_conv.inner = (void*)(arg & (~1));
40117 arg_conv.is_owned = false;
40118 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40119 int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40124 LDKInitFeatures orig_conv;
40125 orig_conv.inner = (void*)(orig & (~1));
40126 orig_conv.is_owned = false;
40127 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40128 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40129 int64_t ret_ref = 0;
40130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40133 ret_ref = (uintptr_t)ret_var.inner;
40134 if (ret_var.is_owned) {
40140 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
40141 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
40142 int64_t ret_ref = 0;
40143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40146 ret_ref = (uintptr_t)ret_var.inner;
40147 if (ret_var.is_owned) {
40152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40153 LDKNodeFeatures arg_conv;
40154 arg_conv.inner = (void*)(arg & (~1));
40155 arg_conv.is_owned = false;
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40157 int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
40161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40162 LDKNodeFeatures orig_conv;
40163 orig_conv.inner = (void*)(orig & (~1));
40164 orig_conv.is_owned = false;
40165 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40166 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
40167 int64_t ret_ref = 0;
40168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40171 ret_ref = (uintptr_t)ret_var.inner;
40172 if (ret_var.is_owned) {
40178 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
40179 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
40180 int64_t ret_ref = 0;
40181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40184 ret_ref = (uintptr_t)ret_var.inner;
40185 if (ret_var.is_owned) {
40190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40191 LDKChannelFeatures arg_conv;
40192 arg_conv.inner = (void*)(arg & (~1));
40193 arg_conv.is_owned = false;
40194 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40195 int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
40199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40200 LDKChannelFeatures orig_conv;
40201 orig_conv.inner = (void*)(orig & (~1));
40202 orig_conv.is_owned = false;
40203 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40204 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
40205 int64_t ret_ref = 0;
40206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40209 ret_ref = (uintptr_t)ret_var.inner;
40210 if (ret_var.is_owned) {
40216 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
40217 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
40218 int64_t ret_ref = 0;
40219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40222 ret_ref = (uintptr_t)ret_var.inner;
40223 if (ret_var.is_owned) {
40228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40229 LDKInvoiceFeatures arg_conv;
40230 arg_conv.inner = (void*)(arg & (~1));
40231 arg_conv.is_owned = false;
40232 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40233 int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
40237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40238 LDKInvoiceFeatures orig_conv;
40239 orig_conv.inner = (void*)(orig & (~1));
40240 orig_conv.is_owned = false;
40241 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40242 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
40243 int64_t ret_ref = 0;
40244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40247 ret_ref = (uintptr_t)ret_var.inner;
40248 if (ret_var.is_owned) {
40254 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
40255 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
40256 int64_t ret_ref = 0;
40257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40260 ret_ref = (uintptr_t)ret_var.inner;
40261 if (ret_var.is_owned) {
40266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40267 LDKChannelTypeFeatures arg_conv;
40268 arg_conv.inner = (void*)(arg & (~1));
40269 arg_conv.is_owned = false;
40270 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40271 int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
40275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40276 LDKChannelTypeFeatures orig_conv;
40277 orig_conv.inner = (void*)(orig & (~1));
40278 orig_conv.is_owned = false;
40279 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40280 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
40281 int64_t ret_ref = 0;
40282 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40283 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40285 ret_ref = (uintptr_t)ret_var.inner;
40286 if (ret_var.is_owned) {
40292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40293 LDKInitFeatures this_obj_conv;
40294 this_obj_conv.inner = (void*)(this_obj & (~1));
40295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40297 InitFeatures_free(this_obj_conv);
40300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40301 LDKNodeFeatures this_obj_conv;
40302 this_obj_conv.inner = (void*)(this_obj & (~1));
40303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40305 NodeFeatures_free(this_obj_conv);
40308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40309 LDKChannelFeatures this_obj_conv;
40310 this_obj_conv.inner = (void*)(this_obj & (~1));
40311 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40313 ChannelFeatures_free(this_obj_conv);
40316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40317 LDKInvoiceFeatures this_obj_conv;
40318 this_obj_conv.inner = (void*)(this_obj & (~1));
40319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40321 InvoiceFeatures_free(this_obj_conv);
40324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40325 LDKChannelTypeFeatures this_obj_conv;
40326 this_obj_conv.inner = (void*)(this_obj & (~1));
40327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40329 ChannelTypeFeatures_free(this_obj_conv);
40332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
40333 LDKInitFeatures ret_var = InitFeatures_empty();
40334 int64_t ret_ref = 0;
40335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40338 ret_ref = (uintptr_t)ret_var.inner;
40339 if (ret_var.is_owned) {
40345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
40346 LDKInitFeatures ret_var = InitFeatures_known();
40347 int64_t ret_ref = 0;
40348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40351 ret_ref = (uintptr_t)ret_var.inner;
40352 if (ret_var.is_owned) {
40358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40359 LDKInitFeatures this_arg_conv;
40360 this_arg_conv.inner = (void*)(this_arg & (~1));
40361 this_arg_conv.is_owned = false;
40362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40363 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
40368 LDKNodeFeatures ret_var = NodeFeatures_empty();
40369 int64_t ret_ref = 0;
40370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40373 ret_ref = (uintptr_t)ret_var.inner;
40374 if (ret_var.is_owned) {
40380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
40381 LDKNodeFeatures ret_var = NodeFeatures_known();
40382 int64_t ret_ref = 0;
40383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40386 ret_ref = (uintptr_t)ret_var.inner;
40387 if (ret_var.is_owned) {
40393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40394 LDKNodeFeatures this_arg_conv;
40395 this_arg_conv.inner = (void*)(this_arg & (~1));
40396 this_arg_conv.is_owned = false;
40397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40398 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
40403 LDKChannelFeatures ret_var = ChannelFeatures_empty();
40404 int64_t ret_ref = 0;
40405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40408 ret_ref = (uintptr_t)ret_var.inner;
40409 if (ret_var.is_owned) {
40415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
40416 LDKChannelFeatures ret_var = ChannelFeatures_known();
40417 int64_t ret_ref = 0;
40418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40421 ret_ref = (uintptr_t)ret_var.inner;
40422 if (ret_var.is_owned) {
40428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40429 LDKChannelFeatures this_arg_conv;
40430 this_arg_conv.inner = (void*)(this_arg & (~1));
40431 this_arg_conv.is_owned = false;
40432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40433 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
40438 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40439 int64_t ret_ref = 0;
40440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40443 ret_ref = (uintptr_t)ret_var.inner;
40444 if (ret_var.is_owned) {
40450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
40451 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
40452 int64_t ret_ref = 0;
40453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40456 ret_ref = (uintptr_t)ret_var.inner;
40457 if (ret_var.is_owned) {
40463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40464 LDKInvoiceFeatures this_arg_conv;
40465 this_arg_conv.inner = (void*)(this_arg & (~1));
40466 this_arg_conv.is_owned = false;
40467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40468 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
40473 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40474 int64_t ret_ref = 0;
40475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40478 ret_ref = (uintptr_t)ret_var.inner;
40479 if (ret_var.is_owned) {
40485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
40486 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
40487 int64_t ret_ref = 0;
40488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40491 ret_ref = (uintptr_t)ret_var.inner;
40492 if (ret_var.is_owned) {
40498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40499 LDKChannelTypeFeatures this_arg_conv;
40500 this_arg_conv.inner = (void*)(this_arg & (~1));
40501 this_arg_conv.is_owned = false;
40502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40503 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40508 LDKInitFeatures obj_conv;
40509 obj_conv.inner = (void*)(obj & (~1));
40510 obj_conv.is_owned = false;
40511 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40512 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40513 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40514 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40515 CVec_u8Z_free(ret_var);
40519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40520 LDKu8slice ser_ref;
40521 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40522 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40523 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40524 *ret_conv = InitFeatures_read(ser_ref);
40525 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40526 return (int64_t)ret_conv;
40529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40530 LDKChannelFeatures obj_conv;
40531 obj_conv.inner = (void*)(obj & (~1));
40532 obj_conv.is_owned = false;
40533 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40534 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40535 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40536 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40537 CVec_u8Z_free(ret_var);
40541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40542 LDKu8slice ser_ref;
40543 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40544 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40545 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40546 *ret_conv = ChannelFeatures_read(ser_ref);
40547 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40548 return (int64_t)ret_conv;
40551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40552 LDKNodeFeatures obj_conv;
40553 obj_conv.inner = (void*)(obj & (~1));
40554 obj_conv.is_owned = false;
40555 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40556 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40557 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40558 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40559 CVec_u8Z_free(ret_var);
40563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40564 LDKu8slice ser_ref;
40565 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40566 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40567 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40568 *ret_conv = NodeFeatures_read(ser_ref);
40569 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40570 return (int64_t)ret_conv;
40573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40574 LDKInvoiceFeatures obj_conv;
40575 obj_conv.inner = (void*)(obj & (~1));
40576 obj_conv.is_owned = false;
40577 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40578 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40579 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40580 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40581 CVec_u8Z_free(ret_var);
40585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40586 LDKu8slice ser_ref;
40587 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40588 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40589 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40590 *ret_conv = InvoiceFeatures_read(ser_ref);
40591 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40592 return (int64_t)ret_conv;
40595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40596 LDKChannelTypeFeatures obj_conv;
40597 obj_conv.inner = (void*)(obj & (~1));
40598 obj_conv.is_owned = false;
40599 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40600 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40601 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40602 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40603 CVec_u8Z_free(ret_var);
40607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40608 LDKu8slice ser_ref;
40609 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40610 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40611 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40612 *ret_conv = ChannelTypeFeatures_read(ser_ref);
40613 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40614 return (int64_t)ret_conv;
40617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40618 LDKInitFeatures this_arg_conv;
40619 this_arg_conv.inner = (void*)(this_arg & (~1));
40620 this_arg_conv.is_owned = false;
40621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40622 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40626 LDKInitFeatures this_arg_conv;
40627 this_arg_conv.inner = (void*)(this_arg & (~1));
40628 this_arg_conv.is_owned = false;
40629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40630 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40634 LDKInitFeatures this_arg_conv;
40635 this_arg_conv.inner = (void*)(this_arg & (~1));
40636 this_arg_conv.is_owned = false;
40637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40638 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40643 LDKNodeFeatures this_arg_conv;
40644 this_arg_conv.inner = (void*)(this_arg & (~1));
40645 this_arg_conv.is_owned = false;
40646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40647 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40651 LDKNodeFeatures this_arg_conv;
40652 this_arg_conv.inner = (void*)(this_arg & (~1));
40653 this_arg_conv.is_owned = false;
40654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40655 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40659 LDKNodeFeatures this_arg_conv;
40660 this_arg_conv.inner = (void*)(this_arg & (~1));
40661 this_arg_conv.is_owned = false;
40662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40663 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40668 LDKInitFeatures this_arg_conv;
40669 this_arg_conv.inner = (void*)(this_arg & (~1));
40670 this_arg_conv.is_owned = false;
40671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40672 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40677 LDKNodeFeatures this_arg_conv;
40678 this_arg_conv.inner = (void*)(this_arg & (~1));
40679 this_arg_conv.is_owned = false;
40680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40681 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40686 LDKInitFeatures this_arg_conv;
40687 this_arg_conv.inner = (void*)(this_arg & (~1));
40688 this_arg_conv.is_owned = false;
40689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40690 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40694 LDKInitFeatures this_arg_conv;
40695 this_arg_conv.inner = (void*)(this_arg & (~1));
40696 this_arg_conv.is_owned = false;
40697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40698 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
40702 LDKInitFeatures this_arg_conv;
40703 this_arg_conv.inner = (void*)(this_arg & (~1));
40704 this_arg_conv.is_owned = false;
40705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40706 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40711 LDKInitFeatures this_arg_conv;
40712 this_arg_conv.inner = (void*)(this_arg & (~1));
40713 this_arg_conv.is_owned = false;
40714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40715 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40719 LDKInitFeatures this_arg_conv;
40720 this_arg_conv.inner = (void*)(this_arg & (~1));
40721 this_arg_conv.is_owned = false;
40722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40723 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40727 LDKInitFeatures this_arg_conv;
40728 this_arg_conv.inner = (void*)(this_arg & (~1));
40729 this_arg_conv.is_owned = false;
40730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40731 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40736 LDKNodeFeatures 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 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40744 LDKNodeFeatures this_arg_conv;
40745 this_arg_conv.inner = (void*)(this_arg & (~1));
40746 this_arg_conv.is_owned = false;
40747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40748 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40752 LDKNodeFeatures this_arg_conv;
40753 this_arg_conv.inner = (void*)(this_arg & (~1));
40754 this_arg_conv.is_owned = false;
40755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40756 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40761 LDKInitFeatures this_arg_conv;
40762 this_arg_conv.inner = (void*)(this_arg & (~1));
40763 this_arg_conv.is_owned = false;
40764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40765 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40770 LDKNodeFeatures this_arg_conv;
40771 this_arg_conv.inner = (void*)(this_arg & (~1));
40772 this_arg_conv.is_owned = false;
40773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40774 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40779 LDKInitFeatures this_arg_conv;
40780 this_arg_conv.inner = (void*)(this_arg & (~1));
40781 this_arg_conv.is_owned = false;
40782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40783 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40787 LDKInitFeatures this_arg_conv;
40788 this_arg_conv.inner = (void*)(this_arg & (~1));
40789 this_arg_conv.is_owned = false;
40790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40791 InitFeatures_set_gossip_queries_required(&this_arg_conv);
40794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40795 LDKInitFeatures this_arg_conv;
40796 this_arg_conv.inner = (void*)(this_arg & (~1));
40797 this_arg_conv.is_owned = false;
40798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40799 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40804 LDKNodeFeatures this_arg_conv;
40805 this_arg_conv.inner = (void*)(this_arg & (~1));
40806 this_arg_conv.is_owned = false;
40807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40808 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40812 LDKNodeFeatures this_arg_conv;
40813 this_arg_conv.inner = (void*)(this_arg & (~1));
40814 this_arg_conv.is_owned = false;
40815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40816 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40820 LDKNodeFeatures this_arg_conv;
40821 this_arg_conv.inner = (void*)(this_arg & (~1));
40822 this_arg_conv.is_owned = false;
40823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40824 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40829 LDKInitFeatures 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 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40838 LDKNodeFeatures this_arg_conv;
40839 this_arg_conv.inner = (void*)(this_arg & (~1));
40840 this_arg_conv.is_owned = false;
40841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40842 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40847 LDKInitFeatures this_arg_conv;
40848 this_arg_conv.inner = (void*)(this_arg & (~1));
40849 this_arg_conv.is_owned = false;
40850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40851 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40855 LDKInitFeatures this_arg_conv;
40856 this_arg_conv.inner = (void*)(this_arg & (~1));
40857 this_arg_conv.is_owned = false;
40858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40859 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40863 LDKInitFeatures 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 = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40872 LDKNodeFeatures 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 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40880 LDKNodeFeatures this_arg_conv;
40881 this_arg_conv.inner = (void*)(this_arg & (~1));
40882 this_arg_conv.is_owned = false;
40883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40884 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40888 LDKNodeFeatures this_arg_conv;
40889 this_arg_conv.inner = (void*)(this_arg & (~1));
40890 this_arg_conv.is_owned = false;
40891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40892 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40897 LDKInvoiceFeatures this_arg_conv;
40898 this_arg_conv.inner = (void*)(this_arg & (~1));
40899 this_arg_conv.is_owned = false;
40900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40901 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40905 LDKInvoiceFeatures this_arg_conv;
40906 this_arg_conv.inner = (void*)(this_arg & (~1));
40907 this_arg_conv.is_owned = false;
40908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40909 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40913 LDKInvoiceFeatures this_arg_conv;
40914 this_arg_conv.inner = (void*)(this_arg & (~1));
40915 this_arg_conv.is_owned = false;
40916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40917 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40922 LDKInitFeatures this_arg_conv;
40923 this_arg_conv.inner = (void*)(this_arg & (~1));
40924 this_arg_conv.is_owned = false;
40925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40926 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40931 LDKNodeFeatures this_arg_conv;
40932 this_arg_conv.inner = (void*)(this_arg & (~1));
40933 this_arg_conv.is_owned = false;
40934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40935 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40940 LDKInvoiceFeatures this_arg_conv;
40941 this_arg_conv.inner = (void*)(this_arg & (~1));
40942 this_arg_conv.is_owned = false;
40943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40944 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40949 LDKInitFeatures this_arg_conv;
40950 this_arg_conv.inner = (void*)(this_arg & (~1));
40951 this_arg_conv.is_owned = false;
40952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40953 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40957 LDKInitFeatures this_arg_conv;
40958 this_arg_conv.inner = (void*)(this_arg & (~1));
40959 this_arg_conv.is_owned = false;
40960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40961 InitFeatures_set_static_remote_key_required(&this_arg_conv);
40964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40965 LDKInitFeatures this_arg_conv;
40966 this_arg_conv.inner = (void*)(this_arg & (~1));
40967 this_arg_conv.is_owned = false;
40968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40969 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40974 LDKNodeFeatures this_arg_conv;
40975 this_arg_conv.inner = (void*)(this_arg & (~1));
40976 this_arg_conv.is_owned = false;
40977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40978 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40982 LDKNodeFeatures this_arg_conv;
40983 this_arg_conv.inner = (void*)(this_arg & (~1));
40984 this_arg_conv.is_owned = false;
40985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40986 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40990 LDKNodeFeatures this_arg_conv;
40991 this_arg_conv.inner = (void*)(this_arg & (~1));
40992 this_arg_conv.is_owned = false;
40993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40994 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40999 LDKChannelTypeFeatures this_arg_conv;
41000 this_arg_conv.inner = (void*)(this_arg & (~1));
41001 this_arg_conv.is_owned = false;
41002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41003 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41007 LDKChannelTypeFeatures this_arg_conv;
41008 this_arg_conv.inner = (void*)(this_arg & (~1));
41009 this_arg_conv.is_owned = false;
41010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41011 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41015 LDKChannelTypeFeatures this_arg_conv;
41016 this_arg_conv.inner = (void*)(this_arg & (~1));
41017 this_arg_conv.is_owned = false;
41018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41019 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41024 LDKInitFeatures this_arg_conv;
41025 this_arg_conv.inner = (void*)(this_arg & (~1));
41026 this_arg_conv.is_owned = false;
41027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41028 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41033 LDKNodeFeatures this_arg_conv;
41034 this_arg_conv.inner = (void*)(this_arg & (~1));
41035 this_arg_conv.is_owned = false;
41036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41037 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41042 LDKChannelTypeFeatures this_arg_conv;
41043 this_arg_conv.inner = (void*)(this_arg & (~1));
41044 this_arg_conv.is_owned = false;
41045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41046 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41051 LDKInitFeatures this_arg_conv;
41052 this_arg_conv.inner = (void*)(this_arg & (~1));
41053 this_arg_conv.is_owned = false;
41054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41055 InitFeatures_set_payment_secret_optional(&this_arg_conv);
41058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41059 LDKInitFeatures this_arg_conv;
41060 this_arg_conv.inner = (void*)(this_arg & (~1));
41061 this_arg_conv.is_owned = false;
41062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41063 InitFeatures_set_payment_secret_required(&this_arg_conv);
41066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41067 LDKInitFeatures this_arg_conv;
41068 this_arg_conv.inner = (void*)(this_arg & (~1));
41069 this_arg_conv.is_owned = false;
41070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41071 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41076 LDKNodeFeatures this_arg_conv;
41077 this_arg_conv.inner = (void*)(this_arg & (~1));
41078 this_arg_conv.is_owned = false;
41079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41080 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41084 LDKNodeFeatures this_arg_conv;
41085 this_arg_conv.inner = (void*)(this_arg & (~1));
41086 this_arg_conv.is_owned = false;
41087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41088 NodeFeatures_set_payment_secret_required(&this_arg_conv);
41091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41092 LDKNodeFeatures this_arg_conv;
41093 this_arg_conv.inner = (void*)(this_arg & (~1));
41094 this_arg_conv.is_owned = false;
41095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41096 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41101 LDKInvoiceFeatures this_arg_conv;
41102 this_arg_conv.inner = (void*)(this_arg & (~1));
41103 this_arg_conv.is_owned = false;
41104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41105 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41109 LDKInvoiceFeatures this_arg_conv;
41110 this_arg_conv.inner = (void*)(this_arg & (~1));
41111 this_arg_conv.is_owned = false;
41112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41113 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41117 LDKInvoiceFeatures this_arg_conv;
41118 this_arg_conv.inner = (void*)(this_arg & (~1));
41119 this_arg_conv.is_owned = false;
41120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41121 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41126 LDKInitFeatures this_arg_conv;
41127 this_arg_conv.inner = (void*)(this_arg & (~1));
41128 this_arg_conv.is_owned = false;
41129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41130 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41135 LDKNodeFeatures this_arg_conv;
41136 this_arg_conv.inner = (void*)(this_arg & (~1));
41137 this_arg_conv.is_owned = false;
41138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41139 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
41143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41144 LDKInvoiceFeatures this_arg_conv;
41145 this_arg_conv.inner = (void*)(this_arg & (~1));
41146 this_arg_conv.is_owned = false;
41147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41148 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
41152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41153 LDKInitFeatures this_arg_conv;
41154 this_arg_conv.inner = (void*)(this_arg & (~1));
41155 this_arg_conv.is_owned = false;
41156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41157 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
41160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41161 LDKInitFeatures this_arg_conv;
41162 this_arg_conv.inner = (void*)(this_arg & (~1));
41163 this_arg_conv.is_owned = false;
41164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41165 InitFeatures_set_basic_mpp_required(&this_arg_conv);
41168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41169 LDKInitFeatures this_arg_conv;
41170 this_arg_conv.inner = (void*)(this_arg & (~1));
41171 this_arg_conv.is_owned = false;
41172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41173 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
41177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41178 LDKNodeFeatures this_arg_conv;
41179 this_arg_conv.inner = (void*)(this_arg & (~1));
41180 this_arg_conv.is_owned = false;
41181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41182 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
41185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41186 LDKNodeFeatures this_arg_conv;
41187 this_arg_conv.inner = (void*)(this_arg & (~1));
41188 this_arg_conv.is_owned = false;
41189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41190 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
41193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41194 LDKNodeFeatures this_arg_conv;
41195 this_arg_conv.inner = (void*)(this_arg & (~1));
41196 this_arg_conv.is_owned = false;
41197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41198 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
41202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41203 LDKInvoiceFeatures this_arg_conv;
41204 this_arg_conv.inner = (void*)(this_arg & (~1));
41205 this_arg_conv.is_owned = false;
41206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41207 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
41210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41211 LDKInvoiceFeatures this_arg_conv;
41212 this_arg_conv.inner = (void*)(this_arg & (~1));
41213 this_arg_conv.is_owned = false;
41214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41215 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
41218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41219 LDKInvoiceFeatures this_arg_conv;
41220 this_arg_conv.inner = (void*)(this_arg & (~1));
41221 this_arg_conv.is_owned = false;
41222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41223 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
41227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41228 LDKInitFeatures this_arg_conv;
41229 this_arg_conv.inner = (void*)(this_arg & (~1));
41230 this_arg_conv.is_owned = false;
41231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41232 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
41236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41237 LDKNodeFeatures this_arg_conv;
41238 this_arg_conv.inner = (void*)(this_arg & (~1));
41239 this_arg_conv.is_owned = false;
41240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41241 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
41245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
41246 LDKInvoiceFeatures this_arg_conv;
41247 this_arg_conv.inner = (void*)(this_arg & (~1));
41248 this_arg_conv.is_owned = false;
41249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41250 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
41254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41255 LDKInitFeatures this_arg_conv;
41256 this_arg_conv.inner = (void*)(this_arg & (~1));
41257 this_arg_conv.is_owned = false;
41258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41259 InitFeatures_set_wumbo_optional(&this_arg_conv);
41262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41263 LDKInitFeatures this_arg_conv;
41264 this_arg_conv.inner = (void*)(this_arg & (~1));
41265 this_arg_conv.is_owned = false;
41266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41267 InitFeatures_set_wumbo_required(&this_arg_conv);
41270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
41271 LDKInitFeatures this_arg_conv;
41272 this_arg_conv.inner = (void*)(this_arg & (~1));
41273 this_arg_conv.is_owned = false;
41274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41275 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
41279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41280 LDKNodeFeatures this_arg_conv;
41281 this_arg_conv.inner = (void*)(this_arg & (~1));
41282 this_arg_conv.is_owned = false;
41283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41284 NodeFeatures_set_wumbo_optional(&this_arg_conv);
41287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41288 LDKNodeFeatures this_arg_conv;
41289 this_arg_conv.inner = (void*)(this_arg & (~1));
41290 this_arg_conv.is_owned = false;
41291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41292 NodeFeatures_set_wumbo_required(&this_arg_conv);
41295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
41296 LDKNodeFeatures this_arg_conv;
41297 this_arg_conv.inner = (void*)(this_arg & (~1));
41298 this_arg_conv.is_owned = false;
41299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41300 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
41304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
41305 LDKInitFeatures this_arg_conv;
41306 this_arg_conv.inner = (void*)(this_arg & (~1));
41307 this_arg_conv.is_owned = false;
41308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41309 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
41313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
41314 LDKNodeFeatures this_arg_conv;
41315 this_arg_conv.inner = (void*)(this_arg & (~1));
41316 this_arg_conv.is_owned = false;
41317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41318 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
41322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41323 LDKInitFeatures this_arg_conv;
41324 this_arg_conv.inner = (void*)(this_arg & (~1));
41325 this_arg_conv.is_owned = false;
41326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41327 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41331 LDKInitFeatures this_arg_conv;
41332 this_arg_conv.inner = (void*)(this_arg & (~1));
41333 this_arg_conv.is_owned = false;
41334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41335 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41339 LDKInitFeatures this_arg_conv;
41340 this_arg_conv.inner = (void*)(this_arg & (~1));
41341 this_arg_conv.is_owned = false;
41342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41343 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41348 LDKNodeFeatures this_arg_conv;
41349 this_arg_conv.inner = (void*)(this_arg & (~1));
41350 this_arg_conv.is_owned = false;
41351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41352 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
41355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41356 LDKNodeFeatures this_arg_conv;
41357 this_arg_conv.inner = (void*)(this_arg & (~1));
41358 this_arg_conv.is_owned = false;
41359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41360 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
41363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41364 LDKNodeFeatures this_arg_conv;
41365 this_arg_conv.inner = (void*)(this_arg & (~1));
41366 this_arg_conv.is_owned = false;
41367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41368 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41373 LDKInitFeatures this_arg_conv;
41374 this_arg_conv.inner = (void*)(this_arg & (~1));
41375 this_arg_conv.is_owned = false;
41376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41377 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41382 LDKNodeFeatures this_arg_conv;
41383 this_arg_conv.inner = (void*)(this_arg & (~1));
41384 this_arg_conv.is_owned = false;
41385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41386 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41391 LDKInitFeatures this_arg_conv;
41392 this_arg_conv.inner = (void*)(this_arg & (~1));
41393 this_arg_conv.is_owned = false;
41394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41395 InitFeatures_set_channel_type_optional(&this_arg_conv);
41398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41399 LDKInitFeatures this_arg_conv;
41400 this_arg_conv.inner = (void*)(this_arg & (~1));
41401 this_arg_conv.is_owned = false;
41402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41403 InitFeatures_set_channel_type_required(&this_arg_conv);
41406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41407 LDKInitFeatures this_arg_conv;
41408 this_arg_conv.inner = (void*)(this_arg & (~1));
41409 this_arg_conv.is_owned = false;
41410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41411 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41416 LDKNodeFeatures this_arg_conv;
41417 this_arg_conv.inner = (void*)(this_arg & (~1));
41418 this_arg_conv.is_owned = false;
41419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41420 NodeFeatures_set_channel_type_optional(&this_arg_conv);
41423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41424 LDKNodeFeatures this_arg_conv;
41425 this_arg_conv.inner = (void*)(this_arg & (~1));
41426 this_arg_conv.is_owned = false;
41427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41428 NodeFeatures_set_channel_type_required(&this_arg_conv);
41431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41432 LDKNodeFeatures this_arg_conv;
41433 this_arg_conv.inner = (void*)(this_arg & (~1));
41434 this_arg_conv.is_owned = false;
41435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41436 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
41440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41441 LDKInitFeatures this_arg_conv;
41442 this_arg_conv.inner = (void*)(this_arg & (~1));
41443 this_arg_conv.is_owned = false;
41444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41445 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41450 LDKNodeFeatures this_arg_conv;
41451 this_arg_conv.inner = (void*)(this_arg & (~1));
41452 this_arg_conv.is_owned = false;
41453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41454 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
41458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41459 LDKInitFeatures this_arg_conv;
41460 this_arg_conv.inner = (void*)(this_arg & (~1));
41461 this_arg_conv.is_owned = false;
41462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41463 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
41466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41467 LDKInitFeatures this_arg_conv;
41468 this_arg_conv.inner = (void*)(this_arg & (~1));
41469 this_arg_conv.is_owned = false;
41470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41471 InitFeatures_set_scid_privacy_required(&this_arg_conv);
41474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41475 LDKInitFeatures this_arg_conv;
41476 this_arg_conv.inner = (void*)(this_arg & (~1));
41477 this_arg_conv.is_owned = false;
41478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41479 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
41483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41484 LDKNodeFeatures this_arg_conv;
41485 this_arg_conv.inner = (void*)(this_arg & (~1));
41486 this_arg_conv.is_owned = false;
41487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41488 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
41491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41492 LDKNodeFeatures this_arg_conv;
41493 this_arg_conv.inner = (void*)(this_arg & (~1));
41494 this_arg_conv.is_owned = false;
41495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41496 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
41499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41500 LDKNodeFeatures this_arg_conv;
41501 this_arg_conv.inner = (void*)(this_arg & (~1));
41502 this_arg_conv.is_owned = false;
41503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41504 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
41508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41509 LDKChannelTypeFeatures this_arg_conv;
41510 this_arg_conv.inner = (void*)(this_arg & (~1));
41511 this_arg_conv.is_owned = false;
41512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41513 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
41516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41517 LDKChannelTypeFeatures this_arg_conv;
41518 this_arg_conv.inner = (void*)(this_arg & (~1));
41519 this_arg_conv.is_owned = false;
41520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41521 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
41524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41525 LDKChannelTypeFeatures this_arg_conv;
41526 this_arg_conv.inner = (void*)(this_arg & (~1));
41527 this_arg_conv.is_owned = false;
41528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41529 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
41533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41534 LDKInitFeatures this_arg_conv;
41535 this_arg_conv.inner = (void*)(this_arg & (~1));
41536 this_arg_conv.is_owned = false;
41537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41538 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
41542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41543 LDKNodeFeatures this_arg_conv;
41544 this_arg_conv.inner = (void*)(this_arg & (~1));
41545 this_arg_conv.is_owned = false;
41546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41547 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
41551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41552 LDKChannelTypeFeatures this_arg_conv;
41553 this_arg_conv.inner = (void*)(this_arg & (~1));
41554 this_arg_conv.is_owned = false;
41555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41556 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
41560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41561 LDKInitFeatures this_arg_conv;
41562 this_arg_conv.inner = (void*)(this_arg & (~1));
41563 this_arg_conv.is_owned = false;
41564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41565 InitFeatures_set_zero_conf_optional(&this_arg_conv);
41568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41569 LDKInitFeatures this_arg_conv;
41570 this_arg_conv.inner = (void*)(this_arg & (~1));
41571 this_arg_conv.is_owned = false;
41572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41573 InitFeatures_set_zero_conf_required(&this_arg_conv);
41576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41577 LDKInitFeatures this_arg_conv;
41578 this_arg_conv.inner = (void*)(this_arg & (~1));
41579 this_arg_conv.is_owned = false;
41580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41581 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
41585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41586 LDKNodeFeatures this_arg_conv;
41587 this_arg_conv.inner = (void*)(this_arg & (~1));
41588 this_arg_conv.is_owned = false;
41589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41590 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
41593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41594 LDKNodeFeatures this_arg_conv;
41595 this_arg_conv.inner = (void*)(this_arg & (~1));
41596 this_arg_conv.is_owned = false;
41597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41598 NodeFeatures_set_zero_conf_required(&this_arg_conv);
41601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41602 LDKNodeFeatures this_arg_conv;
41603 this_arg_conv.inner = (void*)(this_arg & (~1));
41604 this_arg_conv.is_owned = false;
41605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41606 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41611 LDKChannelTypeFeatures this_arg_conv;
41612 this_arg_conv.inner = (void*)(this_arg & (~1));
41613 this_arg_conv.is_owned = false;
41614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41615 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41619 LDKChannelTypeFeatures this_arg_conv;
41620 this_arg_conv.inner = (void*)(this_arg & (~1));
41621 this_arg_conv.is_owned = false;
41622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41623 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41627 LDKChannelTypeFeatures this_arg_conv;
41628 this_arg_conv.inner = (void*)(this_arg & (~1));
41629 this_arg_conv.is_owned = false;
41630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41631 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41636 LDKInitFeatures this_arg_conv;
41637 this_arg_conv.inner = (void*)(this_arg & (~1));
41638 this_arg_conv.is_owned = false;
41639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41640 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41645 LDKNodeFeatures this_arg_conv;
41646 this_arg_conv.inner = (void*)(this_arg & (~1));
41647 this_arg_conv.is_owned = false;
41648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41649 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41654 LDKChannelTypeFeatures this_arg_conv;
41655 this_arg_conv.inner = (void*)(this_arg & (~1));
41656 this_arg_conv.is_owned = false;
41657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41658 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41663 LDKNodeFeatures this_arg_conv;
41664 this_arg_conv.inner = (void*)(this_arg & (~1));
41665 this_arg_conv.is_owned = false;
41666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41667 NodeFeatures_set_keysend_optional(&this_arg_conv);
41670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41671 LDKNodeFeatures this_arg_conv;
41672 this_arg_conv.inner = (void*)(this_arg & (~1));
41673 this_arg_conv.is_owned = false;
41674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41675 NodeFeatures_set_keysend_required(&this_arg_conv);
41678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41679 LDKNodeFeatures this_arg_conv;
41680 this_arg_conv.inner = (void*)(this_arg & (~1));
41681 this_arg_conv.is_owned = false;
41682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41683 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41688 LDKNodeFeatures this_arg_conv;
41689 this_arg_conv.inner = (void*)(this_arg & (~1));
41690 this_arg_conv.is_owned = false;
41691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41692 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41697 LDKShutdownScript this_obj_conv;
41698 this_obj_conv.inner = (void*)(this_obj & (~1));
41699 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41701 ShutdownScript_free(this_obj_conv);
41704 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41705 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41706 int64_t ret_ref = 0;
41707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41710 ret_ref = (uintptr_t)ret_var.inner;
41711 if (ret_var.is_owned) {
41716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41717 LDKShutdownScript arg_conv;
41718 arg_conv.inner = (void*)(arg & (~1));
41719 arg_conv.is_owned = false;
41720 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41721 int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41726 LDKShutdownScript orig_conv;
41727 orig_conv.inner = (void*)(orig & (~1));
41728 orig_conv.is_owned = false;
41729 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41730 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41731 int64_t ret_ref = 0;
41732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41735 ret_ref = (uintptr_t)ret_var.inner;
41736 if (ret_var.is_owned) {
41742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41743 LDKInvalidShutdownScript this_obj_conv;
41744 this_obj_conv.inner = (void*)(this_obj & (~1));
41745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41747 InvalidShutdownScript_free(this_obj_conv);
41750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
41751 LDKInvalidShutdownScript this_ptr_conv;
41752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41753 this_ptr_conv.is_owned = false;
41754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41755 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41756 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41757 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41762 LDKInvalidShutdownScript this_ptr_conv;
41763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41764 this_ptr_conv.is_owned = false;
41765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41766 LDKCVec_u8Z val_ref;
41767 val_ref.datalen = (*env)->GetArrayLength(env, val);
41768 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41769 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41770 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
41774 LDKCVec_u8Z script_arg_ref;
41775 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
41776 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41777 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
41778 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41779 int64_t ret_ref = 0;
41780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41783 ret_ref = (uintptr_t)ret_var.inner;
41784 if (ret_var.is_owned) {
41790 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41791 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41792 int64_t ret_ref = 0;
41793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41796 ret_ref = (uintptr_t)ret_var.inner;
41797 if (ret_var.is_owned) {
41802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41803 LDKInvalidShutdownScript arg_conv;
41804 arg_conv.inner = (void*)(arg & (~1));
41805 arg_conv.is_owned = false;
41806 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41807 int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41812 LDKInvalidShutdownScript orig_conv;
41813 orig_conv.inner = (void*)(orig & (~1));
41814 orig_conv.is_owned = false;
41815 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41816 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41817 int64_t ret_ref = 0;
41818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41821 ret_ref = (uintptr_t)ret_var.inner;
41822 if (ret_var.is_owned) {
41828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
41829 LDKShutdownScript obj_conv;
41830 obj_conv.inner = (void*)(obj & (~1));
41831 obj_conv.is_owned = false;
41832 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41833 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41834 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41835 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41836 CVec_u8Z_free(ret_var);
41840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41841 LDKu8slice ser_ref;
41842 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41843 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41844 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41845 *ret_conv = ShutdownScript_read(ser_ref);
41846 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41847 return (int64_t)ret_conv;
41850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
41851 unsigned char pubkey_hash_arr[20];
41852 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
41853 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
41854 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41855 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41856 int64_t ret_ref = 0;
41857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41860 ret_ref = (uintptr_t)ret_var.inner;
41861 if (ret_var.is_owned) {
41867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
41868 unsigned char script_hash_arr[32];
41869 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
41870 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
41871 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41872 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41873 int64_t ret_ref = 0;
41874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41877 ret_ref = (uintptr_t)ret_var.inner;
41878 if (ret_var.is_owned) {
41884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41886 LDKu8slice program_ref;
41887 program_ref.datalen = (*env)->GetArrayLength(env, program);
41888 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
41889 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41890 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41891 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
41892 return (int64_t)ret_conv;
41895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
41896 LDKShutdownScript this_arg_conv;
41897 this_arg_conv.inner = (void*)(this_arg & (~1));
41898 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
41899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41900 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41901 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41902 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41903 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41904 CVec_u8Z_free(ret_var);
41908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
41909 LDKShutdownScript this_arg_conv;
41910 this_arg_conv.inner = (void*)(this_arg & (~1));
41911 this_arg_conv.is_owned = false;
41912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41913 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
41918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
41919 LDKShutdownScript this_arg_conv;
41920 this_arg_conv.inner = (void*)(this_arg & (~1));
41921 this_arg_conv.is_owned = false;
41922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41923 LDKInitFeatures features_conv;
41924 features_conv.inner = (void*)(features & (~1));
41925 features_conv.is_owned = false;
41926 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41927 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41932 if ((this_ptr & 1) != 0) return;
41933 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41934 CHECK_ACCESS(this_ptr_ptr);
41935 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41936 FREE((void*)this_ptr);
41937 CustomMessageReader_free(this_ptr_conv);
41940 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41941 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41942 *ret_ret = Type_clone(arg);
41943 return (int64_t)ret_ret;
41945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41946 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
41947 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
41948 LDKType* arg_conv = (LDKType*)arg_ptr;
41949 int64_t ret_conv = Type_clone_ptr(arg_conv);
41953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41954 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
41955 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
41956 LDKType* orig_conv = (LDKType*)orig_ptr;
41957 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41958 *ret_ret = Type_clone(orig_conv);
41959 return (int64_t)ret_ret;
41962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41963 if ((this_ptr & 1) != 0) return;
41964 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41965 CHECK_ACCESS(this_ptr_ptr);
41966 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41967 FREE((void*)this_ptr);
41968 Type_free(this_ptr_conv);
41971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41972 LDKNodeId this_obj_conv;
41973 this_obj_conv.inner = (void*)(this_obj & (~1));
41974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41976 NodeId_free(this_obj_conv);
41979 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41980 LDKNodeId ret_var = NodeId_clone(arg);
41981 int64_t ret_ref = 0;
41982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41985 ret_ref = (uintptr_t)ret_var.inner;
41986 if (ret_var.is_owned) {
41991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41992 LDKNodeId arg_conv;
41993 arg_conv.inner = (void*)(arg & (~1));
41994 arg_conv.is_owned = false;
41995 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41996 int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
42000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42001 LDKNodeId orig_conv;
42002 orig_conv.inner = (void*)(orig & (~1));
42003 orig_conv.is_owned = false;
42004 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42005 LDKNodeId ret_var = NodeId_clone(&orig_conv);
42006 int64_t ret_ref = 0;
42007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42010 ret_ref = (uintptr_t)ret_var.inner;
42011 if (ret_var.is_owned) {
42017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
42018 LDKPublicKey pubkey_ref;
42019 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
42020 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
42021 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
42022 int64_t ret_ref = 0;
42023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42026 ret_ref = (uintptr_t)ret_var.inner;
42027 if (ret_var.is_owned) {
42033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
42034 LDKNodeId this_arg_conv;
42035 this_arg_conv.inner = (void*)(this_arg & (~1));
42036 this_arg_conv.is_owned = false;
42037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42038 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
42039 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42040 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
42046 o_conv.inner = (void*)(o & (~1));
42047 o_conv.is_owned = false;
42048 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42049 int64_t ret_conv = NodeId_hash(&o_conv);
42053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
42054 LDKNodeId obj_conv;
42055 obj_conv.inner = (void*)(obj & (~1));
42056 obj_conv.is_owned = false;
42057 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42058 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
42059 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42060 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42061 CVec_u8Z_free(ret_var);
42065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42066 LDKu8slice ser_ref;
42067 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42068 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42069 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
42070 *ret_conv = NodeId_read(ser_ref);
42071 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42072 return (int64_t)ret_conv;
42075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42076 LDKNetworkGraph this_obj_conv;
42077 this_obj_conv.inner = (void*)(this_obj & (~1));
42078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42080 NetworkGraph_free(this_obj_conv);
42083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42084 LDKReadOnlyNetworkGraph this_obj_conv;
42085 this_obj_conv.inner = (void*)(this_obj & (~1));
42086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42088 ReadOnlyNetworkGraph_free(this_obj_conv);
42091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42092 if ((this_ptr & 1) != 0) return;
42093 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42094 CHECK_ACCESS(this_ptr_ptr);
42095 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
42096 FREE((void*)this_ptr);
42097 NetworkUpdate_free(this_ptr_conv);
42100 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
42101 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42102 *ret_copy = NetworkUpdate_clone(arg);
42103 int64_t ret_ref = (uintptr_t)ret_copy;
42106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42107 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
42108 int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
42112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42113 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
42114 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42115 *ret_copy = NetworkUpdate_clone(orig_conv);
42116 int64_t ret_ref = (uintptr_t)ret_copy;
42120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
42121 LDKChannelUpdate msg_conv;
42122 msg_conv.inner = (void*)(msg & (~1));
42123 msg_conv.is_owned = (msg & 1) || (msg == 0);
42124 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42125 msg_conv = ChannelUpdate_clone(&msg_conv);
42126 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42127 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
42128 int64_t ret_ref = (uintptr_t)ret_copy;
42132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
42133 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42134 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
42135 int64_t ret_ref = (uintptr_t)ret_copy;
42139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
42140 LDKPublicKey node_id_ref;
42141 CHECK((*env)->GetArrayLength(env, node_id) == 33);
42142 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
42143 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42144 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
42145 int64_t ret_ref = (uintptr_t)ret_copy;
42149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
42150 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
42151 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
42152 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42153 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42154 CVec_u8Z_free(ret_var);
42158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42159 LDKu8slice ser_ref;
42160 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42161 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42162 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
42163 *ret_conv = NetworkUpdate_read(ser_ref);
42164 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42165 return (int64_t)ret_conv;
42168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42169 LDKP2PGossipSync this_obj_conv;
42170 this_obj_conv.inner = (void*)(this_obj & (~1));
42171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42173 P2PGossipSync_free(this_obj_conv);
42176 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) {
42177 LDKNetworkGraph network_graph_conv;
42178 network_graph_conv.inner = (void*)(network_graph & (~1));
42179 network_graph_conv.is_owned = false;
42180 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42181 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
42182 CHECK_ACCESS(chain_access_ptr);
42183 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
42184 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
42185 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
42186 // Manually implement clone for Java trait instances
42187 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
42188 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42189 LDKAccess_JCalls_cloned(&chain_access_conv.some);
42192 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42193 CHECK_ACCESS(logger_ptr);
42194 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42195 if (logger_conv.free == LDKLogger_JCalls_free) {
42196 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42197 LDKLogger_JCalls_cloned(&logger_conv);
42199 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
42200 int64_t ret_ref = 0;
42201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42204 ret_ref = (uintptr_t)ret_var.inner;
42205 if (ret_var.is_owned) {
42211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
42212 LDKP2PGossipSync this_arg_conv;
42213 this_arg_conv.inner = (void*)(this_arg & (~1));
42214 this_arg_conv.is_owned = false;
42215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42216 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
42217 CHECK_ACCESS(chain_access_ptr);
42218 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
42219 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
42220 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
42221 // Manually implement clone for Java trait instances
42222 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
42223 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42224 LDKAccess_JCalls_cloned(&chain_access_conv.some);
42227 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
42230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
42231 LDKNetworkGraph this_arg_conv;
42232 this_arg_conv.inner = (void*)(this_arg & (~1));
42233 this_arg_conv.is_owned = false;
42234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42235 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
42236 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
42237 return (int64_t)ret_ret;
42240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
42241 LDKP2PGossipSync this_arg_conv;
42242 this_arg_conv.inner = (void*)(this_arg & (~1));
42243 this_arg_conv.is_owned = false;
42244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42245 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
42246 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
42247 return (int64_t)ret_ret;
42250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
42251 LDKP2PGossipSync this_arg_conv;
42252 this_arg_conv.inner = (void*)(this_arg & (~1));
42253 this_arg_conv.is_owned = false;
42254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42255 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
42256 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
42257 return (int64_t)ret_ret;
42260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42261 LDKChannelUpdateInfo this_obj_conv;
42262 this_obj_conv.inner = (void*)(this_obj & (~1));
42263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42265 ChannelUpdateInfo_free(this_obj_conv);
42268 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
42269 LDKChannelUpdateInfo this_ptr_conv;
42270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42271 this_ptr_conv.is_owned = false;
42272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42273 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
42277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42278 LDKChannelUpdateInfo this_ptr_conv;
42279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42280 this_ptr_conv.is_owned = false;
42281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42282 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
42285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
42286 LDKChannelUpdateInfo this_ptr_conv;
42287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42288 this_ptr_conv.is_owned = false;
42289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42290 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
42294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42295 LDKChannelUpdateInfo this_ptr_conv;
42296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42297 this_ptr_conv.is_owned = false;
42298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42299 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
42302 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42303 LDKChannelUpdateInfo this_ptr_conv;
42304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42305 this_ptr_conv.is_owned = false;
42306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42307 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
42311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42312 LDKChannelUpdateInfo this_ptr_conv;
42313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42314 this_ptr_conv.is_owned = false;
42315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42316 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42320 LDKChannelUpdateInfo this_ptr_conv;
42321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42322 this_ptr_conv.is_owned = false;
42323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42324 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
42328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42329 LDKChannelUpdateInfo this_ptr_conv;
42330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42331 this_ptr_conv.is_owned = false;
42332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42333 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
42336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42337 LDKChannelUpdateInfo this_ptr_conv;
42338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42339 this_ptr_conv.is_owned = false;
42340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42341 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42342 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
42343 int64_t ret_ref = (uintptr_t)ret_copy;
42347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42348 LDKChannelUpdateInfo this_ptr_conv;
42349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42350 this_ptr_conv.is_owned = false;
42351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42352 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42353 CHECK_ACCESS(val_ptr);
42354 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42355 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42356 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42360 LDKChannelUpdateInfo this_ptr_conv;
42361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42362 this_ptr_conv.is_owned = false;
42363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42364 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
42365 int64_t ret_ref = 0;
42366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42369 ret_ref = (uintptr_t)ret_var.inner;
42370 if (ret_var.is_owned) {
42376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42377 LDKChannelUpdateInfo this_ptr_conv;
42378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42379 this_ptr_conv.is_owned = false;
42380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42381 LDKRoutingFees val_conv;
42382 val_conv.inner = (void*)(val & (~1));
42383 val_conv.is_owned = (val & 1) || (val == 0);
42384 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42385 val_conv = RoutingFees_clone(&val_conv);
42386 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
42389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42390 LDKChannelUpdateInfo this_ptr_conv;
42391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42392 this_ptr_conv.is_owned = false;
42393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42394 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
42395 int64_t ret_ref = 0;
42396 if ((uintptr_t)ret_var.inner > 4096) {
42397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42400 ret_ref = (uintptr_t)ret_var.inner;
42401 if (ret_var.is_owned) {
42408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42409 LDKChannelUpdateInfo this_ptr_conv;
42410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42411 this_ptr_conv.is_owned = false;
42412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42413 LDKChannelUpdate val_conv;
42414 val_conv.inner = (void*)(val & (~1));
42415 val_conv.is_owned = (val & 1) || (val == 0);
42416 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42417 val_conv = ChannelUpdate_clone(&val_conv);
42418 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
42421 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) {
42422 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42423 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42424 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42425 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42426 LDKRoutingFees fees_arg_conv;
42427 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42428 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42429 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42430 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42431 LDKChannelUpdate last_update_message_arg_conv;
42432 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
42433 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
42434 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
42435 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
42436 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
42437 int64_t ret_ref = 0;
42438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42441 ret_ref = (uintptr_t)ret_var.inner;
42442 if (ret_var.is_owned) {
42448 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
42449 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
42450 int64_t ret_ref = 0;
42451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42454 ret_ref = (uintptr_t)ret_var.inner;
42455 if (ret_var.is_owned) {
42460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42461 LDKChannelUpdateInfo arg_conv;
42462 arg_conv.inner = (void*)(arg & (~1));
42463 arg_conv.is_owned = false;
42464 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42465 int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
42469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42470 LDKChannelUpdateInfo orig_conv;
42471 orig_conv.inner = (void*)(orig & (~1));
42472 orig_conv.is_owned = false;
42473 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42474 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
42475 int64_t ret_ref = 0;
42476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42479 ret_ref = (uintptr_t)ret_var.inner;
42480 if (ret_var.is_owned) {
42486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42487 LDKChannelUpdateInfo obj_conv;
42488 obj_conv.inner = (void*)(obj & (~1));
42489 obj_conv.is_owned = false;
42490 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42491 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
42492 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42493 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42494 CVec_u8Z_free(ret_var);
42498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42499 LDKu8slice ser_ref;
42500 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42501 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42502 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
42503 *ret_conv = ChannelUpdateInfo_read(ser_ref);
42504 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42505 return (int64_t)ret_conv;
42508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42509 LDKChannelInfo this_obj_conv;
42510 this_obj_conv.inner = (void*)(this_obj & (~1));
42511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42513 ChannelInfo_free(this_obj_conv);
42516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42517 LDKChannelInfo this_ptr_conv;
42518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42519 this_ptr_conv.is_owned = false;
42520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42521 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
42522 int64_t ret_ref = 0;
42523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42526 ret_ref = (uintptr_t)ret_var.inner;
42527 if (ret_var.is_owned) {
42533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42534 LDKChannelInfo this_ptr_conv;
42535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42536 this_ptr_conv.is_owned = false;
42537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42538 LDKChannelFeatures val_conv;
42539 val_conv.inner = (void*)(val & (~1));
42540 val_conv.is_owned = (val & 1) || (val == 0);
42541 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42542 val_conv = ChannelFeatures_clone(&val_conv);
42543 ChannelInfo_set_features(&this_ptr_conv, val_conv);
42546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
42547 LDKChannelInfo this_ptr_conv;
42548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42549 this_ptr_conv.is_owned = false;
42550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42551 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
42552 int64_t ret_ref = 0;
42553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42556 ret_ref = (uintptr_t)ret_var.inner;
42557 if (ret_var.is_owned) {
42563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42564 LDKChannelInfo this_ptr_conv;
42565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42566 this_ptr_conv.is_owned = false;
42567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42568 LDKNodeId val_conv;
42569 val_conv.inner = (void*)(val & (~1));
42570 val_conv.is_owned = (val & 1) || (val == 0);
42571 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42572 val_conv = NodeId_clone(&val_conv);
42573 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
42576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
42577 LDKChannelInfo this_ptr_conv;
42578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42579 this_ptr_conv.is_owned = false;
42580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42581 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
42582 int64_t ret_ref = 0;
42583 if ((uintptr_t)ret_var.inner > 4096) {
42584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42587 ret_ref = (uintptr_t)ret_var.inner;
42588 if (ret_var.is_owned) {
42595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42596 LDKChannelInfo this_ptr_conv;
42597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42598 this_ptr_conv.is_owned = false;
42599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42600 LDKChannelUpdateInfo val_conv;
42601 val_conv.inner = (void*)(val & (~1));
42602 val_conv.is_owned = (val & 1) || (val == 0);
42603 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42604 val_conv = ChannelUpdateInfo_clone(&val_conv);
42605 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
42608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
42609 LDKChannelInfo this_ptr_conv;
42610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42611 this_ptr_conv.is_owned = false;
42612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42613 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
42614 int64_t ret_ref = 0;
42615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42618 ret_ref = (uintptr_t)ret_var.inner;
42619 if (ret_var.is_owned) {
42625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42626 LDKChannelInfo this_ptr_conv;
42627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42628 this_ptr_conv.is_owned = false;
42629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42630 LDKNodeId val_conv;
42631 val_conv.inner = (void*)(val & (~1));
42632 val_conv.is_owned = (val & 1) || (val == 0);
42633 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42634 val_conv = NodeId_clone(&val_conv);
42635 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
42638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
42639 LDKChannelInfo this_ptr_conv;
42640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42641 this_ptr_conv.is_owned = false;
42642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42643 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
42644 int64_t ret_ref = 0;
42645 if ((uintptr_t)ret_var.inner > 4096) {
42646 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42647 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42649 ret_ref = (uintptr_t)ret_var.inner;
42650 if (ret_var.is_owned) {
42657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42658 LDKChannelInfo this_ptr_conv;
42659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42660 this_ptr_conv.is_owned = false;
42661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42662 LDKChannelUpdateInfo val_conv;
42663 val_conv.inner = (void*)(val & (~1));
42664 val_conv.is_owned = (val & 1) || (val == 0);
42665 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42666 val_conv = ChannelUpdateInfo_clone(&val_conv);
42667 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42671 LDKChannelInfo this_ptr_conv;
42672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42673 this_ptr_conv.is_owned = false;
42674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42675 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42676 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42677 int64_t ret_ref = (uintptr_t)ret_copy;
42681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42682 LDKChannelInfo this_ptr_conv;
42683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42684 this_ptr_conv.is_owned = false;
42685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42686 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42687 CHECK_ACCESS(val_ptr);
42688 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42689 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42690 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42694 LDKChannelInfo this_ptr_conv;
42695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42696 this_ptr_conv.is_owned = false;
42697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42698 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42699 int64_t ret_ref = 0;
42700 if ((uintptr_t)ret_var.inner > 4096) {
42701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42704 ret_ref = (uintptr_t)ret_var.inner;
42705 if (ret_var.is_owned) {
42712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42713 LDKChannelInfo this_ptr_conv;
42714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42715 this_ptr_conv.is_owned = false;
42716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42717 LDKChannelAnnouncement val_conv;
42718 val_conv.inner = (void*)(val & (~1));
42719 val_conv.is_owned = (val & 1) || (val == 0);
42720 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42721 val_conv = ChannelAnnouncement_clone(&val_conv);
42722 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42725 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42726 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42727 int64_t ret_ref = 0;
42728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42731 ret_ref = (uintptr_t)ret_var.inner;
42732 if (ret_var.is_owned) {
42737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42738 LDKChannelInfo arg_conv;
42739 arg_conv.inner = (void*)(arg & (~1));
42740 arg_conv.is_owned = false;
42741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42742 int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42747 LDKChannelInfo orig_conv;
42748 orig_conv.inner = (void*)(orig & (~1));
42749 orig_conv.is_owned = false;
42750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42751 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42752 int64_t ret_ref = 0;
42753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42756 ret_ref = (uintptr_t)ret_var.inner;
42757 if (ret_var.is_owned) {
42763 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) {
42764 LDKChannelInfo this_arg_conv;
42765 this_arg_conv.inner = (void*)(this_arg & (~1));
42766 this_arg_conv.is_owned = false;
42767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42768 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42769 int64_t ret_ref = 0;
42770 if ((uintptr_t)ret_var.inner > 4096) {
42771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42774 ret_ref = (uintptr_t)ret_var.inner;
42775 if (ret_var.is_owned) {
42782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42783 LDKChannelInfo obj_conv;
42784 obj_conv.inner = (void*)(obj & (~1));
42785 obj_conv.is_owned = false;
42786 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42787 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42788 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42789 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42790 CVec_u8Z_free(ret_var);
42794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42795 LDKu8slice ser_ref;
42796 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42797 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42798 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42799 *ret_conv = ChannelInfo_read(ser_ref);
42800 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42801 return (int64_t)ret_conv;
42804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42805 LDKDirectedChannelInfo this_obj_conv;
42806 this_obj_conv.inner = (void*)(this_obj & (~1));
42807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42809 DirectedChannelInfo_free(this_obj_conv);
42812 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42813 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
42814 int64_t ret_ref = 0;
42815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42818 ret_ref = (uintptr_t)ret_var.inner;
42819 if (ret_var.is_owned) {
42824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42825 LDKDirectedChannelInfo arg_conv;
42826 arg_conv.inner = (void*)(arg & (~1));
42827 arg_conv.is_owned = false;
42828 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42829 int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
42833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42834 LDKDirectedChannelInfo orig_conv;
42835 orig_conv.inner = (void*)(orig & (~1));
42836 orig_conv.is_owned = false;
42837 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42838 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
42839 int64_t ret_ref = 0;
42840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42843 ret_ref = (uintptr_t)ret_var.inner;
42844 if (ret_var.is_owned) {
42850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
42851 LDKDirectedChannelInfo this_arg_conv;
42852 this_arg_conv.inner = (void*)(this_arg & (~1));
42853 this_arg_conv.is_owned = false;
42854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42855 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42856 int64_t ret_ref = 0;
42857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42860 ret_ref = (uintptr_t)ret_var.inner;
42861 if (ret_var.is_owned) {
42867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
42868 LDKDirectedChannelInfo this_arg_conv;
42869 this_arg_conv.inner = (void*)(this_arg & (~1));
42870 this_arg_conv.is_owned = false;
42871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42872 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
42873 int64_t ret_ref = 0;
42874 if ((uintptr_t)ret_var.inner > 4096) {
42875 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42876 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42878 ret_ref = (uintptr_t)ret_var.inner;
42879 if (ret_var.is_owned) {
42886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42887 LDKDirectedChannelInfo this_arg_conv;
42888 this_arg_conv.inner = (void*)(this_arg & (~1));
42889 this_arg_conv.is_owned = false;
42890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42891 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
42896 LDKDirectedChannelInfo this_arg_conv;
42897 this_arg_conv.inner = (void*)(this_arg & (~1));
42898 this_arg_conv.is_owned = false;
42899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42900 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42901 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42902 int64_t ret_ref = (uintptr_t)ret_copy;
42906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42907 if ((this_ptr & 1) != 0) return;
42908 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42909 CHECK_ACCESS(this_ptr_ptr);
42910 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42911 FREE((void*)this_ptr);
42912 EffectiveCapacity_free(this_ptr_conv);
42915 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42916 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42917 *ret_copy = EffectiveCapacity_clone(arg);
42918 int64_t ret_ref = (uintptr_t)ret_copy;
42921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42922 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
42923 int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42928 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
42929 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42930 *ret_copy = EffectiveCapacity_clone(orig_conv);
42931 int64_t ret_ref = (uintptr_t)ret_copy;
42935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
42936 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42937 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42938 int64_t ret_ref = (uintptr_t)ret_copy;
42942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
42943 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42944 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42945 int64_t ret_ref = (uintptr_t)ret_copy;
42949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
42950 void* htlc_maximum_msat_ptr = (void*)(((uintptr_t)htlc_maximum_msat) & ~1);
42951 CHECK_ACCESS(htlc_maximum_msat_ptr);
42952 LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
42953 htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat) & ~1));
42954 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42955 *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
42956 int64_t ret_ref = (uintptr_t)ret_copy;
42960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
42961 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42962 *ret_copy = EffectiveCapacity_infinite();
42963 int64_t ret_ref = (uintptr_t)ret_copy;
42967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
42968 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42969 *ret_copy = EffectiveCapacity_unknown();
42970 int64_t ret_ref = (uintptr_t)ret_copy;
42974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42975 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
42976 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42981 LDKRoutingFees this_obj_conv;
42982 this_obj_conv.inner = (void*)(this_obj & (~1));
42983 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42985 RoutingFees_free(this_obj_conv);
42988 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42989 LDKRoutingFees this_ptr_conv;
42990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42991 this_ptr_conv.is_owned = false;
42992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42993 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42998 LDKRoutingFees this_ptr_conv;
42999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43000 this_ptr_conv.is_owned = false;
43001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43002 RoutingFees_set_base_msat(&this_ptr_conv, val);
43005 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43006 LDKRoutingFees this_ptr_conv;
43007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43008 this_ptr_conv.is_owned = false;
43009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43010 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
43014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43015 LDKRoutingFees this_ptr_conv;
43016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43017 this_ptr_conv.is_owned = false;
43018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43019 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
43022 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) {
43023 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
43024 int64_t ret_ref = 0;
43025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43028 ret_ref = (uintptr_t)ret_var.inner;
43029 if (ret_var.is_owned) {
43035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43036 LDKRoutingFees a_conv;
43037 a_conv.inner = (void*)(a & (~1));
43038 a_conv.is_owned = false;
43039 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43040 LDKRoutingFees b_conv;
43041 b_conv.inner = (void*)(b & (~1));
43042 b_conv.is_owned = false;
43043 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43044 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
43048 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
43049 LDKRoutingFees ret_var = RoutingFees_clone(arg);
43050 int64_t ret_ref = 0;
43051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43054 ret_ref = (uintptr_t)ret_var.inner;
43055 if (ret_var.is_owned) {
43060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43061 LDKRoutingFees arg_conv;
43062 arg_conv.inner = (void*)(arg & (~1));
43063 arg_conv.is_owned = false;
43064 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43065 int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
43069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43070 LDKRoutingFees orig_conv;
43071 orig_conv.inner = (void*)(orig & (~1));
43072 orig_conv.is_owned = false;
43073 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43074 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
43075 int64_t ret_ref = 0;
43076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43079 ret_ref = (uintptr_t)ret_var.inner;
43080 if (ret_var.is_owned) {
43086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
43087 LDKRoutingFees o_conv;
43088 o_conv.inner = (void*)(o & (~1));
43089 o_conv.is_owned = false;
43090 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43091 int64_t ret_conv = RoutingFees_hash(&o_conv);
43095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
43096 LDKRoutingFees obj_conv;
43097 obj_conv.inner = (void*)(obj & (~1));
43098 obj_conv.is_owned = false;
43099 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43100 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
43101 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43102 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43103 CVec_u8Z_free(ret_var);
43107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43108 LDKu8slice ser_ref;
43109 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43110 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43111 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
43112 *ret_conv = RoutingFees_read(ser_ref);
43113 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43114 return (int64_t)ret_conv;
43117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43118 LDKNodeAnnouncementInfo this_obj_conv;
43119 this_obj_conv.inner = (void*)(this_obj & (~1));
43120 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43122 NodeAnnouncementInfo_free(this_obj_conv);
43125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43126 LDKNodeAnnouncementInfo this_ptr_conv;
43127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43128 this_ptr_conv.is_owned = false;
43129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43130 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
43131 int64_t ret_ref = 0;
43132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43135 ret_ref = (uintptr_t)ret_var.inner;
43136 if (ret_var.is_owned) {
43142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43143 LDKNodeAnnouncementInfo this_ptr_conv;
43144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43145 this_ptr_conv.is_owned = false;
43146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43147 LDKNodeFeatures val_conv;
43148 val_conv.inner = (void*)(val & (~1));
43149 val_conv.is_owned = (val & 1) || (val == 0);
43150 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43151 val_conv = NodeFeatures_clone(&val_conv);
43152 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
43155 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
43156 LDKNodeAnnouncementInfo this_ptr_conv;
43157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43158 this_ptr_conv.is_owned = false;
43159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43160 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
43164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43165 LDKNodeAnnouncementInfo this_ptr_conv;
43166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43167 this_ptr_conv.is_owned = false;
43168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43169 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
43172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
43173 LDKNodeAnnouncementInfo this_ptr_conv;
43174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43175 this_ptr_conv.is_owned = false;
43176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43177 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
43178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
43182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43183 LDKNodeAnnouncementInfo 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 LDKThreeBytes val_ref;
43188 CHECK((*env)->GetArrayLength(env, val) == 3);
43189 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
43190 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
43193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
43194 LDKNodeAnnouncementInfo this_ptr_conv;
43195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43196 this_ptr_conv.is_owned = false;
43197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198 LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
43199 int64_t ret_ref = 0;
43200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43203 ret_ref = (uintptr_t)ret_var.inner;
43204 if (ret_var.is_owned) {
43210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43211 LDKNodeAnnouncementInfo this_ptr_conv;
43212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43213 this_ptr_conv.is_owned = false;
43214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43215 LDKNodeAlias val_conv;
43216 val_conv.inner = (void*)(val & (~1));
43217 val_conv.is_owned = (val & 1) || (val == 0);
43218 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43219 val_conv = NodeAlias_clone(&val_conv);
43220 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
43223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43224 LDKNodeAnnouncementInfo this_ptr_conv;
43225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43226 this_ptr_conv.is_owned = false;
43227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43228 LDKCVec_NetAddressZ val_constr;
43229 val_constr.datalen = (*env)->GetArrayLength(env, val);
43230 if (val_constr.datalen > 0)
43231 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
43233 val_constr.data = NULL;
43234 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43235 for (size_t m = 0; m < val_constr.datalen; m++) {
43236 int64_t val_conv_12 = val_vals[m];
43237 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
43238 CHECK_ACCESS(val_conv_12_ptr);
43239 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
43240 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
43241 val_constr.data[m] = val_conv_12_conv;
43243 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43244 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
43247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43248 LDKNodeAnnouncementInfo this_ptr_conv;
43249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43250 this_ptr_conv.is_owned = false;
43251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43252 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
43253 int64_t ret_ref = 0;
43254 if ((uintptr_t)ret_var.inner > 4096) {
43255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43258 ret_ref = (uintptr_t)ret_var.inner;
43259 if (ret_var.is_owned) {
43266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43267 LDKNodeAnnouncementInfo this_ptr_conv;
43268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43269 this_ptr_conv.is_owned = false;
43270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43271 LDKNodeAnnouncement val_conv;
43272 val_conv.inner = (void*)(val & (~1));
43273 val_conv.is_owned = (val & 1) || (val == 0);
43274 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43275 val_conv = NodeAnnouncement_clone(&val_conv);
43276 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
43279 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) {
43280 LDKNodeFeatures features_arg_conv;
43281 features_arg_conv.inner = (void*)(features_arg & (~1));
43282 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
43283 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43284 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
43285 LDKThreeBytes rgb_arg_ref;
43286 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
43287 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
43288 LDKNodeAlias alias_arg_conv;
43289 alias_arg_conv.inner = (void*)(alias_arg & (~1));
43290 alias_arg_conv.is_owned = (alias_arg & 1) || (alias_arg == 0);
43291 CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
43292 alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
43293 LDKCVec_NetAddressZ addresses_arg_constr;
43294 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
43295 if (addresses_arg_constr.datalen > 0)
43296 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
43298 addresses_arg_constr.data = NULL;
43299 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
43300 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
43301 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
43302 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
43303 CHECK_ACCESS(addresses_arg_conv_12_ptr);
43304 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
43305 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
43307 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
43308 LDKNodeAnnouncement announcement_message_arg_conv;
43309 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
43310 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
43311 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
43312 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
43313 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
43314 int64_t ret_ref = 0;
43315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43318 ret_ref = (uintptr_t)ret_var.inner;
43319 if (ret_var.is_owned) {
43325 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
43326 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
43327 int64_t ret_ref = 0;
43328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43331 ret_ref = (uintptr_t)ret_var.inner;
43332 if (ret_var.is_owned) {
43337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43338 LDKNodeAnnouncementInfo arg_conv;
43339 arg_conv.inner = (void*)(arg & (~1));
43340 arg_conv.is_owned = false;
43341 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43342 int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
43346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43347 LDKNodeAnnouncementInfo orig_conv;
43348 orig_conv.inner = (void*)(orig & (~1));
43349 orig_conv.is_owned = false;
43350 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43351 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
43352 int64_t ret_ref = 0;
43353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43356 ret_ref = (uintptr_t)ret_var.inner;
43357 if (ret_var.is_owned) {
43363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43364 LDKNodeAnnouncementInfo obj_conv;
43365 obj_conv.inner = (void*)(obj & (~1));
43366 obj_conv.is_owned = false;
43367 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43368 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
43369 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43370 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43371 CVec_u8Z_free(ret_var);
43375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43376 LDKu8slice ser_ref;
43377 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43378 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43379 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
43380 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
43381 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43382 return (int64_t)ret_conv;
43385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43386 LDKNodeAlias this_obj_conv;
43387 this_obj_conv.inner = (void*)(this_obj & (~1));
43388 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43390 NodeAlias_free(this_obj_conv);
43393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
43394 LDKNodeAlias this_ptr_conv;
43395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43396 this_ptr_conv.is_owned = false;
43397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43398 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43399 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
43403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43404 LDKNodeAlias this_ptr_conv;
43405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43406 this_ptr_conv.is_owned = false;
43407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43408 LDKThirtyTwoBytes val_ref;
43409 CHECK((*env)->GetArrayLength(env, val) == 32);
43410 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43411 NodeAlias_set_a(&this_ptr_conv, val_ref);
43414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
43415 LDKThirtyTwoBytes a_arg_ref;
43416 CHECK((*env)->GetArrayLength(env, a_arg) == 32);
43417 (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
43418 LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
43419 int64_t ret_ref = 0;
43420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43423 ret_ref = (uintptr_t)ret_var.inner;
43424 if (ret_var.is_owned) {
43430 static inline uintptr_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
43431 LDKNodeAlias ret_var = NodeAlias_clone(arg);
43432 int64_t ret_ref = 0;
43433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43436 ret_ref = (uintptr_t)ret_var.inner;
43437 if (ret_var.is_owned) {
43442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43443 LDKNodeAlias arg_conv;
43444 arg_conv.inner = (void*)(arg & (~1));
43445 arg_conv.is_owned = false;
43446 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43447 int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
43451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43452 LDKNodeAlias orig_conv;
43453 orig_conv.inner = (void*)(orig & (~1));
43454 orig_conv.is_owned = false;
43455 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43456 LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
43457 int64_t ret_ref = 0;
43458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43461 ret_ref = (uintptr_t)ret_var.inner;
43462 if (ret_var.is_owned) {
43468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
43469 LDKNodeAlias obj_conv;
43470 obj_conv.inner = (void*)(obj & (~1));
43471 obj_conv.is_owned = false;
43472 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43473 LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
43474 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43475 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43476 CVec_u8Z_free(ret_var);
43480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43481 LDKu8slice ser_ref;
43482 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43483 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43484 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
43485 *ret_conv = NodeAlias_read(ser_ref);
43486 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43487 return (int64_t)ret_conv;
43490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43491 LDKNodeInfo this_obj_conv;
43492 this_obj_conv.inner = (void*)(this_obj & (~1));
43493 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43495 NodeInfo_free(this_obj_conv);
43498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43499 LDKNodeInfo this_ptr_conv;
43500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43501 this_ptr_conv.is_owned = false;
43502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43503 LDKCVec_u64Z val_constr;
43504 val_constr.datalen = (*env)->GetArrayLength(env, val);
43505 if (val_constr.datalen > 0)
43506 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43508 val_constr.data = NULL;
43509 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43510 for (size_t g = 0; g < val_constr.datalen; g++) {
43511 int64_t val_conv_6 = val_vals[g];
43512 val_constr.data[g] = val_conv_6;
43514 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43515 NodeInfo_set_channels(&this_ptr_conv, val_constr);
43518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
43519 LDKNodeInfo this_ptr_conv;
43520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43521 this_ptr_conv.is_owned = false;
43522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43523 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
43524 int64_t ret_ref = 0;
43525 if ((uintptr_t)ret_var.inner > 4096) {
43526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43529 ret_ref = (uintptr_t)ret_var.inner;
43530 if (ret_var.is_owned) {
43537 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) {
43538 LDKNodeInfo this_ptr_conv;
43539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43540 this_ptr_conv.is_owned = false;
43541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43542 LDKRoutingFees val_conv;
43543 val_conv.inner = (void*)(val & (~1));
43544 val_conv.is_owned = (val & 1) || (val == 0);
43545 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43546 val_conv = RoutingFees_clone(&val_conv);
43547 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
43550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
43551 LDKNodeInfo this_ptr_conv;
43552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43553 this_ptr_conv.is_owned = false;
43554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43555 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
43556 int64_t ret_ref = 0;
43557 if ((uintptr_t)ret_var.inner > 4096) {
43558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43561 ret_ref = (uintptr_t)ret_var.inner;
43562 if (ret_var.is_owned) {
43569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43570 LDKNodeInfo this_ptr_conv;
43571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43572 this_ptr_conv.is_owned = false;
43573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43574 LDKNodeAnnouncementInfo val_conv;
43575 val_conv.inner = (void*)(val & (~1));
43576 val_conv.is_owned = (val & 1) || (val == 0);
43577 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43578 val_conv = NodeAnnouncementInfo_clone(&val_conv);
43579 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
43582 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) {
43583 LDKCVec_u64Z channels_arg_constr;
43584 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
43585 if (channels_arg_constr.datalen > 0)
43586 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43588 channels_arg_constr.data = NULL;
43589 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
43590 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
43591 int64_t channels_arg_conv_6 = channels_arg_vals[g];
43592 channels_arg_constr.data[g] = channels_arg_conv_6;
43594 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
43595 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
43596 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
43597 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
43598 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
43599 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
43600 LDKNodeAnnouncementInfo announcement_info_arg_conv;
43601 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
43602 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
43603 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
43604 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
43605 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
43606 int64_t ret_ref = 0;
43607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43610 ret_ref = (uintptr_t)ret_var.inner;
43611 if (ret_var.is_owned) {
43617 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
43618 LDKNodeInfo ret_var = NodeInfo_clone(arg);
43619 int64_t ret_ref = 0;
43620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43623 ret_ref = (uintptr_t)ret_var.inner;
43624 if (ret_var.is_owned) {
43629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43630 LDKNodeInfo arg_conv;
43631 arg_conv.inner = (void*)(arg & (~1));
43632 arg_conv.is_owned = false;
43633 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43634 int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
43638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43639 LDKNodeInfo orig_conv;
43640 orig_conv.inner = (void*)(orig & (~1));
43641 orig_conv.is_owned = false;
43642 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43643 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
43644 int64_t ret_ref = 0;
43645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43648 ret_ref = (uintptr_t)ret_var.inner;
43649 if (ret_var.is_owned) {
43655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43656 LDKNodeInfo obj_conv;
43657 obj_conv.inner = (void*)(obj & (~1));
43658 obj_conv.is_owned = false;
43659 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43660 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
43661 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43662 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43663 CVec_u8Z_free(ret_var);
43667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43668 LDKu8slice ser_ref;
43669 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43670 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43671 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
43672 *ret_conv = NodeInfo_read(ser_ref);
43673 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43674 return (int64_t)ret_conv;
43677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
43678 LDKNetworkGraph obj_conv;
43679 obj_conv.inner = (void*)(obj & (~1));
43680 obj_conv.is_owned = false;
43681 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43682 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
43683 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43684 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43685 CVec_u8Z_free(ret_var);
43689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
43690 LDKu8slice ser_ref;
43691 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43692 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43693 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
43694 CHECK_ACCESS(arg_ptr);
43695 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
43696 if (arg_conv.free == LDKLogger_JCalls_free) {
43697 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43698 LDKLogger_JCalls_cloned(&arg_conv);
43700 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
43701 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
43702 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43703 return (int64_t)ret_conv;
43706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
43707 LDKThirtyTwoBytes genesis_hash_ref;
43708 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
43709 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
43710 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43711 CHECK_ACCESS(logger_ptr);
43712 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43713 if (logger_conv.free == LDKLogger_JCalls_free) {
43714 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43715 LDKLogger_JCalls_cloned(&logger_conv);
43717 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43718 int64_t ret_ref = 0;
43719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43722 ret_ref = (uintptr_t)ret_var.inner;
43723 if (ret_var.is_owned) {
43729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
43730 LDKNetworkGraph this_arg_conv;
43731 this_arg_conv.inner = (void*)(this_arg & (~1));
43732 this_arg_conv.is_owned = false;
43733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43734 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43735 int64_t ret_ref = 0;
43736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43739 ret_ref = (uintptr_t)ret_var.inner;
43740 if (ret_var.is_owned) {
43746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
43747 LDKNetworkGraph this_arg_conv;
43748 this_arg_conv.inner = (void*)(this_arg & (~1));
43749 this_arg_conv.is_owned = false;
43750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43751 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43752 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43753 int64_t ret_ref = (uintptr_t)ret_copy;
43757 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) {
43758 LDKNetworkGraph this_arg_conv;
43759 this_arg_conv.inner = (void*)(this_arg & (~1));
43760 this_arg_conv.is_owned = false;
43761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43762 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43765 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) {
43766 LDKNetworkGraph this_arg_conv;
43767 this_arg_conv.inner = (void*)(this_arg & (~1));
43768 this_arg_conv.is_owned = false;
43769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43770 LDKNodeAnnouncement msg_conv;
43771 msg_conv.inner = (void*)(msg & (~1));
43772 msg_conv.is_owned = false;
43773 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43774 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43775 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43776 return (int64_t)ret_conv;
43779 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) {
43780 LDKNetworkGraph this_arg_conv;
43781 this_arg_conv.inner = (void*)(this_arg & (~1));
43782 this_arg_conv.is_owned = false;
43783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43784 LDKUnsignedNodeAnnouncement msg_conv;
43785 msg_conv.inner = (void*)(msg & (~1));
43786 msg_conv.is_owned = false;
43787 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43788 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43789 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43790 return (int64_t)ret_conv;
43793 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) {
43794 LDKNetworkGraph this_arg_conv;
43795 this_arg_conv.inner = (void*)(this_arg & (~1));
43796 this_arg_conv.is_owned = false;
43797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43798 LDKChannelAnnouncement msg_conv;
43799 msg_conv.inner = (void*)(msg & (~1));
43800 msg_conv.is_owned = false;
43801 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43802 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43803 CHECK_ACCESS(chain_access_ptr);
43804 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43805 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43806 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43807 // Manually implement clone for Java trait instances
43808 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43810 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43813 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43814 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43815 return (int64_t)ret_conv;
43818 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) {
43819 LDKNetworkGraph this_arg_conv;
43820 this_arg_conv.inner = (void*)(this_arg & (~1));
43821 this_arg_conv.is_owned = false;
43822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43823 LDKUnsignedChannelAnnouncement msg_conv;
43824 msg_conv.inner = (void*)(msg & (~1));
43825 msg_conv.is_owned = false;
43826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43827 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43828 CHECK_ACCESS(chain_access_ptr);
43829 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43830 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43831 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43832 // Manually implement clone for Java trait instances
43833 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43835 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43838 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43839 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43840 return (int64_t)ret_conv;
43843 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) {
43844 LDKNetworkGraph this_arg_conv;
43845 this_arg_conv.inner = (void*)(this_arg & (~1));
43846 this_arg_conv.is_owned = false;
43847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43848 LDKChannelFeatures features_conv;
43849 features_conv.inner = (void*)(features & (~1));
43850 features_conv.is_owned = (features & 1) || (features == 0);
43851 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43852 features_conv = ChannelFeatures_clone(&features_conv);
43853 LDKPublicKey node_id_1_ref;
43854 CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
43855 (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
43856 LDKPublicKey node_id_2_ref;
43857 CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
43858 (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
43859 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43860 *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);
43861 return (int64_t)ret_conv;
43864 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) {
43865 LDKNetworkGraph this_arg_conv;
43866 this_arg_conv.inner = (void*)(this_arg & (~1));
43867 this_arg_conv.is_owned = false;
43868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43869 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43872 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) {
43873 LDKNetworkGraph this_arg_conv;
43874 this_arg_conv.inner = (void*)(this_arg & (~1));
43875 this_arg_conv.is_owned = false;
43876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43877 LDKPublicKey _node_id_ref;
43878 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
43879 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
43880 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
43883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43884 LDKNetworkGraph this_arg_conv;
43885 this_arg_conv.inner = (void*)(this_arg & (~1));
43886 this_arg_conv.is_owned = false;
43887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43888 NetworkGraph_remove_stale_channels(&this_arg_conv);
43891 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) {
43892 LDKNetworkGraph this_arg_conv;
43893 this_arg_conv.inner = (void*)(this_arg & (~1));
43894 this_arg_conv.is_owned = false;
43895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43896 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
43899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43900 LDKNetworkGraph this_arg_conv;
43901 this_arg_conv.inner = (void*)(this_arg & (~1));
43902 this_arg_conv.is_owned = false;
43903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43904 LDKChannelUpdate msg_conv;
43905 msg_conv.inner = (void*)(msg & (~1));
43906 msg_conv.is_owned = false;
43907 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43908 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43909 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43910 return (int64_t)ret_conv;
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43914 LDKNetworkGraph this_arg_conv;
43915 this_arg_conv.inner = (void*)(this_arg & (~1));
43916 this_arg_conv.is_owned = false;
43917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43918 LDKUnsignedChannelUpdate msg_conv;
43919 msg_conv.inner = (void*)(msg & (~1));
43920 msg_conv.is_owned = false;
43921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43922 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43923 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43924 return (int64_t)ret_conv;
43927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
43928 LDKReadOnlyNetworkGraph this_arg_conv;
43929 this_arg_conv.inner = (void*)(this_arg & (~1));
43930 this_arg_conv.is_owned = false;
43931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43932 LDKPublicKey pubkey_ref;
43933 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43934 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43935 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43936 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43937 int64_t ret_ref = (uintptr_t)ret_copy;
43941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43942 LDKRouteHop this_obj_conv;
43943 this_obj_conv.inner = (void*)(this_obj & (~1));
43944 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43946 RouteHop_free(this_obj_conv);
43949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43950 LDKRouteHop this_ptr_conv;
43951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43952 this_ptr_conv.is_owned = false;
43953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43954 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43955 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
43959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43960 LDKRouteHop this_ptr_conv;
43961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43962 this_ptr_conv.is_owned = false;
43963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43964 LDKPublicKey val_ref;
43965 CHECK((*env)->GetArrayLength(env, val) == 33);
43966 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43967 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43971 LDKRouteHop this_ptr_conv;
43972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43973 this_ptr_conv.is_owned = false;
43974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43975 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43976 int64_t ret_ref = 0;
43977 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43978 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43980 ret_ref = (uintptr_t)ret_var.inner;
43981 if (ret_var.is_owned) {
43987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43988 LDKRouteHop this_ptr_conv;
43989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43990 this_ptr_conv.is_owned = false;
43991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43992 LDKNodeFeatures val_conv;
43993 val_conv.inner = (void*)(val & (~1));
43994 val_conv.is_owned = (val & 1) || (val == 0);
43995 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43996 val_conv = NodeFeatures_clone(&val_conv);
43997 RouteHop_set_node_features(&this_ptr_conv, val_conv);
44000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44001 LDKRouteHop this_ptr_conv;
44002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44003 this_ptr_conv.is_owned = false;
44004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44005 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
44009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44010 LDKRouteHop this_ptr_conv;
44011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44012 this_ptr_conv.is_owned = false;
44013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44014 RouteHop_set_short_channel_id(&this_ptr_conv, val);
44017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44018 LDKRouteHop 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 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
44023 int64_t ret_ref = 0;
44024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44027 ret_ref = (uintptr_t)ret_var.inner;
44028 if (ret_var.is_owned) {
44034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44035 LDKRouteHop this_ptr_conv;
44036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44037 this_ptr_conv.is_owned = false;
44038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039 LDKChannelFeatures val_conv;
44040 val_conv.inner = (void*)(val & (~1));
44041 val_conv.is_owned = (val & 1) || (val == 0);
44042 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44043 val_conv = ChannelFeatures_clone(&val_conv);
44044 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
44047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44048 LDKRouteHop this_ptr_conv;
44049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44050 this_ptr_conv.is_owned = false;
44051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44052 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
44056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44057 LDKRouteHop this_ptr_conv;
44058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44059 this_ptr_conv.is_owned = false;
44060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44061 RouteHop_set_fee_msat(&this_ptr_conv, val);
44064 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44065 LDKRouteHop this_ptr_conv;
44066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44067 this_ptr_conv.is_owned = false;
44068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44069 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
44073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44074 LDKRouteHop this_ptr_conv;
44075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44076 this_ptr_conv.is_owned = false;
44077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44078 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44081 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) {
44082 LDKPublicKey pubkey_arg_ref;
44083 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
44084 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
44085 LDKNodeFeatures node_features_arg_conv;
44086 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
44087 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
44088 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
44089 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
44090 LDKChannelFeatures channel_features_arg_conv;
44091 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
44092 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
44093 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
44094 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
44095 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);
44096 int64_t ret_ref = 0;
44097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44100 ret_ref = (uintptr_t)ret_var.inner;
44101 if (ret_var.is_owned) {
44107 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
44108 LDKRouteHop ret_var = RouteHop_clone(arg);
44109 int64_t ret_ref = 0;
44110 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44111 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44113 ret_ref = (uintptr_t)ret_var.inner;
44114 if (ret_var.is_owned) {
44119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44120 LDKRouteHop arg_conv;
44121 arg_conv.inner = (void*)(arg & (~1));
44122 arg_conv.is_owned = false;
44123 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44124 int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
44128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44129 LDKRouteHop orig_conv;
44130 orig_conv.inner = (void*)(orig & (~1));
44131 orig_conv.is_owned = false;
44132 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44133 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
44134 int64_t ret_ref = 0;
44135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44138 ret_ref = (uintptr_t)ret_var.inner;
44139 if (ret_var.is_owned) {
44145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
44146 LDKRouteHop o_conv;
44147 o_conv.inner = (void*)(o & (~1));
44148 o_conv.is_owned = false;
44149 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44150 int64_t ret_conv = RouteHop_hash(&o_conv);
44154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44155 LDKRouteHop a_conv;
44156 a_conv.inner = (void*)(a & (~1));
44157 a_conv.is_owned = false;
44158 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44159 LDKRouteHop b_conv;
44160 b_conv.inner = (void*)(b & (~1));
44161 b_conv.is_owned = false;
44162 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44163 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
44167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
44168 LDKRouteHop obj_conv;
44169 obj_conv.inner = (void*)(obj & (~1));
44170 obj_conv.is_owned = false;
44171 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44172 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
44173 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44174 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44175 CVec_u8Z_free(ret_var);
44179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44180 LDKu8slice ser_ref;
44181 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44182 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44183 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
44184 *ret_conv = RouteHop_read(ser_ref);
44185 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44186 return (int64_t)ret_conv;
44189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44190 LDKRoute this_obj_conv;
44191 this_obj_conv.inner = (void*)(this_obj & (~1));
44192 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44194 Route_free(this_obj_conv);
44197 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
44198 LDKRoute this_ptr_conv;
44199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44200 this_ptr_conv.is_owned = false;
44201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44202 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
44203 jobjectArray ret_arr = NULL;
44204 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
44206 for (size_t m = 0; m < ret_var.datalen; m++) {
44207 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
44208 int64_tArray ret_conv_12_arr = NULL;
44209 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
44210 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
44211 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
44212 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
44213 int64_t ret_conv_12_conv_10_ref = 0;
44214 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44215 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
44217 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
44218 if (ret_conv_12_conv_10_var.is_owned) {
44219 ret_conv_12_conv_10_ref |= 1;
44221 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
44223 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
44224 FREE(ret_conv_12_var.data);
44225 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
44228 FREE(ret_var.data);
44232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
44233 LDKRoute this_ptr_conv;
44234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44235 this_ptr_conv.is_owned = false;
44236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44237 LDKCVec_CVec_RouteHopZZ val_constr;
44238 val_constr.datalen = (*env)->GetArrayLength(env, val);
44239 if (val_constr.datalen > 0)
44240 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
44242 val_constr.data = NULL;
44243 for (size_t m = 0; m < val_constr.datalen; m++) {
44244 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
44245 LDKCVec_RouteHopZ val_conv_12_constr;
44246 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
44247 if (val_conv_12_constr.datalen > 0)
44248 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
44250 val_conv_12_constr.data = NULL;
44251 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
44252 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
44253 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
44254 LDKRouteHop val_conv_12_conv_10_conv;
44255 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
44256 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
44257 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
44258 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
44259 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
44261 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
44262 val_constr.data[m] = val_conv_12_constr;
44264 Route_set_paths(&this_ptr_conv, val_constr);
44267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
44268 LDKRoute this_ptr_conv;
44269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44270 this_ptr_conv.is_owned = false;
44271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44272 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
44273 int64_t ret_ref = 0;
44274 if ((uintptr_t)ret_var.inner > 4096) {
44275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44278 ret_ref = (uintptr_t)ret_var.inner;
44279 if (ret_var.is_owned) {
44286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44287 LDKRoute this_ptr_conv;
44288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44289 this_ptr_conv.is_owned = false;
44290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44291 LDKPaymentParameters val_conv;
44292 val_conv.inner = (void*)(val & (~1));
44293 val_conv.is_owned = (val & 1) || (val == 0);
44294 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44295 val_conv = PaymentParameters_clone(&val_conv);
44296 Route_set_payment_params(&this_ptr_conv, val_conv);
44299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
44300 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
44301 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
44302 if (paths_arg_constr.datalen > 0)
44303 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
44305 paths_arg_constr.data = NULL;
44306 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
44307 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
44308 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
44309 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
44310 if (paths_arg_conv_12_constr.datalen > 0)
44311 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
44313 paths_arg_conv_12_constr.data = NULL;
44314 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
44315 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
44316 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
44317 LDKRouteHop paths_arg_conv_12_conv_10_conv;
44318 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
44319 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
44320 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
44321 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
44322 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
44324 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
44325 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
44327 LDKPaymentParameters payment_params_arg_conv;
44328 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
44329 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
44330 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44331 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44332 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
44333 int64_t ret_ref = 0;
44334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44337 ret_ref = (uintptr_t)ret_var.inner;
44338 if (ret_var.is_owned) {
44344 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
44345 LDKRoute ret_var = Route_clone(arg);
44346 int64_t ret_ref = 0;
44347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44350 ret_ref = (uintptr_t)ret_var.inner;
44351 if (ret_var.is_owned) {
44356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44358 arg_conv.inner = (void*)(arg & (~1));
44359 arg_conv.is_owned = false;
44360 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44361 int64_t ret_conv = Route_clone_ptr(&arg_conv);
44365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44366 LDKRoute orig_conv;
44367 orig_conv.inner = (void*)(orig & (~1));
44368 orig_conv.is_owned = false;
44369 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44370 LDKRoute ret_var = Route_clone(&orig_conv);
44371 int64_t ret_ref = 0;
44372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44375 ret_ref = (uintptr_t)ret_var.inner;
44376 if (ret_var.is_owned) {
44382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
44384 o_conv.inner = (void*)(o & (~1));
44385 o_conv.is_owned = false;
44386 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44387 int64_t ret_conv = Route_hash(&o_conv);
44391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44393 a_conv.inner = (void*)(a & (~1));
44394 a_conv.is_owned = false;
44395 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44397 b_conv.inner = (void*)(b & (~1));
44398 b_conv.is_owned = false;
44399 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44400 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
44404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
44405 LDKRoute this_arg_conv;
44406 this_arg_conv.inner = (void*)(this_arg & (~1));
44407 this_arg_conv.is_owned = false;
44408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44409 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
44413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
44414 LDKRoute this_arg_conv;
44415 this_arg_conv.inner = (void*)(this_arg & (~1));
44416 this_arg_conv.is_owned = false;
44417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44418 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
44422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
44424 obj_conv.inner = (void*)(obj & (~1));
44425 obj_conv.is_owned = false;
44426 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44427 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
44428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44430 CVec_u8Z_free(ret_var);
44434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44435 LDKu8slice ser_ref;
44436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44438 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
44439 *ret_conv = Route_read(ser_ref);
44440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44441 return (int64_t)ret_conv;
44444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44445 LDKRouteParameters this_obj_conv;
44446 this_obj_conv.inner = (void*)(this_obj & (~1));
44447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44449 RouteParameters_free(this_obj_conv);
44452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
44453 LDKRouteParameters this_ptr_conv;
44454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44455 this_ptr_conv.is_owned = false;
44456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44457 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
44458 int64_t ret_ref = 0;
44459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44462 ret_ref = (uintptr_t)ret_var.inner;
44463 if (ret_var.is_owned) {
44469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44470 LDKRouteParameters this_ptr_conv;
44471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44472 this_ptr_conv.is_owned = false;
44473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44474 LDKPaymentParameters val_conv;
44475 val_conv.inner = (void*)(val & (~1));
44476 val_conv.is_owned = (val & 1) || (val == 0);
44477 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44478 val_conv = PaymentParameters_clone(&val_conv);
44479 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
44482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44483 LDKRouteParameters this_ptr_conv;
44484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44485 this_ptr_conv.is_owned = false;
44486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44487 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
44491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44492 LDKRouteParameters this_ptr_conv;
44493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44494 this_ptr_conv.is_owned = false;
44495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44496 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
44499 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44500 LDKRouteParameters this_ptr_conv;
44501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44502 this_ptr_conv.is_owned = false;
44503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44504 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
44508 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) {
44509 LDKRouteParameters this_ptr_conv;
44510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44511 this_ptr_conv.is_owned = false;
44512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44513 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
44516 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) {
44517 LDKPaymentParameters payment_params_arg_conv;
44518 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
44519 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
44520 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44521 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44522 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
44523 int64_t ret_ref = 0;
44524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44527 ret_ref = (uintptr_t)ret_var.inner;
44528 if (ret_var.is_owned) {
44534 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
44535 LDKRouteParameters ret_var = RouteParameters_clone(arg);
44536 int64_t ret_ref = 0;
44537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44540 ret_ref = (uintptr_t)ret_var.inner;
44541 if (ret_var.is_owned) {
44546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44547 LDKRouteParameters arg_conv;
44548 arg_conv.inner = (void*)(arg & (~1));
44549 arg_conv.is_owned = false;
44550 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44551 int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
44555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44556 LDKRouteParameters orig_conv;
44557 orig_conv.inner = (void*)(orig & (~1));
44558 orig_conv.is_owned = false;
44559 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44560 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
44561 int64_t ret_ref = 0;
44562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44565 ret_ref = (uintptr_t)ret_var.inner;
44566 if (ret_var.is_owned) {
44572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44573 LDKRouteParameters obj_conv;
44574 obj_conv.inner = (void*)(obj & (~1));
44575 obj_conv.is_owned = false;
44576 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44577 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
44578 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44579 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44580 CVec_u8Z_free(ret_var);
44584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44585 LDKu8slice ser_ref;
44586 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44587 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44588 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
44589 *ret_conv = RouteParameters_read(ser_ref);
44590 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44591 return (int64_t)ret_conv;
44594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44595 LDKPaymentParameters this_obj_conv;
44596 this_obj_conv.inner = (void*)(this_obj & (~1));
44597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44599 PaymentParameters_free(this_obj_conv);
44602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44603 LDKPaymentParameters this_ptr_conv;
44604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44605 this_ptr_conv.is_owned = false;
44606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44607 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44608 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
44612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44613 LDKPaymentParameters this_ptr_conv;
44614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44615 this_ptr_conv.is_owned = false;
44616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44617 LDKPublicKey val_ref;
44618 CHECK((*env)->GetArrayLength(env, val) == 33);
44619 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44620 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
44623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44624 LDKPaymentParameters this_ptr_conv;
44625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44626 this_ptr_conv.is_owned = false;
44627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44628 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
44629 int64_t ret_ref = 0;
44630 if ((uintptr_t)ret_var.inner > 4096) {
44631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44634 ret_ref = (uintptr_t)ret_var.inner;
44635 if (ret_var.is_owned) {
44642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44643 LDKPaymentParameters this_ptr_conv;
44644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44645 this_ptr_conv.is_owned = false;
44646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44647 LDKInvoiceFeatures val_conv;
44648 val_conv.inner = (void*)(val & (~1));
44649 val_conv.is_owned = (val & 1) || (val == 0);
44650 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44651 val_conv = InvoiceFeatures_clone(&val_conv);
44652 PaymentParameters_set_features(&this_ptr_conv, val_conv);
44655 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
44656 LDKPaymentParameters this_ptr_conv;
44657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44658 this_ptr_conv.is_owned = false;
44659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44660 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44661 int64_tArray ret_arr = NULL;
44662 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44663 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44664 for (size_t l = 0; l < ret_var.datalen; l++) {
44665 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44666 int64_t ret_conv_11_ref = 0;
44667 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44668 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44670 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
44671 if (ret_conv_11_var.is_owned) {
44672 ret_conv_11_ref |= 1;
44674 ret_arr_ptr[l] = ret_conv_11_ref;
44676 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44677 FREE(ret_var.data);
44681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44682 LDKPaymentParameters this_ptr_conv;
44683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44684 this_ptr_conv.is_owned = false;
44685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44686 LDKCVec_RouteHintZ val_constr;
44687 val_constr.datalen = (*env)->GetArrayLength(env, val);
44688 if (val_constr.datalen > 0)
44689 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44691 val_constr.data = NULL;
44692 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44693 for (size_t l = 0; l < val_constr.datalen; l++) {
44694 int64_t val_conv_11 = val_vals[l];
44695 LDKRouteHint val_conv_11_conv;
44696 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
44697 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
44698 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44699 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44700 val_constr.data[l] = val_conv_11_conv;
44702 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44703 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
44707 LDKPaymentParameters this_ptr_conv;
44708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44709 this_ptr_conv.is_owned = false;
44710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44711 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44712 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44713 int64_t ret_ref = (uintptr_t)ret_copy;
44717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44718 LDKPaymentParameters this_ptr_conv;
44719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44720 this_ptr_conv.is_owned = false;
44721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44722 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
44723 CHECK_ACCESS(val_ptr);
44724 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44725 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
44726 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44729 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44730 LDKPaymentParameters this_ptr_conv;
44731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44732 this_ptr_conv.is_owned = false;
44733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44734 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44738 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) {
44739 LDKPaymentParameters this_ptr_conv;
44740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44741 this_ptr_conv.is_owned = false;
44742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44743 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44746 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
44747 LDKPaymentParameters this_ptr_conv;
44748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44749 this_ptr_conv.is_owned = false;
44750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44751 int8_t ret_conv = PaymentParameters_get_max_mpp_path_count(&this_ptr_conv);
44755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
44756 LDKPaymentParameters this_ptr_conv;
44757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44758 this_ptr_conv.is_owned = false;
44759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44760 PaymentParameters_set_max_mpp_path_count(&this_ptr_conv, val);
44763 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_mpp_path_count_arg) {
44764 LDKPublicKey payee_pubkey_arg_ref;
44765 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
44766 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
44767 LDKInvoiceFeatures features_arg_conv;
44768 features_arg_conv.inner = (void*)(features_arg & (~1));
44769 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
44770 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44771 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44772 LDKCVec_RouteHintZ route_hints_arg_constr;
44773 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
44774 if (route_hints_arg_constr.datalen > 0)
44775 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44777 route_hints_arg_constr.data = NULL;
44778 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
44779 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44780 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44781 LDKRouteHint route_hints_arg_conv_11_conv;
44782 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
44783 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
44784 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44785 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44786 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44788 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
44789 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
44790 CHECK_ACCESS(expiry_time_arg_ptr);
44791 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44792 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
44793 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_mpp_path_count_arg);
44794 int64_t ret_ref = 0;
44795 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44796 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44798 ret_ref = (uintptr_t)ret_var.inner;
44799 if (ret_var.is_owned) {
44805 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44806 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44807 int64_t ret_ref = 0;
44808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44811 ret_ref = (uintptr_t)ret_var.inner;
44812 if (ret_var.is_owned) {
44817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44818 LDKPaymentParameters arg_conv;
44819 arg_conv.inner = (void*)(arg & (~1));
44820 arg_conv.is_owned = false;
44821 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44822 int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44827 LDKPaymentParameters orig_conv;
44828 orig_conv.inner = (void*)(orig & (~1));
44829 orig_conv.is_owned = false;
44830 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44831 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44832 int64_t ret_ref = 0;
44833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44836 ret_ref = (uintptr_t)ret_var.inner;
44837 if (ret_var.is_owned) {
44843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
44844 LDKPaymentParameters o_conv;
44845 o_conv.inner = (void*)(o & (~1));
44846 o_conv.is_owned = false;
44847 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44848 int64_t ret_conv = PaymentParameters_hash(&o_conv);
44852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44853 LDKPaymentParameters a_conv;
44854 a_conv.inner = (void*)(a & (~1));
44855 a_conv.is_owned = false;
44856 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44857 LDKPaymentParameters b_conv;
44858 b_conv.inner = (void*)(b & (~1));
44859 b_conv.is_owned = false;
44860 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44861 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44866 LDKPaymentParameters obj_conv;
44867 obj_conv.inner = (void*)(obj & (~1));
44868 obj_conv.is_owned = false;
44869 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44870 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44871 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44872 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44873 CVec_u8Z_free(ret_var);
44877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44878 LDKu8slice ser_ref;
44879 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44880 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44881 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44882 *ret_conv = PaymentParameters_read(ser_ref);
44883 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44884 return (int64_t)ret_conv;
44887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44888 LDKPublicKey payee_pubkey_ref;
44889 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44890 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44891 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44892 int64_t ret_ref = 0;
44893 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44894 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44896 ret_ref = (uintptr_t)ret_var.inner;
44897 if (ret_var.is_owned) {
44903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44904 LDKPublicKey payee_pubkey_ref;
44905 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44906 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44907 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44908 int64_t ret_ref = 0;
44909 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44910 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44912 ret_ref = (uintptr_t)ret_var.inner;
44913 if (ret_var.is_owned) {
44919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44920 LDKRouteHint this_obj_conv;
44921 this_obj_conv.inner = (void*)(this_obj & (~1));
44922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44924 RouteHint_free(this_obj_conv);
44927 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44928 LDKRouteHint this_ptr_conv;
44929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44930 this_ptr_conv.is_owned = false;
44931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44932 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44933 int64_tArray ret_arr = NULL;
44934 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44935 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44936 for (size_t o = 0; o < ret_var.datalen; o++) {
44937 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44938 int64_t ret_conv_14_ref = 0;
44939 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44940 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44942 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44943 if (ret_conv_14_var.is_owned) {
44944 ret_conv_14_ref |= 1;
44946 ret_arr_ptr[o] = ret_conv_14_ref;
44948 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44949 FREE(ret_var.data);
44953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44954 LDKRouteHint this_ptr_conv;
44955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44956 this_ptr_conv.is_owned = false;
44957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44958 LDKCVec_RouteHintHopZ val_constr;
44959 val_constr.datalen = (*env)->GetArrayLength(env, val);
44960 if (val_constr.datalen > 0)
44961 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44963 val_constr.data = NULL;
44964 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44965 for (size_t o = 0; o < val_constr.datalen; o++) {
44966 int64_t val_conv_14 = val_vals[o];
44967 LDKRouteHintHop val_conv_14_conv;
44968 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
44969 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
44970 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44971 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44972 val_constr.data[o] = val_conv_14_conv;
44974 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44975 RouteHint_set_a(&this_ptr_conv, val_constr);
44978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
44979 LDKCVec_RouteHintHopZ a_arg_constr;
44980 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
44981 if (a_arg_constr.datalen > 0)
44982 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44984 a_arg_constr.data = NULL;
44985 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
44986 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44987 int64_t a_arg_conv_14 = a_arg_vals[o];
44988 LDKRouteHintHop a_arg_conv_14_conv;
44989 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
44990 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
44991 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44992 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44993 a_arg_constr.data[o] = a_arg_conv_14_conv;
44995 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
44996 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44997 int64_t ret_ref = 0;
44998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45001 ret_ref = (uintptr_t)ret_var.inner;
45002 if (ret_var.is_owned) {
45008 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
45009 LDKRouteHint ret_var = RouteHint_clone(arg);
45010 int64_t ret_ref = 0;
45011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45014 ret_ref = (uintptr_t)ret_var.inner;
45015 if (ret_var.is_owned) {
45020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45021 LDKRouteHint arg_conv;
45022 arg_conv.inner = (void*)(arg & (~1));
45023 arg_conv.is_owned = false;
45024 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45025 int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
45029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45030 LDKRouteHint orig_conv;
45031 orig_conv.inner = (void*)(orig & (~1));
45032 orig_conv.is_owned = false;
45033 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45034 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
45035 int64_t ret_ref = 0;
45036 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45037 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45039 ret_ref = (uintptr_t)ret_var.inner;
45040 if (ret_var.is_owned) {
45046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45047 LDKRouteHint o_conv;
45048 o_conv.inner = (void*)(o & (~1));
45049 o_conv.is_owned = false;
45050 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45051 int64_t ret_conv = RouteHint_hash(&o_conv);
45055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45056 LDKRouteHint a_conv;
45057 a_conv.inner = (void*)(a & (~1));
45058 a_conv.is_owned = false;
45059 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45060 LDKRouteHint b_conv;
45061 b_conv.inner = (void*)(b & (~1));
45062 b_conv.is_owned = false;
45063 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45064 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
45068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45069 LDKRouteHint obj_conv;
45070 obj_conv.inner = (void*)(obj & (~1));
45071 obj_conv.is_owned = false;
45072 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45073 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
45074 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45075 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45076 CVec_u8Z_free(ret_var);
45080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45081 LDKu8slice ser_ref;
45082 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45083 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45084 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
45085 *ret_conv = RouteHint_read(ser_ref);
45086 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45087 return (int64_t)ret_conv;
45090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45091 LDKRouteHintHop this_obj_conv;
45092 this_obj_conv.inner = (void*)(this_obj & (~1));
45093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45095 RouteHintHop_free(this_obj_conv);
45098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45099 LDKRouteHintHop this_ptr_conv;
45100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45101 this_ptr_conv.is_owned = false;
45102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45103 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
45108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45109 LDKRouteHintHop this_ptr_conv;
45110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45111 this_ptr_conv.is_owned = false;
45112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45113 LDKPublicKey val_ref;
45114 CHECK((*env)->GetArrayLength(env, val) == 33);
45115 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45116 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
45119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45120 LDKRouteHintHop this_ptr_conv;
45121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45122 this_ptr_conv.is_owned = false;
45123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45124 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
45128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45129 LDKRouteHintHop this_ptr_conv;
45130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45131 this_ptr_conv.is_owned = false;
45132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45133 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
45136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
45137 LDKRouteHintHop this_ptr_conv;
45138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45139 this_ptr_conv.is_owned = false;
45140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45141 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
45142 int64_t ret_ref = 0;
45143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45146 ret_ref = (uintptr_t)ret_var.inner;
45147 if (ret_var.is_owned) {
45153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45154 LDKRouteHintHop this_ptr_conv;
45155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45156 this_ptr_conv.is_owned = false;
45157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45158 LDKRoutingFees val_conv;
45159 val_conv.inner = (void*)(val & (~1));
45160 val_conv.is_owned = (val & 1) || (val == 0);
45161 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45162 val_conv = RoutingFees_clone(&val_conv);
45163 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
45166 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45167 LDKRouteHintHop this_ptr_conv;
45168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45169 this_ptr_conv.is_owned = false;
45170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45171 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
45175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
45176 LDKRouteHintHop this_ptr_conv;
45177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45178 this_ptr_conv.is_owned = false;
45179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45180 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45184 LDKRouteHintHop this_ptr_conv;
45185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45186 this_ptr_conv.is_owned = false;
45187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45188 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45189 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
45190 int64_t ret_ref = (uintptr_t)ret_copy;
45194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45195 LDKRouteHintHop this_ptr_conv;
45196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45197 this_ptr_conv.is_owned = false;
45198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45199 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45200 CHECK_ACCESS(val_ptr);
45201 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45202 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
45203 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
45206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45207 LDKRouteHintHop this_ptr_conv;
45208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45209 this_ptr_conv.is_owned = false;
45210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45211 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45212 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
45213 int64_t ret_ref = (uintptr_t)ret_copy;
45217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45218 LDKRouteHintHop this_ptr_conv;
45219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45220 this_ptr_conv.is_owned = false;
45221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45222 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45223 CHECK_ACCESS(val_ptr);
45224 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45225 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
45226 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
45229 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) {
45230 LDKPublicKey src_node_id_arg_ref;
45231 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
45232 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
45233 LDKRoutingFees fees_arg_conv;
45234 fees_arg_conv.inner = (void*)(fees_arg & (~1));
45235 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
45236 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
45237 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
45238 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
45239 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
45240 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
45241 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
45242 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
45243 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
45244 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
45245 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
45246 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);
45247 int64_t ret_ref = 0;
45248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45251 ret_ref = (uintptr_t)ret_var.inner;
45252 if (ret_var.is_owned) {
45258 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
45259 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
45260 int64_t ret_ref = 0;
45261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45264 ret_ref = (uintptr_t)ret_var.inner;
45265 if (ret_var.is_owned) {
45270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45271 LDKRouteHintHop arg_conv;
45272 arg_conv.inner = (void*)(arg & (~1));
45273 arg_conv.is_owned = false;
45274 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45275 int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
45279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45280 LDKRouteHintHop orig_conv;
45281 orig_conv.inner = (void*)(orig & (~1));
45282 orig_conv.is_owned = false;
45283 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45284 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
45285 int64_t ret_ref = 0;
45286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45289 ret_ref = (uintptr_t)ret_var.inner;
45290 if (ret_var.is_owned) {
45296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
45297 LDKRouteHintHop o_conv;
45298 o_conv.inner = (void*)(o & (~1));
45299 o_conv.is_owned = false;
45300 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45301 int64_t ret_conv = RouteHintHop_hash(&o_conv);
45305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45306 LDKRouteHintHop a_conv;
45307 a_conv.inner = (void*)(a & (~1));
45308 a_conv.is_owned = false;
45309 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45310 LDKRouteHintHop b_conv;
45311 b_conv.inner = (void*)(b & (~1));
45312 b_conv.is_owned = false;
45313 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45314 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
45318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
45319 LDKRouteHintHop obj_conv;
45320 obj_conv.inner = (void*)(obj & (~1));
45321 obj_conv.is_owned = false;
45322 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45323 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
45324 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45325 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45326 CVec_u8Z_free(ret_var);
45330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45331 LDKu8slice ser_ref;
45332 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45333 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45334 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
45335 *ret_conv = RouteHintHop_read(ser_ref);
45336 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45337 return (int64_t)ret_conv;
45340 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) {
45341 LDKPublicKey our_node_pubkey_ref;
45342 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
45343 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
45344 LDKRouteParameters route_params_conv;
45345 route_params_conv.inner = (void*)(route_params & (~1));
45346 route_params_conv.is_owned = false;
45347 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45348 LDKNetworkGraph network_graph_conv;
45349 network_graph_conv.inner = (void*)(network_graph & (~1));
45350 network_graph_conv.is_owned = false;
45351 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45352 LDKCVec_ChannelDetailsZ first_hops_constr;
45353 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
45354 if (first_hops != NULL) {
45355 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
45356 if (first_hops_constr.datalen > 0)
45357 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
45359 first_hops_constr.data = NULL;
45360 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
45361 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
45362 int64_t first_hops_conv_16 = first_hops_vals[q];
45363 LDKChannelDetails first_hops_conv_16_conv;
45364 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
45365 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
45366 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
45367 first_hops_constr.data[q] = first_hops_conv_16_conv;
45369 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
45370 first_hops_ptr = &first_hops_constr;
45372 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45373 CHECK_ACCESS(logger_ptr);
45374 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45375 if (logger_conv.free == LDKLogger_JCalls_free) {
45376 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45377 LDKLogger_JCalls_cloned(&logger_conv);
45379 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
45380 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
45381 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
45382 unsigned char random_seed_bytes_arr[32];
45383 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
45384 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
45385 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45386 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45387 *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);
45388 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
45389 return (int64_t)ret_conv;
45392 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) {
45393 LDKPublicKey our_node_pubkey_ref;
45394 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
45395 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
45396 LDKCVec_PublicKeyZ hops_constr;
45397 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
45398 if (hops_constr.datalen > 0)
45399 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
45401 hops_constr.data = NULL;
45402 for (size_t i = 0; i < hops_constr.datalen; i++) {
45403 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
45404 LDKPublicKey hops_conv_8_ref;
45405 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
45406 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
45407 hops_constr.data[i] = hops_conv_8_ref;
45409 LDKRouteParameters route_params_conv;
45410 route_params_conv.inner = (void*)(route_params & (~1));
45411 route_params_conv.is_owned = false;
45412 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45413 LDKNetworkGraph network_graph_conv;
45414 network_graph_conv.inner = (void*)(network_graph & (~1));
45415 network_graph_conv.is_owned = false;
45416 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45417 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45418 CHECK_ACCESS(logger_ptr);
45419 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45420 if (logger_conv.free == LDKLogger_JCalls_free) {
45421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45422 LDKLogger_JCalls_cloned(&logger_conv);
45424 unsigned char random_seed_bytes_arr[32];
45425 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
45426 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
45427 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45428 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45429 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
45430 return (int64_t)ret_conv;
45433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45434 if ((this_ptr & 1) != 0) return;
45435 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45436 CHECK_ACCESS(this_ptr_ptr);
45437 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
45438 FREE((void*)this_ptr);
45439 Score_free(this_ptr_conv);
45442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45443 if ((this_ptr & 1) != 0) return;
45444 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45445 CHECK_ACCESS(this_ptr_ptr);
45446 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
45447 FREE((void*)this_ptr);
45448 LockableScore_free(this_ptr_conv);
45451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45452 LDKMultiThreadedLockableScore this_obj_conv;
45453 this_obj_conv.inner = (void*)(this_obj & (~1));
45454 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45456 MultiThreadedLockableScore_free(this_obj_conv);
45459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
45460 LDKMultiThreadedLockableScore obj_conv;
45461 obj_conv.inner = (void*)(obj & (~1));
45462 obj_conv.is_owned = false;
45463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45464 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
45465 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45466 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45467 CVec_u8Z_free(ret_var);
45471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
45472 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
45473 CHECK_ACCESS(score_ptr);
45474 LDKScore score_conv = *(LDKScore*)(score_ptr);
45475 if (score_conv.free == LDKScore_JCalls_free) {
45476 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45477 LDKScore_JCalls_cloned(&score_conv);
45479 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
45480 int64_t ret_ref = 0;
45481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45484 ret_ref = (uintptr_t)ret_var.inner;
45485 if (ret_var.is_owned) {
45491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45492 LDKChannelUsage this_obj_conv;
45493 this_obj_conv.inner = (void*)(this_obj & (~1));
45494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45496 ChannelUsage_free(this_obj_conv);
45499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45500 LDKChannelUsage this_ptr_conv;
45501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45502 this_ptr_conv.is_owned = false;
45503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45504 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
45508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45509 LDKChannelUsage this_ptr_conv;
45510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45511 this_ptr_conv.is_owned = false;
45512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45513 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
45516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45517 LDKChannelUsage this_ptr_conv;
45518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45519 this_ptr_conv.is_owned = false;
45520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45521 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
45525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45526 LDKChannelUsage this_ptr_conv;
45527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45528 this_ptr_conv.is_owned = false;
45529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45530 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
45533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
45534 LDKChannelUsage this_ptr_conv;
45535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45536 this_ptr_conv.is_owned = false;
45537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45538 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
45539 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
45540 int64_t ret_ref = (uintptr_t)ret_copy;
45544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45545 LDKChannelUsage this_ptr_conv;
45546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45547 this_ptr_conv.is_owned = false;
45548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45549 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45550 CHECK_ACCESS(val_ptr);
45551 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
45552 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
45553 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
45556 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) {
45557 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
45558 CHECK_ACCESS(effective_capacity_arg_ptr);
45559 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
45560 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
45561 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
45562 int64_t ret_ref = 0;
45563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45566 ret_ref = (uintptr_t)ret_var.inner;
45567 if (ret_var.is_owned) {
45573 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
45574 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
45575 int64_t ret_ref = 0;
45576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45579 ret_ref = (uintptr_t)ret_var.inner;
45580 if (ret_var.is_owned) {
45585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45586 LDKChannelUsage arg_conv;
45587 arg_conv.inner = (void*)(arg & (~1));
45588 arg_conv.is_owned = false;
45589 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45590 int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
45594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45595 LDKChannelUsage orig_conv;
45596 orig_conv.inner = (void*)(orig & (~1));
45597 orig_conv.is_owned = false;
45598 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45599 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
45600 int64_t ret_ref = 0;
45601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45604 ret_ref = (uintptr_t)ret_var.inner;
45605 if (ret_var.is_owned) {
45611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45612 LDKFixedPenaltyScorer this_obj_conv;
45613 this_obj_conv.inner = (void*)(this_obj & (~1));
45614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45616 FixedPenaltyScorer_free(this_obj_conv);
45619 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
45620 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
45621 int64_t ret_ref = 0;
45622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45625 ret_ref = (uintptr_t)ret_var.inner;
45626 if (ret_var.is_owned) {
45631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45632 LDKFixedPenaltyScorer arg_conv;
45633 arg_conv.inner = (void*)(arg & (~1));
45634 arg_conv.is_owned = false;
45635 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45636 int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45641 LDKFixedPenaltyScorer orig_conv;
45642 orig_conv.inner = (void*)(orig & (~1));
45643 orig_conv.is_owned = false;
45644 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45645 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45646 int64_t ret_ref = 0;
45647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45650 ret_ref = (uintptr_t)ret_var.inner;
45651 if (ret_var.is_owned) {
45657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
45658 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45659 int64_t ret_ref = 0;
45660 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45661 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45663 ret_ref = (uintptr_t)ret_var.inner;
45664 if (ret_var.is_owned) {
45670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45671 LDKFixedPenaltyScorer this_arg_conv;
45672 this_arg_conv.inner = (void*)(this_arg & (~1));
45673 this_arg_conv.is_owned = false;
45674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45675 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45676 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45677 return (int64_t)ret_ret;
45680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45681 LDKFixedPenaltyScorer obj_conv;
45682 obj_conv.inner = (void*)(obj & (~1));
45683 obj_conv.is_owned = false;
45684 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45685 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45686 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45687 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45688 CVec_u8Z_free(ret_var);
45692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45693 LDKu8slice ser_ref;
45694 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45695 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45696 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45697 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45698 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45699 return (int64_t)ret_conv;
45702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45703 LDKProbabilisticScorer this_obj_conv;
45704 this_obj_conv.inner = (void*)(this_obj & (~1));
45705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45707 ProbabilisticScorer_free(this_obj_conv);
45710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45711 LDKProbabilisticScoringParameters this_obj_conv;
45712 this_obj_conv.inner = (void*)(this_obj & (~1));
45713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45715 ProbabilisticScoringParameters_free(this_obj_conv);
45718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45719 LDKProbabilisticScoringParameters this_ptr_conv;
45720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45721 this_ptr_conv.is_owned = false;
45722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45723 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45728 LDKProbabilisticScoringParameters this_ptr_conv;
45729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45730 this_ptr_conv.is_owned = false;
45731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45732 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45736 LDKProbabilisticScoringParameters this_ptr_conv;
45737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45738 this_ptr_conv.is_owned = false;
45739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45740 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45744 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) {
45745 LDKProbabilisticScoringParameters this_ptr_conv;
45746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45747 this_ptr_conv.is_owned = false;
45748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45749 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
45753 LDKProbabilisticScoringParameters this_ptr_conv;
45754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45755 this_ptr_conv.is_owned = false;
45756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45757 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45761 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) {
45762 LDKProbabilisticScoringParameters this_ptr_conv;
45763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45764 this_ptr_conv.is_owned = false;
45765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45766 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45770 LDKProbabilisticScoringParameters this_ptr_conv;
45771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45772 this_ptr_conv.is_owned = false;
45773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45774 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
45778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45779 LDKProbabilisticScoringParameters this_ptr_conv;
45780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45781 this_ptr_conv.is_owned = false;
45782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45783 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
45786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45787 LDKProbabilisticScoringParameters this_ptr_conv;
45788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45789 this_ptr_conv.is_owned = false;
45790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45791 int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
45795 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) {
45796 LDKProbabilisticScoringParameters this_ptr_conv;
45797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45798 this_ptr_conv.is_owned = false;
45799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45800 ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
45803 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45804 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45805 int64_t ret_ref = 0;
45806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45809 ret_ref = (uintptr_t)ret_var.inner;
45810 if (ret_var.is_owned) {
45815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45816 LDKProbabilisticScoringParameters arg_conv;
45817 arg_conv.inner = (void*)(arg & (~1));
45818 arg_conv.is_owned = false;
45819 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45820 int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45825 LDKProbabilisticScoringParameters orig_conv;
45826 orig_conv.inner = (void*)(orig & (~1));
45827 orig_conv.is_owned = false;
45828 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45829 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45830 int64_t ret_ref = 0;
45831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45834 ret_ref = (uintptr_t)ret_var.inner;
45835 if (ret_var.is_owned) {
45841 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) {
45842 LDKProbabilisticScoringParameters params_conv;
45843 params_conv.inner = (void*)(params & (~1));
45844 params_conv.is_owned = (params & 1) || (params == 0);
45845 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45846 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
45847 LDKNetworkGraph network_graph_conv;
45848 network_graph_conv.inner = (void*)(network_graph & (~1));
45849 network_graph_conv.is_owned = false;
45850 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45851 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45852 CHECK_ACCESS(logger_ptr);
45853 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45854 if (logger_conv.free == LDKLogger_JCalls_free) {
45855 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45856 LDKLogger_JCalls_cloned(&logger_conv);
45858 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45859 int64_t ret_ref = 0;
45860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45863 ret_ref = (uintptr_t)ret_var.inner;
45864 if (ret_var.is_owned) {
45870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
45871 LDKProbabilisticScorer this_arg_conv;
45872 this_arg_conv.inner = (void*)(this_arg & (~1));
45873 this_arg_conv.is_owned = false;
45874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45875 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45878 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) {
45879 LDKProbabilisticScorer this_arg_conv;
45880 this_arg_conv.inner = (void*)(this_arg & (~1));
45881 this_arg_conv.is_owned = false;
45882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45883 LDKNodeId target_conv;
45884 target_conv.inner = (void*)(target & (~1));
45885 target_conv.is_owned = false;
45886 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45887 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45888 *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45889 int64_t ret_ref = (uintptr_t)ret_copy;
45893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45894 LDKProbabilisticScorer this_arg_conv;
45895 this_arg_conv.inner = (void*)(this_arg & (~1));
45896 this_arg_conv.is_owned = false;
45897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45898 LDKNodeId node_id_conv;
45899 node_id_conv.inner = (void*)(node_id & (~1));
45900 node_id_conv.is_owned = false;
45901 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45902 ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45906 LDKProbabilisticScorer this_arg_conv;
45907 this_arg_conv.inner = (void*)(this_arg & (~1));
45908 this_arg_conv.is_owned = false;
45909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45910 LDKNodeId node_id_conv;
45911 node_id_conv.inner = (void*)(node_id & (~1));
45912 node_id_conv.is_owned = false;
45913 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45914 ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1banned(JNIEnv *env, jclass clz, int64_t this_arg) {
45918 LDKProbabilisticScorer this_arg_conv;
45919 this_arg_conv.inner = (void*)(this_arg & (~1));
45920 this_arg_conv.is_owned = false;
45921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45922 ProbabilisticScorer_clear_banned(&this_arg_conv);
45925 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) {
45926 LDKProbabilisticScoringParameters this_arg_conv;
45927 this_arg_conv.inner = (void*)(this_arg & (~1));
45928 this_arg_conv.is_owned = false;
45929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45930 LDKCVec_NodeIdZ node_ids_constr;
45931 node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
45932 if (node_ids_constr.datalen > 0)
45933 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45935 node_ids_constr.data = NULL;
45936 int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
45937 for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45938 int64_t node_ids_conv_8 = node_ids_vals[i];
45939 LDKNodeId node_ids_conv_8_conv;
45940 node_ids_conv_8_conv.inner = (void*)(node_ids_conv_8 & (~1));
45941 node_ids_conv_8_conv.is_owned = (node_ids_conv_8 & 1) || (node_ids_conv_8 == 0);
45942 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45943 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45944 node_ids_constr.data[i] = node_ids_conv_8_conv;
45946 (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
45947 ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
45951 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
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 int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45964 LDKProbabilisticScorer this_arg_conv;
45965 this_arg_conv.inner = (void*)(this_arg & (~1));
45966 this_arg_conv.is_owned = false;
45967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45968 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45969 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45970 return (int64_t)ret_ret;
45973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45974 LDKProbabilisticScorer obj_conv;
45975 obj_conv.inner = (void*)(obj & (~1));
45976 obj_conv.is_owned = false;
45977 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45978 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45979 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45980 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45981 CVec_u8Z_free(ret_var);
45985 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) {
45986 LDKu8slice ser_ref;
45987 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45988 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45989 LDKProbabilisticScoringParameters arg_a_conv;
45990 arg_a_conv.inner = (void*)(arg_a & (~1));
45991 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
45992 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45993 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45994 LDKNetworkGraph arg_b_conv;
45995 arg_b_conv.inner = (void*)(arg_b & (~1));
45996 arg_b_conv.is_owned = false;
45997 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45998 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
45999 CHECK_ACCESS(arg_c_ptr);
46000 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
46001 if (arg_c_conv.free == LDKLogger_JCalls_free) {
46002 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46003 LDKLogger_JCalls_cloned(&arg_c_conv);
46005 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
46006 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
46007 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46008 return (int64_t)ret_conv;
46011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46012 LDKFilesystemPersister this_obj_conv;
46013 this_obj_conv.inner = (void*)(this_obj & (~1));
46014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46016 FilesystemPersister_free(this_obj_conv);
46019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
46020 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
46021 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
46022 int64_t ret_ref = 0;
46023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46026 ret_ref = (uintptr_t)ret_var.inner;
46027 if (ret_var.is_owned) {
46033 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
46034 LDKFilesystemPersister this_arg_conv;
46035 this_arg_conv.inner = (void*)(this_arg & (~1));
46036 this_arg_conv.is_owned = false;
46037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46038 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
46039 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
46045 LDKFilesystemPersister this_arg_conv;
46046 this_arg_conv.inner = (void*)(this_arg & (~1));
46047 this_arg_conv.is_owned = false;
46048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46049 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46050 CHECK_ACCESS(keys_manager_ptr);
46051 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46052 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46053 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46054 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46056 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
46057 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
46058 return (int64_t)ret_conv;
46061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46062 LDKBackgroundProcessor this_obj_conv;
46063 this_obj_conv.inner = (void*)(this_obj & (~1));
46064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46066 BackgroundProcessor_free(this_obj_conv);
46069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46070 if ((this_ptr & 1) != 0) return;
46071 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46072 CHECK_ACCESS(this_ptr_ptr);
46073 LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
46074 FREE((void*)this_ptr);
46075 GossipSync_free(this_ptr_conv);
46078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
46079 LDKP2PGossipSync a_conv;
46080 a_conv.inner = (void*)(a & (~1));
46081 a_conv.is_owned = false;
46082 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46083 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
46084 *ret_copy = GossipSync_p2_p(&a_conv);
46085 int64_t ret_ref = (uintptr_t)ret_copy;
46089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
46090 LDKRapidGossipSync a_conv;
46091 a_conv.inner = (void*)(a & (~1));
46092 a_conv.is_owned = false;
46093 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46094 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
46095 *ret_copy = GossipSync_rapid(&a_conv);
46096 int64_t ret_ref = (uintptr_t)ret_copy;
46100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
46101 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
46102 *ret_copy = GossipSync_none();
46103 int64_t ret_ref = (uintptr_t)ret_copy;
46107 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) {
46108 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
46109 CHECK_ACCESS(persister_ptr);
46110 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
46111 if (persister_conv.free == LDKPersister_JCalls_free) {
46112 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46113 LDKPersister_JCalls_cloned(&persister_conv);
46115 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
46116 CHECK_ACCESS(event_handler_ptr);
46117 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
46118 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
46119 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46120 LDKEventHandler_JCalls_cloned(&event_handler_conv);
46122 LDKChainMonitor chain_monitor_conv;
46123 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
46124 chain_monitor_conv.is_owned = false;
46125 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
46126 LDKChannelManager channel_manager_conv;
46127 channel_manager_conv.inner = (void*)(channel_manager & (~1));
46128 channel_manager_conv.is_owned = false;
46129 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
46130 void* gossip_sync_ptr = (void*)(((uintptr_t)gossip_sync) & ~1);
46131 CHECK_ACCESS(gossip_sync_ptr);
46132 LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
46133 // WARNING: we may need a move here but no clone is available for LDKGossipSync
46134 LDKPeerManager peer_manager_conv;
46135 peer_manager_conv.inner = (void*)(peer_manager & (~1));
46136 peer_manager_conv.is_owned = false;
46137 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
46138 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46139 CHECK_ACCESS(logger_ptr);
46140 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46141 if (logger_conv.free == LDKLogger_JCalls_free) {
46142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46143 LDKLogger_JCalls_cloned(&logger_conv);
46145 LDKMultiThreadedLockableScore scorer_conv;
46146 scorer_conv.inner = (void*)(scorer & (~1));
46147 scorer_conv.is_owned = (scorer & 1) || (scorer == 0);
46148 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
46149 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);
46150 int64_t ret_ref = 0;
46151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46154 ret_ref = (uintptr_t)ret_var.inner;
46155 if (ret_var.is_owned) {
46161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
46162 LDKBackgroundProcessor this_arg_conv;
46163 this_arg_conv.inner = (void*)(this_arg & (~1));
46164 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
46165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46166 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
46167 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
46168 *ret_conv = BackgroundProcessor_join(this_arg_conv);
46169 return (int64_t)ret_conv;
46172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
46173 LDKBackgroundProcessor this_arg_conv;
46174 this_arg_conv.inner = (void*)(this_arg & (~1));
46175 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
46176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46177 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
46178 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
46179 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
46180 return (int64_t)ret_conv;
46183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46184 if ((this_ptr & 1) != 0) return;
46185 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46186 CHECK_ACCESS(this_ptr_ptr);
46187 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
46188 FREE((void*)this_ptr);
46189 ParseError_free(this_ptr_conv);
46192 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
46193 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46194 *ret_copy = ParseError_clone(arg);
46195 int64_t ret_ref = (uintptr_t)ret_copy;
46198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46199 LDKParseError* arg_conv = (LDKParseError*)arg;
46200 int64_t ret_conv = ParseError_clone_ptr(arg_conv);
46204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46205 LDKParseError* orig_conv = (LDKParseError*)orig;
46206 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46207 *ret_copy = ParseError_clone(orig_conv);
46208 int64_t ret_ref = (uintptr_t)ret_copy;
46212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
46213 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
46214 CHECK_ACCESS(a_ptr);
46215 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
46216 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
46217 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46218 *ret_copy = ParseError_bech32_error(a_conv);
46219 int64_t ret_ref = (uintptr_t)ret_copy;
46223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
46225 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46226 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
46227 int64_t ret_ref = (uintptr_t)ret_copy;
46231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
46232 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
46233 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46234 *ret_copy = ParseError_malformed_signature(a_conv);
46235 int64_t ret_ref = (uintptr_t)ret_copy;
46239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
46240 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46241 *ret_copy = ParseError_bad_prefix();
46242 int64_t ret_ref = (uintptr_t)ret_copy;
46246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
46247 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46248 *ret_copy = ParseError_unknown_currency();
46249 int64_t ret_ref = (uintptr_t)ret_copy;
46253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
46254 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46255 *ret_copy = ParseError_unknown_si_prefix();
46256 int64_t ret_ref = (uintptr_t)ret_copy;
46260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
46261 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46262 *ret_copy = ParseError_malformed_hrp();
46263 int64_t ret_ref = (uintptr_t)ret_copy;
46267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
46268 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46269 *ret_copy = ParseError_too_short_data_part();
46270 int64_t ret_ref = (uintptr_t)ret_copy;
46274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
46275 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46276 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
46277 int64_t ret_ref = (uintptr_t)ret_copy;
46281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
46283 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46284 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
46285 int64_t ret_ref = (uintptr_t)ret_copy;
46289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
46290 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46291 *ret_copy = ParseError_padding_error();
46292 int64_t ret_ref = (uintptr_t)ret_copy;
46296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
46297 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46298 *ret_copy = ParseError_integer_overflow_error();
46299 int64_t ret_ref = (uintptr_t)ret_copy;
46303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
46304 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46305 *ret_copy = ParseError_invalid_seg_wit_program_length();
46306 int64_t ret_ref = (uintptr_t)ret_copy;
46310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
46311 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46312 *ret_copy = ParseError_invalid_pub_key_hash_length();
46313 int64_t ret_ref = (uintptr_t)ret_copy;
46317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
46318 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46319 *ret_copy = ParseError_invalid_script_hash_length();
46320 int64_t ret_ref = (uintptr_t)ret_copy;
46324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
46325 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46326 *ret_copy = ParseError_invalid_recovery_id();
46327 int64_t ret_ref = (uintptr_t)ret_copy;
46331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
46332 LDKStr a_conv = java_to_owned_str(env, a);
46333 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46334 *ret_copy = ParseError_invalid_slice_length(a_conv);
46335 int64_t ret_ref = (uintptr_t)ret_copy;
46339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
46340 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46341 *ret_copy = ParseError_skip();
46342 int64_t ret_ref = (uintptr_t)ret_copy;
46346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46347 if ((this_ptr & 1) != 0) return;
46348 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46349 CHECK_ACCESS(this_ptr_ptr);
46350 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
46351 FREE((void*)this_ptr);
46352 ParseOrSemanticError_free(this_ptr_conv);
46355 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
46356 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46357 *ret_copy = ParseOrSemanticError_clone(arg);
46358 int64_t ret_ref = (uintptr_t)ret_copy;
46361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46362 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
46363 int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
46367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46368 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
46369 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46370 *ret_copy = ParseOrSemanticError_clone(orig_conv);
46371 int64_t ret_ref = (uintptr_t)ret_copy;
46375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
46376 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
46377 CHECK_ACCESS(a_ptr);
46378 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
46379 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
46380 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46381 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
46382 int64_t ret_ref = (uintptr_t)ret_copy;
46386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
46387 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
46388 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46389 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
46390 int64_t ret_ref = (uintptr_t)ret_copy;
46394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46395 LDKInvoice this_obj_conv;
46396 this_obj_conv.inner = (void*)(this_obj & (~1));
46397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46399 Invoice_free(this_obj_conv);
46402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46404 a_conv.inner = (void*)(a & (~1));
46405 a_conv.is_owned = false;
46406 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46408 b_conv.inner = (void*)(b & (~1));
46409 b_conv.is_owned = false;
46410 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46411 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
46415 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
46416 LDKInvoice ret_var = Invoice_clone(arg);
46417 int64_t ret_ref = 0;
46418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46421 ret_ref = (uintptr_t)ret_var.inner;
46422 if (ret_var.is_owned) {
46427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46428 LDKInvoice arg_conv;
46429 arg_conv.inner = (void*)(arg & (~1));
46430 arg_conv.is_owned = false;
46431 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46432 int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
46436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46437 LDKInvoice orig_conv;
46438 orig_conv.inner = (void*)(orig & (~1));
46439 orig_conv.is_owned = false;
46440 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46441 LDKInvoice ret_var = Invoice_clone(&orig_conv);
46442 int64_t ret_ref = 0;
46443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46446 ret_ref = (uintptr_t)ret_var.inner;
46447 if (ret_var.is_owned) {
46453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46454 LDKSignedRawInvoice this_obj_conv;
46455 this_obj_conv.inner = (void*)(this_obj & (~1));
46456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46458 SignedRawInvoice_free(this_obj_conv);
46461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46462 LDKSignedRawInvoice a_conv;
46463 a_conv.inner = (void*)(a & (~1));
46464 a_conv.is_owned = false;
46465 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46466 LDKSignedRawInvoice b_conv;
46467 b_conv.inner = (void*)(b & (~1));
46468 b_conv.is_owned = false;
46469 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46470 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
46474 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
46475 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
46476 int64_t ret_ref = 0;
46477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46480 ret_ref = (uintptr_t)ret_var.inner;
46481 if (ret_var.is_owned) {
46486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46487 LDKSignedRawInvoice arg_conv;
46488 arg_conv.inner = (void*)(arg & (~1));
46489 arg_conv.is_owned = false;
46490 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46491 int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
46495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46496 LDKSignedRawInvoice orig_conv;
46497 orig_conv.inner = (void*)(orig & (~1));
46498 orig_conv.is_owned = false;
46499 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46500 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
46501 int64_t ret_ref = 0;
46502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46505 ret_ref = (uintptr_t)ret_var.inner;
46506 if (ret_var.is_owned) {
46512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46513 LDKRawInvoice this_obj_conv;
46514 this_obj_conv.inner = (void*)(this_obj & (~1));
46515 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46517 RawInvoice_free(this_obj_conv);
46520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46521 LDKRawInvoice this_ptr_conv;
46522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46523 this_ptr_conv.is_owned = false;
46524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46525 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
46526 int64_t ret_ref = 0;
46527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46530 ret_ref = (uintptr_t)ret_var.inner;
46531 if (ret_var.is_owned) {
46537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46538 LDKRawInvoice this_ptr_conv;
46539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46540 this_ptr_conv.is_owned = false;
46541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46542 LDKRawDataPart val_conv;
46543 val_conv.inner = (void*)(val & (~1));
46544 val_conv.is_owned = (val & 1) || (val == 0);
46545 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46546 val_conv = RawDataPart_clone(&val_conv);
46547 RawInvoice_set_data(&this_ptr_conv, val_conv);
46550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46551 LDKRawInvoice a_conv;
46552 a_conv.inner = (void*)(a & (~1));
46553 a_conv.is_owned = false;
46554 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46555 LDKRawInvoice b_conv;
46556 b_conv.inner = (void*)(b & (~1));
46557 b_conv.is_owned = false;
46558 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46559 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
46563 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
46564 LDKRawInvoice ret_var = RawInvoice_clone(arg);
46565 int64_t ret_ref = 0;
46566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46569 ret_ref = (uintptr_t)ret_var.inner;
46570 if (ret_var.is_owned) {
46575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46576 LDKRawInvoice arg_conv;
46577 arg_conv.inner = (void*)(arg & (~1));
46578 arg_conv.is_owned = false;
46579 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46580 int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
46584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46585 LDKRawInvoice orig_conv;
46586 orig_conv.inner = (void*)(orig & (~1));
46587 orig_conv.is_owned = false;
46588 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46589 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46590 int64_t ret_ref = 0;
46591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46594 ret_ref = (uintptr_t)ret_var.inner;
46595 if (ret_var.is_owned) {
46601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46602 LDKRawDataPart this_obj_conv;
46603 this_obj_conv.inner = (void*)(this_obj & (~1));
46604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46606 RawDataPart_free(this_obj_conv);
46609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46610 LDKRawDataPart this_ptr_conv;
46611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46612 this_ptr_conv.is_owned = false;
46613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46614 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46615 int64_t ret_ref = 0;
46616 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46617 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46619 ret_ref = (uintptr_t)ret_var.inner;
46620 if (ret_var.is_owned) {
46626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46627 LDKRawDataPart this_ptr_conv;
46628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46629 this_ptr_conv.is_owned = false;
46630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46631 LDKPositiveTimestamp val_conv;
46632 val_conv.inner = (void*)(val & (~1));
46633 val_conv.is_owned = (val & 1) || (val == 0);
46634 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46635 val_conv = PositiveTimestamp_clone(&val_conv);
46636 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46640 LDKRawDataPart a_conv;
46641 a_conv.inner = (void*)(a & (~1));
46642 a_conv.is_owned = false;
46643 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46644 LDKRawDataPart b_conv;
46645 b_conv.inner = (void*)(b & (~1));
46646 b_conv.is_owned = false;
46647 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46648 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
46652 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
46653 LDKRawDataPart ret_var = RawDataPart_clone(arg);
46654 int64_t ret_ref = 0;
46655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46658 ret_ref = (uintptr_t)ret_var.inner;
46659 if (ret_var.is_owned) {
46664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46665 LDKRawDataPart arg_conv;
46666 arg_conv.inner = (void*)(arg & (~1));
46667 arg_conv.is_owned = false;
46668 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46669 int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
46673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46674 LDKRawDataPart orig_conv;
46675 orig_conv.inner = (void*)(orig & (~1));
46676 orig_conv.is_owned = false;
46677 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46678 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
46679 int64_t ret_ref = 0;
46680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46683 ret_ref = (uintptr_t)ret_var.inner;
46684 if (ret_var.is_owned) {
46690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46691 LDKPositiveTimestamp this_obj_conv;
46692 this_obj_conv.inner = (void*)(this_obj & (~1));
46693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46695 PositiveTimestamp_free(this_obj_conv);
46698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46699 LDKPositiveTimestamp a_conv;
46700 a_conv.inner = (void*)(a & (~1));
46701 a_conv.is_owned = false;
46702 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46703 LDKPositiveTimestamp b_conv;
46704 b_conv.inner = (void*)(b & (~1));
46705 b_conv.is_owned = false;
46706 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46707 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
46711 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
46712 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
46713 int64_t ret_ref = 0;
46714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46717 ret_ref = (uintptr_t)ret_var.inner;
46718 if (ret_var.is_owned) {
46723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46724 LDKPositiveTimestamp arg_conv;
46725 arg_conv.inner = (void*)(arg & (~1));
46726 arg_conv.is_owned = false;
46727 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46728 int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
46732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46733 LDKPositiveTimestamp orig_conv;
46734 orig_conv.inner = (void*)(orig & (~1));
46735 orig_conv.is_owned = false;
46736 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46737 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
46738 int64_t ret_ref = 0;
46739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46742 ret_ref = (uintptr_t)ret_var.inner;
46743 if (ret_var.is_owned) {
46749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46750 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
46751 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
46755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
46756 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
46760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
46761 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
46765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
46766 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
46770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
46771 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
46775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46776 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
46777 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
46778 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
46782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
46783 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
46784 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
46788 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46789 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
46790 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
46794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
46795 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
46799 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
46800 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
46804 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
46805 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
46809 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
46810 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
46814 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
46815 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
46819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
46820 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
46821 int64_t ret_conv = Currency_hash(o_conv);
46825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46826 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
46827 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
46828 jboolean ret_conv = Currency_eq(a_conv, b_conv);
46832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46833 LDKSha256 this_obj_conv;
46834 this_obj_conv.inner = (void*)(this_obj & (~1));
46835 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46837 Sha256_free(this_obj_conv);
46840 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
46841 LDKSha256 ret_var = Sha256_clone(arg);
46842 int64_t ret_ref = 0;
46843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46846 ret_ref = (uintptr_t)ret_var.inner;
46847 if (ret_var.is_owned) {
46852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46853 LDKSha256 arg_conv;
46854 arg_conv.inner = (void*)(arg & (~1));
46855 arg_conv.is_owned = false;
46856 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46857 int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
46861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46862 LDKSha256 orig_conv;
46863 orig_conv.inner = (void*)(orig & (~1));
46864 orig_conv.is_owned = false;
46865 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46866 LDKSha256 ret_var = Sha256_clone(&orig_conv);
46867 int64_t ret_ref = 0;
46868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46871 ret_ref = (uintptr_t)ret_var.inner;
46872 if (ret_var.is_owned) {
46878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
46880 o_conv.inner = (void*)(o & (~1));
46881 o_conv.is_owned = false;
46882 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46883 int64_t ret_conv = Sha256_hash(&o_conv);
46887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46889 a_conv.inner = (void*)(a & (~1));
46890 a_conv.is_owned = false;
46891 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46893 b_conv.inner = (void*)(b & (~1));
46894 b_conv.is_owned = false;
46895 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46896 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
46900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46901 LDKDescription this_obj_conv;
46902 this_obj_conv.inner = (void*)(this_obj & (~1));
46903 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46905 Description_free(this_obj_conv);
46908 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
46909 LDKDescription ret_var = Description_clone(arg);
46910 int64_t ret_ref = 0;
46911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46914 ret_ref = (uintptr_t)ret_var.inner;
46915 if (ret_var.is_owned) {
46920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46921 LDKDescription arg_conv;
46922 arg_conv.inner = (void*)(arg & (~1));
46923 arg_conv.is_owned = false;
46924 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46925 int64_t ret_conv = Description_clone_ptr(&arg_conv);
46929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46930 LDKDescription orig_conv;
46931 orig_conv.inner = (void*)(orig & (~1));
46932 orig_conv.is_owned = false;
46933 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46934 LDKDescription ret_var = Description_clone(&orig_conv);
46935 int64_t ret_ref = 0;
46936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46939 ret_ref = (uintptr_t)ret_var.inner;
46940 if (ret_var.is_owned) {
46946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
46947 LDKDescription o_conv;
46948 o_conv.inner = (void*)(o & (~1));
46949 o_conv.is_owned = false;
46950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46951 int64_t ret_conv = Description_hash(&o_conv);
46955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46956 LDKDescription a_conv;
46957 a_conv.inner = (void*)(a & (~1));
46958 a_conv.is_owned = false;
46959 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46960 LDKDescription b_conv;
46961 b_conv.inner = (void*)(b & (~1));
46962 b_conv.is_owned = false;
46963 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46964 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
46968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46969 LDKPayeePubKey this_obj_conv;
46970 this_obj_conv.inner = (void*)(this_obj & (~1));
46971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46973 PayeePubKey_free(this_obj_conv);
46976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46977 LDKPayeePubKey this_ptr_conv;
46978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46979 this_ptr_conv.is_owned = false;
46980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46981 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
46986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46987 LDKPayeePubKey this_ptr_conv;
46988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46989 this_ptr_conv.is_owned = false;
46990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46991 LDKPublicKey val_ref;
46992 CHECK((*env)->GetArrayLength(env, val) == 33);
46993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46994 PayeePubKey_set_a(&this_ptr_conv, val_ref);
46997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
46998 LDKPublicKey a_arg_ref;
46999 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
47000 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
47001 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
47002 int64_t ret_ref = 0;
47003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47006 ret_ref = (uintptr_t)ret_var.inner;
47007 if (ret_var.is_owned) {
47013 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
47014 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
47015 int64_t ret_ref = 0;
47016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47019 ret_ref = (uintptr_t)ret_var.inner;
47020 if (ret_var.is_owned) {
47025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47026 LDKPayeePubKey arg_conv;
47027 arg_conv.inner = (void*)(arg & (~1));
47028 arg_conv.is_owned = false;
47029 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47030 int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
47034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47035 LDKPayeePubKey orig_conv;
47036 orig_conv.inner = (void*)(orig & (~1));
47037 orig_conv.is_owned = false;
47038 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47039 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
47040 int64_t ret_ref = 0;
47041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47044 ret_ref = (uintptr_t)ret_var.inner;
47045 if (ret_var.is_owned) {
47051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
47052 LDKPayeePubKey o_conv;
47053 o_conv.inner = (void*)(o & (~1));
47054 o_conv.is_owned = false;
47055 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47056 int64_t ret_conv = PayeePubKey_hash(&o_conv);
47060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47061 LDKPayeePubKey a_conv;
47062 a_conv.inner = (void*)(a & (~1));
47063 a_conv.is_owned = false;
47064 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47065 LDKPayeePubKey b_conv;
47066 b_conv.inner = (void*)(b & (~1));
47067 b_conv.is_owned = false;
47068 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47069 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
47073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47074 LDKExpiryTime this_obj_conv;
47075 this_obj_conv.inner = (void*)(this_obj & (~1));
47076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47078 ExpiryTime_free(this_obj_conv);
47081 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
47082 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
47083 int64_t ret_ref = 0;
47084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47087 ret_ref = (uintptr_t)ret_var.inner;
47088 if (ret_var.is_owned) {
47093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47094 LDKExpiryTime arg_conv;
47095 arg_conv.inner = (void*)(arg & (~1));
47096 arg_conv.is_owned = false;
47097 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47098 int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
47102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47103 LDKExpiryTime orig_conv;
47104 orig_conv.inner = (void*)(orig & (~1));
47105 orig_conv.is_owned = false;
47106 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47107 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
47108 int64_t ret_ref = 0;
47109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47112 ret_ref = (uintptr_t)ret_var.inner;
47113 if (ret_var.is_owned) {
47119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
47120 LDKExpiryTime o_conv;
47121 o_conv.inner = (void*)(o & (~1));
47122 o_conv.is_owned = false;
47123 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47124 int64_t ret_conv = ExpiryTime_hash(&o_conv);
47128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47129 LDKExpiryTime a_conv;
47130 a_conv.inner = (void*)(a & (~1));
47131 a_conv.is_owned = false;
47132 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47133 LDKExpiryTime b_conv;
47134 b_conv.inner = (void*)(b & (~1));
47135 b_conv.is_owned = false;
47136 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47137 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
47141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47142 LDKMinFinalCltvExpiry this_obj_conv;
47143 this_obj_conv.inner = (void*)(this_obj & (~1));
47144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47146 MinFinalCltvExpiry_free(this_obj_conv);
47149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
47150 LDKMinFinalCltvExpiry this_ptr_conv;
47151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47152 this_ptr_conv.is_owned = false;
47153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47154 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
47158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47159 LDKMinFinalCltvExpiry this_ptr_conv;
47160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47161 this_ptr_conv.is_owned = false;
47162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47163 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
47166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
47167 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
47168 int64_t ret_ref = 0;
47169 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47170 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47172 ret_ref = (uintptr_t)ret_var.inner;
47173 if (ret_var.is_owned) {
47179 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
47180 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
47181 int64_t ret_ref = 0;
47182 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47183 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47184 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47185 ret_ref = (uintptr_t)ret_var.inner;
47186 if (ret_var.is_owned) {
47191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47192 LDKMinFinalCltvExpiry arg_conv;
47193 arg_conv.inner = (void*)(arg & (~1));
47194 arg_conv.is_owned = false;
47195 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47196 int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
47200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47201 LDKMinFinalCltvExpiry orig_conv;
47202 orig_conv.inner = (void*)(orig & (~1));
47203 orig_conv.is_owned = false;
47204 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47205 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
47206 int64_t ret_ref = 0;
47207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47210 ret_ref = (uintptr_t)ret_var.inner;
47211 if (ret_var.is_owned) {
47217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
47218 LDKMinFinalCltvExpiry o_conv;
47219 o_conv.inner = (void*)(o & (~1));
47220 o_conv.is_owned = false;
47221 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47222 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
47226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47227 LDKMinFinalCltvExpiry a_conv;
47228 a_conv.inner = (void*)(a & (~1));
47229 a_conv.is_owned = false;
47230 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47231 LDKMinFinalCltvExpiry b_conv;
47232 b_conv.inner = (void*)(b & (~1));
47233 b_conv.is_owned = false;
47234 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47235 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
47239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47240 if ((this_ptr & 1) != 0) return;
47241 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47242 CHECK_ACCESS(this_ptr_ptr);
47243 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
47244 FREE((void*)this_ptr);
47245 Fallback_free(this_ptr_conv);
47248 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
47249 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47250 *ret_copy = Fallback_clone(arg);
47251 int64_t ret_ref = (uintptr_t)ret_copy;
47254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47255 LDKFallback* arg_conv = (LDKFallback*)arg;
47256 int64_t ret_conv = Fallback_clone_ptr(arg_conv);
47260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47261 LDKFallback* orig_conv = (LDKFallback*)orig;
47262 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47263 *ret_copy = Fallback_clone(orig_conv);
47264 int64_t ret_ref = (uintptr_t)ret_copy;
47268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
47270 LDKCVec_u8Z program_ref;
47271 program_ref.datalen = (*env)->GetArrayLength(env, program);
47272 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
47273 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
47274 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47275 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
47276 int64_t ret_ref = (uintptr_t)ret_copy;
47280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
47281 LDKTwentyBytes a_ref;
47282 CHECK((*env)->GetArrayLength(env, a) == 20);
47283 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
47284 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47285 *ret_copy = Fallback_pub_key_hash(a_ref);
47286 int64_t ret_ref = (uintptr_t)ret_copy;
47290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
47291 LDKTwentyBytes a_ref;
47292 CHECK((*env)->GetArrayLength(env, a) == 20);
47293 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
47294 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47295 *ret_copy = Fallback_script_hash(a_ref);
47296 int64_t ret_ref = (uintptr_t)ret_copy;
47300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
47301 LDKFallback* o_conv = (LDKFallback*)o;
47302 int64_t ret_conv = Fallback_hash(o_conv);
47306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47307 LDKFallback* a_conv = (LDKFallback*)a;
47308 LDKFallback* b_conv = (LDKFallback*)b;
47309 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
47313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47314 LDKInvoiceSignature this_obj_conv;
47315 this_obj_conv.inner = (void*)(this_obj & (~1));
47316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47318 InvoiceSignature_free(this_obj_conv);
47321 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
47322 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
47323 int64_t ret_ref = 0;
47324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47327 ret_ref = (uintptr_t)ret_var.inner;
47328 if (ret_var.is_owned) {
47333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47334 LDKInvoiceSignature arg_conv;
47335 arg_conv.inner = (void*)(arg & (~1));
47336 arg_conv.is_owned = false;
47337 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47338 int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
47342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47343 LDKInvoiceSignature orig_conv;
47344 orig_conv.inner = (void*)(orig & (~1));
47345 orig_conv.is_owned = false;
47346 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47347 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
47348 int64_t ret_ref = 0;
47349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47352 ret_ref = (uintptr_t)ret_var.inner;
47353 if (ret_var.is_owned) {
47359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47360 LDKInvoiceSignature a_conv;
47361 a_conv.inner = (void*)(a & (~1));
47362 a_conv.is_owned = false;
47363 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47364 LDKInvoiceSignature b_conv;
47365 b_conv.inner = (void*)(b & (~1));
47366 b_conv.is_owned = false;
47367 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47368 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
47372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47373 LDKPrivateRoute this_obj_conv;
47374 this_obj_conv.inner = (void*)(this_obj & (~1));
47375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47377 PrivateRoute_free(this_obj_conv);
47380 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
47381 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
47382 int64_t ret_ref = 0;
47383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47386 ret_ref = (uintptr_t)ret_var.inner;
47387 if (ret_var.is_owned) {
47392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47393 LDKPrivateRoute arg_conv;
47394 arg_conv.inner = (void*)(arg & (~1));
47395 arg_conv.is_owned = false;
47396 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47397 int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
47401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47402 LDKPrivateRoute orig_conv;
47403 orig_conv.inner = (void*)(orig & (~1));
47404 orig_conv.is_owned = false;
47405 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47406 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
47407 int64_t ret_ref = 0;
47408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47411 ret_ref = (uintptr_t)ret_var.inner;
47412 if (ret_var.is_owned) {
47418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
47419 LDKPrivateRoute o_conv;
47420 o_conv.inner = (void*)(o & (~1));
47421 o_conv.is_owned = false;
47422 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47423 int64_t ret_conv = PrivateRoute_hash(&o_conv);
47427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47428 LDKPrivateRoute a_conv;
47429 a_conv.inner = (void*)(a & (~1));
47430 a_conv.is_owned = false;
47431 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47432 LDKPrivateRoute b_conv;
47433 b_conv.inner = (void*)(b & (~1));
47434 b_conv.is_owned = false;
47435 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47436 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
47440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
47441 LDKSignedRawInvoice this_arg_conv;
47442 this_arg_conv.inner = (void*)(this_arg & (~1));
47443 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47445 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
47446 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
47447 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
47448 return ((int64_t)ret_conv);
47451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
47452 LDKSignedRawInvoice this_arg_conv;
47453 this_arg_conv.inner = (void*)(this_arg & (~1));
47454 this_arg_conv.is_owned = false;
47455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47456 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
47457 int64_t ret_ref = 0;
47458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47461 ret_ref = (uintptr_t)ret_var.inner;
47462 if (ret_var.is_owned) {
47468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47469 LDKSignedRawInvoice this_arg_conv;
47470 this_arg_conv.inner = (void*)(this_arg & (~1));
47471 this_arg_conv.is_owned = false;
47472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47473 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47474 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
47478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47479 LDKSignedRawInvoice this_arg_conv;
47480 this_arg_conv.inner = (void*)(this_arg & (~1));
47481 this_arg_conv.is_owned = false;
47482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47483 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
47484 int64_t ret_ref = 0;
47485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47488 ret_ref = (uintptr_t)ret_var.inner;
47489 if (ret_var.is_owned) {
47495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47496 LDKSignedRawInvoice this_arg_conv;
47497 this_arg_conv.inner = (void*)(this_arg & (~1));
47498 this_arg_conv.is_owned = false;
47499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47500 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
47501 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
47502 return (int64_t)ret_conv;
47505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47506 LDKSignedRawInvoice this_arg_conv;
47507 this_arg_conv.inner = (void*)(this_arg & (~1));
47508 this_arg_conv.is_owned = false;
47509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47510 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
47514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47515 LDKRawInvoice this_arg_conv;
47516 this_arg_conv.inner = (void*)(this_arg & (~1));
47517 this_arg_conv.is_owned = false;
47518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47519 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
47524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47525 LDKRawInvoice this_arg_conv;
47526 this_arg_conv.inner = (void*)(this_arg & (~1));
47527 this_arg_conv.is_owned = false;
47528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47529 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
47530 int64_t ret_ref = 0;
47531 if ((uintptr_t)ret_var.inner > 4096) {
47532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47535 ret_ref = (uintptr_t)ret_var.inner;
47536 if (ret_var.is_owned) {
47543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
47544 LDKRawInvoice this_arg_conv;
47545 this_arg_conv.inner = (void*)(this_arg & (~1));
47546 this_arg_conv.is_owned = false;
47547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47548 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
47549 int64_t ret_ref = 0;
47550 if ((uintptr_t)ret_var.inner > 4096) {
47551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47554 ret_ref = (uintptr_t)ret_var.inner;
47555 if (ret_var.is_owned) {
47562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47563 LDKRawInvoice this_arg_conv;
47564 this_arg_conv.inner = (void*)(this_arg & (~1));
47565 this_arg_conv.is_owned = false;
47566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47567 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
47568 int64_t ret_ref = 0;
47569 if ((uintptr_t)ret_var.inner > 4096) {
47570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47573 ret_ref = (uintptr_t)ret_var.inner;
47574 if (ret_var.is_owned) {
47581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47582 LDKRawInvoice this_arg_conv;
47583 this_arg_conv.inner = (void*)(this_arg & (~1));
47584 this_arg_conv.is_owned = false;
47585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47586 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
47587 int64_t ret_ref = 0;
47588 if ((uintptr_t)ret_var.inner > 4096) {
47589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47592 ret_ref = (uintptr_t)ret_var.inner;
47593 if (ret_var.is_owned) {
47600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47601 LDKRawInvoice this_arg_conv;
47602 this_arg_conv.inner = (void*)(this_arg & (~1));
47603 this_arg_conv.is_owned = false;
47604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47605 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
47606 int64_t ret_ref = 0;
47607 if ((uintptr_t)ret_var.inner > 4096) {
47608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47611 ret_ref = (uintptr_t)ret_var.inner;
47612 if (ret_var.is_owned) {
47619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47620 LDKRawInvoice this_arg_conv;
47621 this_arg_conv.inner = (void*)(this_arg & (~1));
47622 this_arg_conv.is_owned = false;
47623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47624 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
47625 int64_t ret_ref = 0;
47626 if ((uintptr_t)ret_var.inner > 4096) {
47627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47630 ret_ref = (uintptr_t)ret_var.inner;
47631 if (ret_var.is_owned) {
47638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47639 LDKRawInvoice this_arg_conv;
47640 this_arg_conv.inner = (void*)(this_arg & (~1));
47641 this_arg_conv.is_owned = false;
47642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47643 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47644 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
47648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47649 LDKRawInvoice this_arg_conv;
47650 this_arg_conv.inner = (void*)(this_arg & (~1));
47651 this_arg_conv.is_owned = false;
47652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47653 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
47654 int64_t ret_ref = 0;
47655 if ((uintptr_t)ret_var.inner > 4096) {
47656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47659 ret_ref = (uintptr_t)ret_var.inner;
47660 if (ret_var.is_owned) {
47667 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47668 LDKRawInvoice this_arg_conv;
47669 this_arg_conv.inner = (void*)(this_arg & (~1));
47670 this_arg_conv.is_owned = false;
47671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47672 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
47673 int64_tArray ret_arr = NULL;
47674 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47675 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47676 for (size_t o = 0; o < ret_var.datalen; o++) {
47677 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47678 int64_t ret_conv_14_ref = 0;
47679 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47680 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47682 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
47683 if (ret_conv_14_var.is_owned) {
47684 ret_conv_14_ref |= 1;
47686 ret_arr_ptr[o] = ret_conv_14_ref;
47688 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47689 FREE(ret_var.data);
47693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
47694 LDKRawInvoice this_arg_conv;
47695 this_arg_conv.inner = (void*)(this_arg & (~1));
47696 this_arg_conv.is_owned = false;
47697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47698 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47699 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47700 int64_t ret_ref = (uintptr_t)ret_copy;
47704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47705 LDKRawInvoice this_arg_conv;
47706 this_arg_conv.inner = (void*)(this_arg & (~1));
47707 this_arg_conv.is_owned = false;
47708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47709 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
47713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
47714 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47715 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
47716 return (int64_t)ret_conv;
47719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
47720 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47721 *ret_conv = PositiveTimestamp_from_system_time(time);
47722 return (int64_t)ret_conv;
47725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
47726 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47727 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
47728 return (int64_t)ret_conv;
47731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47732 LDKPositiveTimestamp this_arg_conv;
47733 this_arg_conv.inner = (void*)(this_arg & (~1));
47734 this_arg_conv.is_owned = false;
47735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47736 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
47740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47741 LDKPositiveTimestamp this_arg_conv;
47742 this_arg_conv.inner = (void*)(this_arg & (~1));
47743 this_arg_conv.is_owned = false;
47744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47745 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
47749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47750 LDKPositiveTimestamp this_arg_conv;
47751 this_arg_conv.inner = (void*)(this_arg & (~1));
47752 this_arg_conv.is_owned = false;
47753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47754 int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
47758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
47759 LDKInvoice this_arg_conv;
47760 this_arg_conv.inner = (void*)(this_arg & (~1));
47761 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47763 this_arg_conv = Invoice_clone(&this_arg_conv);
47764 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
47765 int64_t ret_ref = 0;
47766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47769 ret_ref = (uintptr_t)ret_var.inner;
47770 if (ret_var.is_owned) {
47776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47777 LDKInvoice this_arg_conv;
47778 this_arg_conv.inner = (void*)(this_arg & (~1));
47779 this_arg_conv.is_owned = false;
47780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47781 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
47782 *ret_conv = Invoice_check_signature(&this_arg_conv);
47783 return (int64_t)ret_conv;
47786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
47787 LDKSignedRawInvoice signed_invoice_conv;
47788 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
47789 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
47790 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
47791 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
47792 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
47793 *ret_conv = Invoice_from_signed(signed_invoice_conv);
47794 return (int64_t)ret_conv;
47797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47798 LDKInvoice this_arg_conv;
47799 this_arg_conv.inner = (void*)(this_arg & (~1));
47800 this_arg_conv.is_owned = false;
47801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47802 int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
47806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47807 LDKInvoice this_arg_conv;
47808 this_arg_conv.inner = (void*)(this_arg & (~1));
47809 this_arg_conv.is_owned = false;
47810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47811 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
47815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47816 LDKInvoice this_arg_conv;
47817 this_arg_conv.inner = (void*)(this_arg & (~1));
47818 this_arg_conv.is_owned = false;
47819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47820 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
47825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47826 LDKInvoice this_arg_conv;
47827 this_arg_conv.inner = (void*)(this_arg & (~1));
47828 this_arg_conv.is_owned = false;
47829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47830 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47831 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
47835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47836 LDKInvoice this_arg_conv;
47837 this_arg_conv.inner = (void*)(this_arg & (~1));
47838 this_arg_conv.is_owned = false;
47839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47840 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47841 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
47845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47846 LDKInvoice this_arg_conv;
47847 this_arg_conv.inner = (void*)(this_arg & (~1));
47848 this_arg_conv.is_owned = false;
47849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47850 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
47851 int64_t ret_ref = 0;
47852 if ((uintptr_t)ret_var.inner > 4096) {
47853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47856 ret_ref = (uintptr_t)ret_var.inner;
47857 if (ret_var.is_owned) {
47864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47865 LDKInvoice this_arg_conv;
47866 this_arg_conv.inner = (void*)(this_arg & (~1));
47867 this_arg_conv.is_owned = false;
47868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47869 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47870 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
47874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47875 LDKInvoice this_arg_conv;
47876 this_arg_conv.inner = (void*)(this_arg & (~1));
47877 this_arg_conv.is_owned = false;
47878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47879 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
47883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
47884 LDKInvoice this_arg_conv;
47885 this_arg_conv.inner = (void*)(this_arg & (~1));
47886 this_arg_conv.is_owned = false;
47887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47888 jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
47892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
47893 LDKInvoice this_arg_conv;
47894 this_arg_conv.inner = (void*)(this_arg & (~1));
47895 this_arg_conv.is_owned = false;
47896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47897 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
47901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47902 LDKInvoice this_arg_conv;
47903 this_arg_conv.inner = (void*)(this_arg & (~1));
47904 this_arg_conv.is_owned = false;
47905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47906 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
47910 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47911 LDKInvoice this_arg_conv;
47912 this_arg_conv.inner = (void*)(this_arg & (~1));
47913 this_arg_conv.is_owned = false;
47914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47915 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
47916 int64_tArray ret_arr = NULL;
47917 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47918 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47919 for (size_t o = 0; o < ret_var.datalen; o++) {
47920 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47921 int64_t ret_conv_14_ref = 0;
47922 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47923 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47925 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
47926 if (ret_conv_14_var.is_owned) {
47927 ret_conv_14_ref |= 1;
47929 ret_arr_ptr[o] = ret_conv_14_ref;
47931 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47932 FREE(ret_var.data);
47936 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
47937 LDKInvoice this_arg_conv;
47938 this_arg_conv.inner = (void*)(this_arg & (~1));
47939 this_arg_conv.is_owned = false;
47940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47941 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
47942 int64_tArray ret_arr = NULL;
47943 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47944 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47945 for (size_t l = 0; l < ret_var.datalen; l++) {
47946 LDKRouteHint ret_conv_11_var = ret_var.data[l];
47947 int64_t ret_conv_11_ref = 0;
47948 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47949 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
47951 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
47952 if (ret_conv_11_var.is_owned) {
47953 ret_conv_11_ref |= 1;
47955 ret_arr_ptr[l] = ret_conv_11_ref;
47957 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47958 FREE(ret_var.data);
47962 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47963 LDKInvoice this_arg_conv;
47964 this_arg_conv.inner = (void*)(this_arg & (~1));
47965 this_arg_conv.is_owned = false;
47966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47967 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
47971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
47972 LDKInvoice this_arg_conv;
47973 this_arg_conv.inner = (void*)(this_arg & (~1));
47974 this_arg_conv.is_owned = false;
47975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47976 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47977 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
47978 int64_t ret_ref = (uintptr_t)ret_copy;
47982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
47983 LDKStr description_conv = java_to_owned_str(env, description);
47984 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
47985 *ret_conv = Description_new(description_conv);
47986 return (int64_t)ret_conv;
47989 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47990 LDKDescription this_arg_conv;
47991 this_arg_conv.inner = (void*)(this_arg & (~1));
47992 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47994 this_arg_conv = Description_clone(&this_arg_conv);
47995 LDKStr ret_str = Description_into_inner(this_arg_conv);
47996 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
48002 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
48003 int64_t ret_ref = 0;
48004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48007 ret_ref = (uintptr_t)ret_var.inner;
48008 if (ret_var.is_owned) {
48014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
48015 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
48016 int64_t ret_ref = 0;
48017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48020 ret_ref = (uintptr_t)ret_var.inner;
48021 if (ret_var.is_owned) {
48027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
48028 LDKExpiryTime this_arg_conv;
48029 this_arg_conv.inner = (void*)(this_arg & (~1));
48030 this_arg_conv.is_owned = false;
48031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48032 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
48036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
48037 LDKExpiryTime this_arg_conv;
48038 this_arg_conv.inner = (void*)(this_arg & (~1));
48039 this_arg_conv.is_owned = false;
48040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48041 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
48045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
48046 LDKRouteHint hops_conv;
48047 hops_conv.inner = (void*)(hops & (~1));
48048 hops_conv.is_owned = (hops & 1) || (hops == 0);
48049 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
48050 hops_conv = RouteHint_clone(&hops_conv);
48051 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
48052 *ret_conv = PrivateRoute_new(hops_conv);
48053 return (int64_t)ret_conv;
48056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
48057 LDKPrivateRoute this_arg_conv;
48058 this_arg_conv.inner = (void*)(this_arg & (~1));
48059 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
48060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48061 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
48062 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
48063 int64_t ret_ref = 0;
48064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48067 ret_ref = (uintptr_t)ret_var.inner;
48068 if (ret_var.is_owned) {
48074 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48075 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
48076 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
48080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
48081 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
48085 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
48086 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
48090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
48091 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
48095 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
48096 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
48100 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
48101 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
48105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48106 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
48107 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
48108 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
48112 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48113 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
48114 LDKStr ret_str = CreationError_to_str(o_conv);
48115 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48120 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48121 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
48122 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
48126 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
48127 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
48131 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
48132 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
48136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
48137 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
48141 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
48142 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
48146 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
48147 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
48151 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
48152 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
48156 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
48157 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
48161 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
48162 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
48166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
48167 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
48171 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
48172 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
48176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48177 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
48178 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
48179 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
48183 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48184 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
48185 LDKStr ret_str = SemanticError_to_str(o_conv);
48186 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48192 if ((this_ptr & 1) != 0) return;
48193 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48194 CHECK_ACCESS(this_ptr_ptr);
48195 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
48196 FREE((void*)this_ptr);
48197 SignOrCreationError_free(this_ptr_conv);
48200 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
48201 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48202 *ret_copy = SignOrCreationError_clone(arg);
48203 int64_t ret_ref = (uintptr_t)ret_copy;
48206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48207 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
48208 int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
48212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48213 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
48214 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48215 *ret_copy = SignOrCreationError_clone(orig_conv);
48216 int64_t ret_ref = (uintptr_t)ret_copy;
48220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
48221 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48222 *ret_copy = SignOrCreationError_sign_error();
48223 int64_t ret_ref = (uintptr_t)ret_copy;
48227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
48228 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
48229 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48230 *ret_copy = SignOrCreationError_creation_error(a_conv);
48231 int64_t ret_ref = (uintptr_t)ret_copy;
48235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48236 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
48237 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
48238 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
48242 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48243 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
48244 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
48245 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48251 LDKInvoicePayer this_obj_conv;
48252 this_obj_conv.inner = (void*)(this_obj & (~1));
48253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48255 InvoicePayer_free(this_obj_conv);
48258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48259 if ((this_ptr & 1) != 0) return;
48260 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48261 CHECK_ACCESS(this_ptr_ptr);
48262 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
48263 FREE((void*)this_ptr);
48264 Payer_free(this_ptr_conv);
48267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48268 if ((this_ptr & 1) != 0) return;
48269 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48270 CHECK_ACCESS(this_ptr_ptr);
48271 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
48272 FREE((void*)this_ptr);
48273 Router_free(this_ptr_conv);
48276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48277 if ((this_ptr & 1) != 0) return;
48278 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48279 CHECK_ACCESS(this_ptr_ptr);
48280 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
48281 FREE((void*)this_ptr);
48282 Retry_free(this_ptr_conv);
48285 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
48286 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48287 *ret_copy = Retry_clone(arg);
48288 int64_t ret_ref = (uintptr_t)ret_copy;
48291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48292 LDKRetry* arg_conv = (LDKRetry*)arg;
48293 int64_t ret_conv = Retry_clone_ptr(arg_conv);
48297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48298 LDKRetry* orig_conv = (LDKRetry*)orig;
48299 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48300 *ret_copy = Retry_clone(orig_conv);
48301 int64_t ret_ref = (uintptr_t)ret_copy;
48305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
48306 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48307 *ret_copy = Retry_attempts(a);
48308 int64_t ret_ref = (uintptr_t)ret_copy;
48312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
48313 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48314 *ret_copy = Retry_timeout(a);
48315 int64_t ret_ref = (uintptr_t)ret_copy;
48319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48320 LDKRetry* a_conv = (LDKRetry*)a;
48321 LDKRetry* b_conv = (LDKRetry*)b;
48322 jboolean ret_conv = Retry_eq(a_conv, b_conv);
48326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
48327 LDKRetry* o_conv = (LDKRetry*)o;
48328 int64_t ret_conv = Retry_hash(o_conv);
48332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48333 if ((this_ptr & 1) != 0) return;
48334 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48335 CHECK_ACCESS(this_ptr_ptr);
48336 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
48337 FREE((void*)this_ptr);
48338 PaymentError_free(this_ptr_conv);
48341 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
48342 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48343 *ret_copy = PaymentError_clone(arg);
48344 int64_t ret_ref = (uintptr_t)ret_copy;
48347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48348 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
48349 int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
48353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48354 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
48355 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48356 *ret_copy = PaymentError_clone(orig_conv);
48357 int64_t ret_ref = (uintptr_t)ret_copy;
48361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
48362 LDKStr a_conv = java_to_owned_str(env, a);
48363 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48364 *ret_copy = PaymentError_invoice(a_conv);
48365 int64_t ret_ref = (uintptr_t)ret_copy;
48369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
48370 LDKLightningError a_conv;
48371 a_conv.inner = (void*)(a & (~1));
48372 a_conv.is_owned = (a & 1) || (a == 0);
48373 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48374 a_conv = LightningError_clone(&a_conv);
48375 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48376 *ret_copy = PaymentError_routing(a_conv);
48377 int64_t ret_ref = (uintptr_t)ret_copy;
48381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
48382 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
48383 CHECK_ACCESS(a_ptr);
48384 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
48385 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
48386 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48387 *ret_copy = PaymentError_sending(a_conv);
48388 int64_t ret_ref = (uintptr_t)ret_copy;
48392 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) {
48393 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
48394 CHECK_ACCESS(payer_ptr);
48395 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
48396 if (payer_conv.free == LDKPayer_JCalls_free) {
48397 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48398 LDKPayer_JCalls_cloned(&payer_conv);
48400 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
48401 CHECK_ACCESS(router_ptr);
48402 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
48403 if (router_conv.free == LDKRouter_JCalls_free) {
48404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48405 LDKRouter_JCalls_cloned(&router_conv);
48407 LDKMultiThreadedLockableScore scorer_conv;
48408 scorer_conv.inner = (void*)(scorer & (~1));
48409 scorer_conv.is_owned = false;
48410 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
48411 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
48412 CHECK_ACCESS(logger_ptr);
48413 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48414 if (logger_conv.free == LDKLogger_JCalls_free) {
48415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48416 LDKLogger_JCalls_cloned(&logger_conv);
48418 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
48419 CHECK_ACCESS(event_handler_ptr);
48420 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
48421 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
48422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48423 LDKEventHandler_JCalls_cloned(&event_handler_conv);
48425 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
48426 CHECK_ACCESS(retry_ptr);
48427 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
48428 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
48429 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
48430 int64_t ret_ref = 0;
48431 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48432 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48434 ret_ref = (uintptr_t)ret_var.inner;
48435 if (ret_var.is_owned) {
48441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
48442 LDKInvoicePayer this_arg_conv;
48443 this_arg_conv.inner = (void*)(this_arg & (~1));
48444 this_arg_conv.is_owned = false;
48445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48446 LDKInvoice invoice_conv;
48447 invoice_conv.inner = (void*)(invoice & (~1));
48448 invoice_conv.is_owned = false;
48449 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48450 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48451 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
48452 return (int64_t)ret_conv;
48455 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) {
48456 LDKInvoicePayer this_arg_conv;
48457 this_arg_conv.inner = (void*)(this_arg & (~1));
48458 this_arg_conv.is_owned = false;
48459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48460 LDKInvoice invoice_conv;
48461 invoice_conv.inner = (void*)(invoice & (~1));
48462 invoice_conv.is_owned = false;
48463 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48464 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48465 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
48466 return (int64_t)ret_conv;
48469 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) {
48470 LDKInvoicePayer this_arg_conv;
48471 this_arg_conv.inner = (void*)(this_arg & (~1));
48472 this_arg_conv.is_owned = false;
48473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48474 LDKPublicKey pubkey_ref;
48475 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
48476 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
48477 LDKThirtyTwoBytes payment_preimage_ref;
48478 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48479 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48480 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48481 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
48482 return (int64_t)ret_conv;
48485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
48486 LDKInvoicePayer this_arg_conv;
48487 this_arg_conv.inner = (void*)(this_arg & (~1));
48488 this_arg_conv.is_owned = false;
48489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48490 unsigned char payment_hash_arr[32];
48491 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48492 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48493 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
48494 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
48497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48498 LDKInvoicePayer this_arg_conv;
48499 this_arg_conv.inner = (void*)(this_arg & (~1));
48500 this_arg_conv.is_owned = false;
48501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48502 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
48503 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
48504 return (int64_t)ret_ret;
48507 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) {
48508 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48509 CHECK_ACCESS(amt_msat_ptr);
48510 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48511 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48512 LDKThirtyTwoBytes payment_hash_ref;
48513 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48514 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48515 LDKStr description_conv = java_to_owned_str(env, description);
48516 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
48517 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
48518 if (phantom_route_hints_constr.datalen > 0)
48519 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
48521 phantom_route_hints_constr.data = NULL;
48522 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
48523 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
48524 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
48525 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
48526 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
48527 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
48528 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
48529 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
48530 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
48532 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
48533 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48534 CHECK_ACCESS(keys_manager_ptr);
48535 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48536 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48537 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48538 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48540 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48541 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48542 *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);
48543 return (int64_t)ret_conv;
48546 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) {
48547 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48548 CHECK_ACCESS(amt_msat_ptr);
48549 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48550 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48551 LDKThirtyTwoBytes payment_hash_ref;
48552 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48553 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48554 LDKSha256 description_hash_conv;
48555 description_hash_conv.inner = (void*)(description_hash & (~1));
48556 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
48557 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48558 description_hash_conv = Sha256_clone(&description_hash_conv);
48559 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
48560 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
48561 if (phantom_route_hints_constr.datalen > 0)
48562 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
48564 phantom_route_hints_constr.data = NULL;
48565 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
48566 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
48567 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
48568 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
48569 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
48570 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
48571 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
48572 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
48573 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
48575 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
48576 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48577 CHECK_ACCESS(keys_manager_ptr);
48578 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48579 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48580 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48581 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48583 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48584 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48585 *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);
48586 return (int64_t)ret_conv;
48589 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) {
48590 LDKChannelManager channelmanager_conv;
48591 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48592 channelmanager_conv.is_owned = false;
48593 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48594 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48595 CHECK_ACCESS(keys_manager_ptr);
48596 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48597 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48598 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48599 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48601 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48602 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48603 CHECK_ACCESS(amt_msat_ptr);
48604 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48605 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48606 LDKStr description_conv = java_to_owned_str(env, description);
48607 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48608 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
48609 return (int64_t)ret_conv;
48612 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) {
48613 LDKChannelManager channelmanager_conv;
48614 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48615 channelmanager_conv.is_owned = false;
48616 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48617 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48618 CHECK_ACCESS(keys_manager_ptr);
48619 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48620 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48621 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48622 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48624 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48625 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48626 CHECK_ACCESS(amt_msat_ptr);
48627 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48628 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48629 LDKSha256 description_hash_conv;
48630 description_hash_conv.inner = (void*)(description_hash & (~1));
48631 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
48632 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48633 description_hash_conv = Sha256_clone(&description_hash_conv);
48634 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48635 *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);
48636 return (int64_t)ret_conv;
48639 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) {
48640 LDKChannelManager channelmanager_conv;
48641 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48642 channelmanager_conv.is_owned = false;
48643 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48644 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48645 CHECK_ACCESS(keys_manager_ptr);
48646 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48647 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48648 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48649 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48651 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48652 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48653 CHECK_ACCESS(amt_msat_ptr);
48654 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48655 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48656 LDKSha256 description_hash_conv;
48657 description_hash_conv.inner = (void*)(description_hash & (~1));
48658 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
48659 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48660 description_hash_conv = Sha256_clone(&description_hash_conv);
48661 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48662 *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);
48663 return (int64_t)ret_conv;
48666 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) {
48667 LDKChannelManager channelmanager_conv;
48668 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48669 channelmanager_conv.is_owned = false;
48670 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48671 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48672 CHECK_ACCESS(keys_manager_ptr);
48673 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48674 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48675 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48676 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48678 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48679 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48680 CHECK_ACCESS(amt_msat_ptr);
48681 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48682 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48683 LDKStr description_conv = java_to_owned_str(env, description);
48684 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48685 *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);
48686 return (int64_t)ret_conv;
48689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48690 LDKDefaultRouter this_obj_conv;
48691 this_obj_conv.inner = (void*)(this_obj & (~1));
48692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48694 DefaultRouter_free(this_obj_conv);
48697 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) {
48698 LDKNetworkGraph network_graph_conv;
48699 network_graph_conv.inner = (void*)(network_graph & (~1));
48700 network_graph_conv.is_owned = false;
48701 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48702 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
48703 CHECK_ACCESS(logger_ptr);
48704 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48705 if (logger_conv.free == LDKLogger_JCalls_free) {
48706 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48707 LDKLogger_JCalls_cloned(&logger_conv);
48709 LDKThirtyTwoBytes random_seed_bytes_ref;
48710 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
48711 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
48712 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
48713 int64_t ret_ref = 0;
48714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48717 ret_ref = (uintptr_t)ret_var.inner;
48718 if (ret_var.is_owned) {
48724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
48725 LDKDefaultRouter this_arg_conv;
48726 this_arg_conv.inner = (void*)(this_arg & (~1));
48727 this_arg_conv.is_owned = false;
48728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48729 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
48730 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
48731 return (int64_t)ret_ret;
48734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
48735 LDKChannelManager this_arg_conv;
48736 this_arg_conv.inner = (void*)(this_arg & (~1));
48737 this_arg_conv.is_owned = false;
48738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48739 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48740 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48741 return (int64_t)ret_ret;
48744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48745 LDKStr s_conv = java_to_owned_str(env, s);
48746 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48747 *ret_conv = SiPrefix_from_str(s_conv);
48748 return (int64_t)ret_conv;
48751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48752 LDKStr s_conv = java_to_owned_str(env, s);
48753 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48754 *ret_conv = Invoice_from_str(s_conv);
48755 return (int64_t)ret_conv;
48758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48759 LDKStr s_conv = java_to_owned_str(env, s);
48760 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48761 *ret_conv = SignedRawInvoice_from_str(s_conv);
48762 return (int64_t)ret_conv;
48765 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48766 LDKParseError* o_conv = (LDKParseError*)o;
48767 LDKStr ret_str = ParseError_to_str(o_conv);
48768 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48773 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48774 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
48775 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48776 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48781 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48783 o_conv.inner = (void*)(o & (~1));
48784 o_conv.is_owned = false;
48785 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48786 LDKStr ret_str = Invoice_to_str(&o_conv);
48787 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48792 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48793 LDKSignedRawInvoice o_conv;
48794 o_conv.inner = (void*)(o & (~1));
48795 o_conv.is_owned = false;
48796 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48797 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48798 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48803 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48804 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
48805 LDKStr ret_str = Currency_to_str(o_conv);
48806 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48811 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48812 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
48813 LDKStr ret_str = SiPrefix_to_str(o_conv);
48814 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48820 LDKRapidGossipSync this_obj_conv;
48821 this_obj_conv.inner = (void*)(this_obj & (~1));
48822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48824 RapidGossipSync_free(this_obj_conv);
48827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
48828 LDKNetworkGraph network_graph_conv;
48829 network_graph_conv.inner = (void*)(network_graph & (~1));
48830 network_graph_conv.is_owned = false;
48831 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48832 LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
48833 int64_t ret_ref = 0;
48834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48837 ret_ref = (uintptr_t)ret_var.inner;
48838 if (ret_var.is_owned) {
48844 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) {
48845 LDKRapidGossipSync this_arg_conv;
48846 this_arg_conv.inner = (void*)(this_arg & (~1));
48847 this_arg_conv.is_owned = false;
48848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48849 LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
48850 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48851 *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
48852 return (int64_t)ret_conv;
48855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
48856 LDKRapidGossipSync this_arg_conv;
48857 this_arg_conv.inner = (void*)(this_arg & (~1));
48858 this_arg_conv.is_owned = false;
48859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48860 jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
48864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48865 if ((this_ptr & 1) != 0) return;
48866 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48867 CHECK_ACCESS(this_ptr_ptr);
48868 LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
48869 FREE((void*)this_ptr);
48870 GraphSyncError_free(this_ptr_conv);
48873 static inline uintptr_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
48874 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48875 *ret_copy = GraphSyncError_clone(arg);
48876 int64_t ret_ref = (uintptr_t)ret_copy;
48879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48880 LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)arg;
48881 int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
48885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48886 LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)orig;
48887 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48888 *ret_copy = GraphSyncError_clone(orig_conv);
48889 int64_t ret_ref = (uintptr_t)ret_copy;
48893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
48894 LDKDecodeError a_conv;
48895 a_conv.inner = (void*)(a & (~1));
48896 a_conv.is_owned = (a & 1) || (a == 0);
48897 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48898 a_conv = DecodeError_clone(&a_conv);
48899 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48900 *ret_copy = GraphSyncError_decode_error(a_conv);
48901 int64_t ret_ref = (uintptr_t)ret_copy;
48905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
48906 LDKLightningError a_conv;
48907 a_conv.inner = (void*)(a & (~1));
48908 a_conv.is_owned = (a & 1) || (a == 0);
48909 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48910 a_conv = LightningError_clone(&a_conv);
48911 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48912 *ret_copy = GraphSyncError_lightning_error(a_conv);
48913 int64_t ret_ref = (uintptr_t)ret_copy;
48917 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) {
48918 LDKRapidGossipSync 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 LDKu8slice update_data_ref;
48923 update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
48924 update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
48925 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48926 *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
48927 (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
48928 return (int64_t)ret_conv;