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 typedef struct LDKLogger_JCalls {
3305 atomic_size_t refcnt;
3310 static void LDKLogger_JCalls_free(void* this_arg) {
3311 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3312 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3315 if (get_jenv_res == JNI_EDETACHED) {
3316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3318 DO_ASSERT(get_jenv_res == JNI_OK);
3320 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3321 if (get_jenv_res == JNI_EDETACHED) {
3322 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3327 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3328 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3330 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3331 if (get_jenv_res == JNI_EDETACHED) {
3332 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3334 DO_ASSERT(get_jenv_res == JNI_OK);
3336 LDKRecord record_var = *record;
3337 int64_t record_ref = 0;
3338 record_var = Record_clone(&record_var);
3339 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3340 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3341 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3342 record_ref = (uintptr_t)record_var.inner;
3343 if (record_var.is_owned) {
3346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3348 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3349 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3350 (*env)->ExceptionDescribe(env);
3351 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3353 if (get_jenv_res == JNI_EDETACHED) {
3354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3357 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3358 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3359 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3361 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3362 jclass c = (*env)->GetObjectClass(env, o);
3364 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3365 atomic_init(&calls->refcnt, 1);
3366 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3367 calls->o = (*env)->NewWeakGlobalRef(env, o);
3368 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3369 CHECK(calls->log_meth != NULL);
3372 .this_arg = (void*) calls,
3373 .log = log_LDKLogger_jcall,
3374 .free = LDKLogger_JCalls_free,
3378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3379 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3380 *res_ptr = LDKLogger_init(env, clz, o);
3381 return (uint64_t)res_ptr;
3383 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3384 CHECK(owner->result_ok);
3385 return &*owner->contents.result;
3387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3388 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3389 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3390 int64_t ret_ref = 0;
3391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3394 ret_ref = (uintptr_t)ret_var.inner & ~1;
3398 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3399 CHECK(!owner->result_ok);
3400 return DecodeError_clone(&*owner->contents.err);
3402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3403 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3404 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3405 int64_t ret_ref = 0;
3406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3409 ret_ref = (uintptr_t)ret_var.inner;
3410 if (ret_var.is_owned) {
3416 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3417 CHECK(owner->result_ok);
3418 return InitFeatures_clone(&*owner->contents.result);
3420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3421 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3422 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3423 int64_t ret_ref = 0;
3424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3427 ret_ref = (uintptr_t)ret_var.inner;
3428 if (ret_var.is_owned) {
3434 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3435 CHECK(!owner->result_ok);
3436 return DecodeError_clone(&*owner->contents.err);
3438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3439 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3440 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3441 int64_t ret_ref = 0;
3442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3445 ret_ref = (uintptr_t)ret_var.inner;
3446 if (ret_var.is_owned) {
3452 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3453 CHECK(owner->result_ok);
3454 return ChannelFeatures_clone(&*owner->contents.result);
3456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3457 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3458 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3459 int64_t ret_ref = 0;
3460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3463 ret_ref = (uintptr_t)ret_var.inner;
3464 if (ret_var.is_owned) {
3470 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3471 CHECK(!owner->result_ok);
3472 return DecodeError_clone(&*owner->contents.err);
3474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3475 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3476 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3477 int64_t ret_ref = 0;
3478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3481 ret_ref = (uintptr_t)ret_var.inner;
3482 if (ret_var.is_owned) {
3488 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3489 CHECK(owner->result_ok);
3490 return NodeFeatures_clone(&*owner->contents.result);
3492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3493 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3494 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3495 int64_t ret_ref = 0;
3496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3499 ret_ref = (uintptr_t)ret_var.inner;
3500 if (ret_var.is_owned) {
3506 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3507 CHECK(!owner->result_ok);
3508 return DecodeError_clone(&*owner->contents.err);
3510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3511 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3512 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3513 int64_t ret_ref = 0;
3514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3517 ret_ref = (uintptr_t)ret_var.inner;
3518 if (ret_var.is_owned) {
3524 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3525 CHECK(owner->result_ok);
3526 return InvoiceFeatures_clone(&*owner->contents.result);
3528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3529 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3530 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3531 int64_t ret_ref = 0;
3532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3535 ret_ref = (uintptr_t)ret_var.inner;
3536 if (ret_var.is_owned) {
3542 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3543 CHECK(!owner->result_ok);
3544 return DecodeError_clone(&*owner->contents.err);
3546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3547 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3548 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3549 int64_t ret_ref = 0;
3550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3553 ret_ref = (uintptr_t)ret_var.inner;
3554 if (ret_var.is_owned) {
3560 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3561 CHECK(owner->result_ok);
3562 return ChannelTypeFeatures_clone(&*owner->contents.result);
3564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3565 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3566 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3567 int64_t ret_ref = 0;
3568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3571 ret_ref = (uintptr_t)ret_var.inner;
3572 if (ret_var.is_owned) {
3578 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3579 CHECK(!owner->result_ok);
3580 return DecodeError_clone(&*owner->contents.err);
3582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3583 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3584 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3585 int64_t ret_ref = 0;
3586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3589 ret_ref = (uintptr_t)ret_var.inner;
3590 if (ret_var.is_owned) {
3596 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3597 CHECK(owner->result_ok);
3598 return NodeId_clone(&*owner->contents.result);
3600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3601 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3602 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3603 int64_t ret_ref = 0;
3604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3607 ret_ref = (uintptr_t)ret_var.inner;
3608 if (ret_var.is_owned) {
3614 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3615 CHECK(!owner->result_ok);
3616 return DecodeError_clone(&*owner->contents.err);
3618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3619 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3620 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3621 int64_t ret_ref = 0;
3622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3625 ret_ref = (uintptr_t)ret_var.inner;
3626 if (ret_var.is_owned) {
3632 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3633 CHECK(owner->result_ok);
3634 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3637 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3638 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3639 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3640 int64_t ret_ref = (uintptr_t)ret_copy;
3644 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3645 CHECK(!owner->result_ok);
3646 return DecodeError_clone(&*owner->contents.err);
3648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3649 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3650 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3651 int64_t ret_ref = 0;
3652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3655 ret_ref = (uintptr_t)ret_var.inner;
3656 if (ret_var.is_owned) {
3662 typedef struct LDKAccess_JCalls {
3663 atomic_size_t refcnt;
3666 jmethodID get_utxo_meth;
3668 static void LDKAccess_JCalls_free(void* this_arg) {
3669 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3670 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3672 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3673 if (get_jenv_res == JNI_EDETACHED) {
3674 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3676 DO_ASSERT(get_jenv_res == JNI_OK);
3678 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3679 if (get_jenv_res == JNI_EDETACHED) {
3680 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3685 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3686 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3688 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3689 if (get_jenv_res == JNI_EDETACHED) {
3690 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3692 DO_ASSERT(get_jenv_res == JNI_OK);
3694 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3695 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3696 int64_t short_channel_id_conv = short_channel_id;
3697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3699 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3700 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3701 (*env)->ExceptionDescribe(env);
3702 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3704 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3705 CHECK_ACCESS(ret_ptr);
3706 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3708 if (get_jenv_res == JNI_EDETACHED) {
3709 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3713 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3714 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3715 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3717 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3718 jclass c = (*env)->GetObjectClass(env, o);
3720 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3721 atomic_init(&calls->refcnt, 1);
3722 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3723 calls->o = (*env)->NewWeakGlobalRef(env, o);
3724 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3725 CHECK(calls->get_utxo_meth != NULL);
3728 .this_arg = (void*) calls,
3729 .get_utxo = get_utxo_LDKAccess_jcall,
3730 .free = LDKAccess_JCalls_free,
3734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3735 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3736 *res_ptr = LDKAccess_init(env, clz, o);
3737 return (uint64_t)res_ptr;
3739 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) {
3740 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3741 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3742 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3743 unsigned char genesis_hash_arr[32];
3744 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3745 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3746 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3747 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3748 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3749 return (int64_t)ret_conv;
3752 static jclass LDKCOption_AccessZ_Some_class = NULL;
3753 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3754 static jclass LDKCOption_AccessZ_None_class = NULL;
3755 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
3757 LDKCOption_AccessZ_Some_class =
3758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
3759 CHECK(LDKCOption_AccessZ_Some_class != NULL);
3760 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
3761 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
3762 LDKCOption_AccessZ_None_class =
3763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
3764 CHECK(LDKCOption_AccessZ_None_class != NULL);
3765 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
3766 CHECK(LDKCOption_AccessZ_None_meth != NULL);
3768 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3769 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3771 case LDKCOption_AccessZ_Some: {
3772 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3773 *some_ret = obj->some;
3774 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3775 if ((*some_ret).free == LDKAccess_JCalls_free) {
3776 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3777 LDKAccess_JCalls_cloned(&(*some_ret));
3779 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
3781 case LDKCOption_AccessZ_None: {
3782 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
3787 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3788 CHECK(owner->result_ok);
3789 return *owner->contents.result;
3791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3792 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3793 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3797 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3798 CHECK(!owner->result_ok);
3799 return LightningError_clone(&*owner->contents.err);
3801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3802 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3803 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3804 int64_t ret_ref = 0;
3805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3808 ret_ref = (uintptr_t)ret_var.inner;
3809 if (ret_var.is_owned) {
3815 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3816 return ChannelAnnouncement_clone(&owner->a);
3818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3819 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3820 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3821 int64_t ret_ref = 0;
3822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3825 ret_ref = (uintptr_t)ret_var.inner;
3826 if (ret_var.is_owned) {
3832 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3833 return ChannelUpdate_clone(&owner->b);
3835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3836 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3837 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3838 int64_t ret_ref = 0;
3839 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3840 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3842 ret_ref = (uintptr_t)ret_var.inner;
3843 if (ret_var.is_owned) {
3849 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3850 return ChannelUpdate_clone(&owner->c);
3852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3853 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3854 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3855 int64_t ret_ref = 0;
3856 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3857 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3859 ret_ref = (uintptr_t)ret_var.inner;
3860 if (ret_var.is_owned) {
3866 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3867 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3868 for (size_t i = 0; i < ret.datalen; i++) {
3869 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3873 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3874 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3875 for (size_t i = 0; i < ret.datalen; i++) {
3876 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3880 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3881 CHECK(owner->result_ok);
3882 return *owner->contents.result;
3884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3885 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3886 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3889 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3890 CHECK(!owner->result_ok);
3891 return LightningError_clone(&*owner->contents.err);
3893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3894 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3895 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3896 int64_t ret_ref = 0;
3897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3900 ret_ref = (uintptr_t)ret_var.inner;
3901 if (ret_var.is_owned) {
3907 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3908 CHECK(owner->result_ok);
3909 return ChannelUpdateInfo_clone(&*owner->contents.result);
3911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3912 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3913 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3914 int64_t ret_ref = 0;
3915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3918 ret_ref = (uintptr_t)ret_var.inner;
3919 if (ret_var.is_owned) {
3925 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3926 CHECK(!owner->result_ok);
3927 return DecodeError_clone(&*owner->contents.err);
3929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3930 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3931 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3932 int64_t ret_ref = 0;
3933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3936 ret_ref = (uintptr_t)ret_var.inner;
3937 if (ret_var.is_owned) {
3943 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3944 CHECK(owner->result_ok);
3945 return ChannelInfo_clone(&*owner->contents.result);
3947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3948 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3949 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3950 int64_t ret_ref = 0;
3951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3954 ret_ref = (uintptr_t)ret_var.inner;
3955 if (ret_var.is_owned) {
3961 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3962 CHECK(!owner->result_ok);
3963 return DecodeError_clone(&*owner->contents.err);
3965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3966 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3967 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3968 int64_t ret_ref = 0;
3969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3972 ret_ref = (uintptr_t)ret_var.inner;
3973 if (ret_var.is_owned) {
3979 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3980 CHECK(owner->result_ok);
3981 return RoutingFees_clone(&*owner->contents.result);
3983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3984 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3985 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3986 int64_t ret_ref = 0;
3987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3990 ret_ref = (uintptr_t)ret_var.inner;
3991 if (ret_var.is_owned) {
3997 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3998 CHECK(!owner->result_ok);
3999 return DecodeError_clone(&*owner->contents.err);
4001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4002 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4003 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4004 int64_t ret_ref = 0;
4005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4008 ret_ref = (uintptr_t)ret_var.inner;
4009 if (ret_var.is_owned) {
4015 static jclass LDKNetAddress_IPv4_class = NULL;
4016 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4017 static jclass LDKNetAddress_IPv6_class = NULL;
4018 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4019 static jclass LDKNetAddress_OnionV2_class = NULL;
4020 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4021 static jclass LDKNetAddress_OnionV3_class = NULL;
4022 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4024 LDKNetAddress_IPv4_class =
4025 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4026 CHECK(LDKNetAddress_IPv4_class != NULL);
4027 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4028 CHECK(LDKNetAddress_IPv4_meth != NULL);
4029 LDKNetAddress_IPv6_class =
4030 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4031 CHECK(LDKNetAddress_IPv6_class != NULL);
4032 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4033 CHECK(LDKNetAddress_IPv6_meth != NULL);
4034 LDKNetAddress_OnionV2_class =
4035 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4036 CHECK(LDKNetAddress_OnionV2_class != NULL);
4037 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4038 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4039 LDKNetAddress_OnionV3_class =
4040 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4041 CHECK(LDKNetAddress_OnionV3_class != NULL);
4042 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4043 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4045 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4046 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4048 case LDKNetAddress_IPv4: {
4049 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4050 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4051 int16_t port_conv = obj->i_pv4.port;
4052 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4054 case LDKNetAddress_IPv6: {
4055 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4056 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4057 int16_t port_conv = obj->i_pv6.port;
4058 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4060 case LDKNetAddress_OnionV2: {
4061 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4062 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4063 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4065 case LDKNetAddress_OnionV3: {
4066 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4067 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4068 int16_t checksum_conv = obj->onion_v3.checksum;
4069 int8_t version_conv = obj->onion_v3.version;
4070 int16_t port_conv = obj->onion_v3.port;
4071 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4076 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4077 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4078 for (size_t i = 0; i < ret.datalen; i++) {
4079 ret.data[i] = NetAddress_clone(&orig->data[i]);
4083 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4084 CHECK(owner->result_ok);
4085 return NodeAnnouncementInfo_clone(&*owner->contents.result);
4087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4088 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4089 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4090 int64_t ret_ref = 0;
4091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4094 ret_ref = (uintptr_t)ret_var.inner;
4095 if (ret_var.is_owned) {
4101 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4102 CHECK(!owner->result_ok);
4103 return DecodeError_clone(&*owner->contents.err);
4105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4106 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4107 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4108 int64_t ret_ref = 0;
4109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4112 ret_ref = (uintptr_t)ret_var.inner;
4113 if (ret_var.is_owned) {
4119 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4120 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4121 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4124 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4125 CHECK(owner->result_ok);
4126 return NodeInfo_clone(&*owner->contents.result);
4128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4129 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4130 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4131 int64_t ret_ref = 0;
4132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4135 ret_ref = (uintptr_t)ret_var.inner;
4136 if (ret_var.is_owned) {
4142 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4143 CHECK(!owner->result_ok);
4144 return DecodeError_clone(&*owner->contents.err);
4146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4147 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4148 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4149 int64_t ret_ref = 0;
4150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4153 ret_ref = (uintptr_t)ret_var.inner;
4154 if (ret_var.is_owned) {
4160 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4161 CHECK(owner->result_ok);
4162 return &*owner->contents.result;
4164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4165 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4166 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4167 int64_t ret_ref = 0;
4168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4171 ret_ref = (uintptr_t)ret_var.inner & ~1;
4175 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4176 CHECK(!owner->result_ok);
4177 return DecodeError_clone(&*owner->contents.err);
4179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4180 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4181 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(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 jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4194 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4195 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4196 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4198 LDKCOption_CVec_NetAddressZZ_Some_class =
4199 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4200 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4201 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4202 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4203 LDKCOption_CVec_NetAddressZZ_None_class =
4204 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4205 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4206 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4207 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4209 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4210 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4212 case LDKCOption_CVec_NetAddressZZ_Some: {
4213 LDKCVec_NetAddressZ some_var = obj->some;
4214 int64_tArray some_arr = NULL;
4215 some_arr = (*env)->NewLongArray(env, some_var.datalen);
4216 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4217 for (size_t m = 0; m < some_var.datalen; m++) {
4218 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
4219 some_arr_ptr[m] = some_conv_12_ref;
4221 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4222 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4224 case LDKCOption_CVec_NetAddressZZ_None: {
4225 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4230 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4231 CHECK(owner->result_ok);
4232 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
4234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4235 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4236 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4237 int64_t ret_ref = 0;
4238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4241 ret_ref = (uintptr_t)ret_var.inner;
4242 if (ret_var.is_owned) {
4248 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4249 CHECK(!owner->result_ok);
4250 return DecodeError_clone(&*owner->contents.err);
4252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4253 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4254 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4255 int64_t ret_ref = 0;
4256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4259 ret_ref = (uintptr_t)ret_var.inner;
4260 if (ret_var.is_owned) {
4266 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4267 CHECK(owner->result_ok);
4268 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
4270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4271 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4272 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4273 int64_t ret_ref = 0;
4274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4277 ret_ref = (uintptr_t)ret_var.inner;
4278 if (ret_var.is_owned) {
4284 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4285 CHECK(!owner->result_ok);
4286 return DecodeError_clone(&*owner->contents.err);
4288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4289 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4290 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4291 int64_t ret_ref = 0;
4292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4295 ret_ref = (uintptr_t)ret_var.inner;
4296 if (ret_var.is_owned) {
4302 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4303 CHECK(owner->result_ok);
4304 return SpendableOutputDescriptor_clone(&*owner->contents.result);
4306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4307 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4308 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4309 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4310 int64_t ret_ref = (uintptr_t)ret_copy;
4314 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4315 CHECK(!owner->result_ok);
4316 return DecodeError_clone(&*owner->contents.err);
4318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4319 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4320 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4321 int64_t ret_ref = 0;
4322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4325 ret_ref = (uintptr_t)ret_var.inner;
4326 if (ret_var.is_owned) {
4332 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4333 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4334 for (size_t i = 0; i < ret.datalen; i++) {
4335 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4339 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4343 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4344 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4349 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4352 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4353 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4354 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4355 jobjectArray ret_arr = NULL;
4356 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4358 for (size_t i = 0; i < ret_var.datalen; i++) {
4359 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4360 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4361 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4367 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4368 CHECK(owner->result_ok);
4369 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4372 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4373 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4374 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4375 return ((int64_t)ret_conv);
4378 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4379 CHECK(!owner->result_ok);
4380 return *owner->contents.err;
4382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4383 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4384 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4387 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4388 CHECK(owner->result_ok);
4389 return *owner->contents.result;
4391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4392 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4393 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4394 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4398 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4399 CHECK(!owner->result_ok);
4400 return *owner->contents.err;
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4403 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4404 CResult_SignatureNoneZ_get_err(owner_conv);
4407 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4411 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4412 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4413 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4417 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4421 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4422 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4423 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4427 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4428 CHECK(owner->result_ok);
4429 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4432 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4433 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4434 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4435 return ((int64_t)ret_conv);
4438 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4439 CHECK(!owner->result_ok);
4440 return *owner->contents.err;
4442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4443 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4444 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4447 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4448 CHECK(owner->result_ok);
4449 return *owner->contents.result;
4451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4452 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4453 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4458 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4459 CHECK(!owner->result_ok);
4460 return *owner->contents.err;
4462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4463 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4464 CResult_SecretKeyNoneZ_get_err(owner_conv);
4467 typedef struct LDKBaseSign_JCalls {
4468 atomic_size_t refcnt;
4471 jmethodID get_per_commitment_point_meth;
4472 jmethodID release_commitment_secret_meth;
4473 jmethodID validate_holder_commitment_meth;
4474 jmethodID channel_keys_id_meth;
4475 jmethodID sign_counterparty_commitment_meth;
4476 jmethodID validate_counterparty_revocation_meth;
4477 jmethodID sign_holder_commitment_and_htlcs_meth;
4478 jmethodID sign_justice_revoked_output_meth;
4479 jmethodID sign_justice_revoked_htlc_meth;
4480 jmethodID sign_counterparty_htlc_transaction_meth;
4481 jmethodID sign_closing_transaction_meth;
4482 jmethodID sign_channel_announcement_meth;
4483 jmethodID ready_channel_meth;
4484 } LDKBaseSign_JCalls;
4485 static void LDKBaseSign_JCalls_free(void* this_arg) {
4486 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4487 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4489 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4490 if (get_jenv_res == JNI_EDETACHED) {
4491 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4493 DO_ASSERT(get_jenv_res == JNI_OK);
4495 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4496 if (get_jenv_res == JNI_EDETACHED) {
4497 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4502 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4503 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4505 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4506 if (get_jenv_res == JNI_EDETACHED) {
4507 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4509 DO_ASSERT(get_jenv_res == JNI_OK);
4511 int64_t idx_conv = idx;
4512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4514 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4515 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4516 (*env)->ExceptionDescribe(env);
4517 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4519 LDKPublicKey ret_ref;
4520 CHECK((*env)->GetArrayLength(env, ret) == 33);
4521 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4522 if (get_jenv_res == JNI_EDETACHED) {
4523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4527 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4528 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4530 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4531 if (get_jenv_res == JNI_EDETACHED) {
4532 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4534 DO_ASSERT(get_jenv_res == JNI_OK);
4536 int64_t idx_conv = idx;
4537 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4539 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4540 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4541 (*env)->ExceptionDescribe(env);
4542 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4544 LDKThirtyTwoBytes ret_ref;
4545 CHECK((*env)->GetArrayLength(env, ret) == 32);
4546 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4547 if (get_jenv_res == JNI_EDETACHED) {
4548 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4552 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4553 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4555 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4556 if (get_jenv_res == JNI_EDETACHED) {
4557 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4559 DO_ASSERT(get_jenv_res == JNI_OK);
4561 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4562 int64_t holder_tx_ref = 0;
4563 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4564 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4565 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4566 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4567 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
4568 if (holder_tx_var.is_owned) {
4571 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4572 jobjectArray preimages_arr = NULL;
4573 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4575 for (size_t i = 0; i < preimages_var.datalen; i++) {
4576 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4577 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4578 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4581 FREE(preimages_var.data);
4582 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4584 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4585 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4586 (*env)->ExceptionDescribe(env);
4587 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4589 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4590 CHECK_ACCESS(ret_ptr);
4591 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4593 if (get_jenv_res == JNI_EDETACHED) {
4594 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4598 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4599 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4601 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4602 if (get_jenv_res == JNI_EDETACHED) {
4603 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4605 DO_ASSERT(get_jenv_res == JNI_OK);
4607 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4609 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4610 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4611 (*env)->ExceptionDescribe(env);
4612 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4614 LDKThirtyTwoBytes ret_ref;
4615 CHECK((*env)->GetArrayLength(env, ret) == 32);
4616 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4617 if (get_jenv_res == JNI_EDETACHED) {
4618 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4622 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4623 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4625 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4626 if (get_jenv_res == JNI_EDETACHED) {
4627 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4629 DO_ASSERT(get_jenv_res == JNI_OK);
4631 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4632 int64_t commitment_tx_ref = 0;
4633 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4634 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4635 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4636 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4637 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4638 if (commitment_tx_var.is_owned) {
4639 commitment_tx_ref |= 1;
4641 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4642 jobjectArray preimages_arr = NULL;
4643 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4645 for (size_t i = 0; i < preimages_var.datalen; i++) {
4646 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4647 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4648 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4651 FREE(preimages_var.data);
4652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4654 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4655 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4656 (*env)->ExceptionDescribe(env);
4657 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4659 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4660 CHECK_ACCESS(ret_ptr);
4661 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4663 if (get_jenv_res == JNI_EDETACHED) {
4664 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4668 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4669 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4671 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4672 if (get_jenv_res == JNI_EDETACHED) {
4673 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4675 DO_ASSERT(get_jenv_res == JNI_OK);
4677 int64_t idx_conv = idx;
4678 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4679 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4680 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4682 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4683 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4684 (*env)->ExceptionDescribe(env);
4685 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4687 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4688 CHECK_ACCESS(ret_ptr);
4689 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4691 if (get_jenv_res == JNI_EDETACHED) {
4692 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4696 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4697 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4699 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4700 if (get_jenv_res == JNI_EDETACHED) {
4701 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4703 DO_ASSERT(get_jenv_res == JNI_OK);
4705 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4706 int64_t commitment_tx_ref = 0;
4707 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4708 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4709 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4710 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4711 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4712 if (commitment_tx_var.is_owned) {
4713 commitment_tx_ref |= 1;
4715 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4717 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
4718 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4719 (*env)->ExceptionDescribe(env);
4720 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
4722 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4723 CHECK_ACCESS(ret_ptr);
4724 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4726 if (get_jenv_res == JNI_EDETACHED) {
4727 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4731 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]) {
4732 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4734 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4735 if (get_jenv_res == JNI_EDETACHED) {
4736 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4738 DO_ASSERT(get_jenv_res == JNI_OK);
4740 LDKTransaction justice_tx_var = justice_tx;
4741 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4742 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4743 Transaction_free(justice_tx_var);
4744 int64_t input_conv = input;
4745 int64_t amount_conv = amount;
4746 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4747 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4748 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4750 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);
4751 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4752 (*env)->ExceptionDescribe(env);
4753 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4755 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4756 CHECK_ACCESS(ret_ptr);
4757 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4759 if (get_jenv_res == JNI_EDETACHED) {
4760 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4764 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) {
4765 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4767 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4768 if (get_jenv_res == JNI_EDETACHED) {
4769 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4771 DO_ASSERT(get_jenv_res == JNI_OK);
4773 LDKTransaction justice_tx_var = justice_tx;
4774 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4775 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4776 Transaction_free(justice_tx_var);
4777 int64_t input_conv = input;
4778 int64_t amount_conv = amount;
4779 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4780 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4781 LDKHTLCOutputInCommitment htlc_var = *htlc;
4782 int64_t htlc_ref = 0;
4783 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4784 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4785 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4786 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4787 htlc_ref = (uintptr_t)htlc_var.inner;
4788 if (htlc_var.is_owned) {
4791 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4793 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);
4794 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4795 (*env)->ExceptionDescribe(env);
4796 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4798 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4799 CHECK_ACCESS(ret_ptr);
4800 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4802 if (get_jenv_res == JNI_EDETACHED) {
4803 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4807 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) {
4808 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4810 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4811 if (get_jenv_res == JNI_EDETACHED) {
4812 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4814 DO_ASSERT(get_jenv_res == JNI_OK);
4816 LDKTransaction htlc_tx_var = htlc_tx;
4817 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4818 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4819 Transaction_free(htlc_tx_var);
4820 int64_t input_conv = input;
4821 int64_t amount_conv = amount;
4822 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4823 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4824 LDKHTLCOutputInCommitment htlc_var = *htlc;
4825 int64_t htlc_ref = 0;
4826 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4827 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4828 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4829 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4830 htlc_ref = (uintptr_t)htlc_var.inner;
4831 if (htlc_var.is_owned) {
4834 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4836 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);
4837 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4838 (*env)->ExceptionDescribe(env);
4839 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4841 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4842 CHECK_ACCESS(ret_ptr);
4843 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4845 if (get_jenv_res == JNI_EDETACHED) {
4846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4850 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4851 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4854 if (get_jenv_res == JNI_EDETACHED) {
4855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4857 DO_ASSERT(get_jenv_res == JNI_OK);
4859 LDKClosingTransaction closing_tx_var = *closing_tx;
4860 int64_t closing_tx_ref = 0;
4861 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4862 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4863 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4864 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4865 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4866 if (closing_tx_var.is_owned) {
4867 closing_tx_ref |= 1;
4869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4871 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4872 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4873 (*env)->ExceptionDescribe(env);
4874 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4876 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4877 CHECK_ACCESS(ret_ptr);
4878 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4880 if (get_jenv_res == JNI_EDETACHED) {
4881 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4885 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4886 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4888 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4889 if (get_jenv_res == JNI_EDETACHED) {
4890 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4892 DO_ASSERT(get_jenv_res == JNI_OK);
4894 LDKUnsignedChannelAnnouncement msg_var = *msg;
4895 int64_t msg_ref = 0;
4896 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4897 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4898 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4899 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4900 msg_ref = (uintptr_t)msg_var.inner;
4901 if (msg_var.is_owned) {
4904 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4906 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4907 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4908 (*env)->ExceptionDescribe(env);
4909 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4911 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4912 CHECK_ACCESS(ret_ptr);
4913 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4915 if (get_jenv_res == JNI_EDETACHED) {
4916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4920 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4921 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4923 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4924 if (get_jenv_res == JNI_EDETACHED) {
4925 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4927 DO_ASSERT(get_jenv_res == JNI_OK);
4929 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4930 int64_t channel_parameters_ref = 0;
4931 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4932 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4933 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4934 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4935 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4936 if (channel_parameters_var.is_owned) {
4937 channel_parameters_ref |= 1;
4939 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4941 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4942 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4943 (*env)->ExceptionDescribe(env);
4944 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4946 if (get_jenv_res == JNI_EDETACHED) {
4947 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4950 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4951 jclass c = (*env)->GetObjectClass(env, o);
4953 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4954 atomic_init(&calls->refcnt, 1);
4955 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4956 calls->o = (*env)->NewWeakGlobalRef(env, o);
4957 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4958 CHECK(calls->get_per_commitment_point_meth != NULL);
4959 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4960 CHECK(calls->release_commitment_secret_meth != NULL);
4961 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4962 CHECK(calls->validate_holder_commitment_meth != NULL);
4963 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4964 CHECK(calls->channel_keys_id_meth != NULL);
4965 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4966 CHECK(calls->sign_counterparty_commitment_meth != NULL);
4967 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4968 CHECK(calls->validate_counterparty_revocation_meth != NULL);
4969 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4970 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4971 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4972 CHECK(calls->sign_justice_revoked_output_meth != NULL);
4973 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4974 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4975 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4976 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4977 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4978 CHECK(calls->sign_closing_transaction_meth != NULL);
4979 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4980 CHECK(calls->sign_channel_announcement_meth != NULL);
4981 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4982 CHECK(calls->ready_channel_meth != NULL);
4984 LDKChannelPublicKeys pubkeys_conv;
4985 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4986 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4987 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4990 .this_arg = (void*) calls,
4991 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4992 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4993 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4994 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4995 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4996 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4997 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4998 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4999 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
5000 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
5001 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
5002 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
5003 .ready_channel = ready_channel_LDKBaseSign_jcall,
5004 .free = LDKBaseSign_JCalls_free,
5005 .pubkeys = pubkeys_conv,
5006 .set_pubkeys = NULL,
5010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5011 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
5012 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
5013 return (uint64_t)res_ptr;
5015 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) {
5016 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5017 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5018 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5019 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5025 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5026 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5027 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5028 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5029 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5033 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) {
5034 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5035 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5036 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5037 LDKHolderCommitmentTransaction holder_tx_conv;
5038 holder_tx_conv.inner = (void*)(holder_tx & (~1));
5039 holder_tx_conv.is_owned = false;
5040 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5041 LDKCVec_PaymentPreimageZ preimages_constr;
5042 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5043 if (preimages_constr.datalen > 0)
5044 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5046 preimages_constr.data = NULL;
5047 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5048 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5049 LDKThirtyTwoBytes preimages_conv_8_ref;
5050 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5051 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5052 preimages_constr.data[i] = preimages_conv_8_ref;
5054 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5055 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5056 return (int64_t)ret_conv;
5059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5060 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5061 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5062 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5063 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5064 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5068 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) {
5069 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5071 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5072 LDKCommitmentTransaction commitment_tx_conv;
5073 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5074 commitment_tx_conv.is_owned = false;
5075 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5076 LDKCVec_PaymentPreimageZ preimages_constr;
5077 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5078 if (preimages_constr.datalen > 0)
5079 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5081 preimages_constr.data = NULL;
5082 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5083 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5084 LDKThirtyTwoBytes preimages_conv_8_ref;
5085 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5086 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5087 preimages_constr.data[i] = preimages_conv_8_ref;
5089 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5090 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
5091 return (int64_t)ret_conv;
5094 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) {
5095 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5096 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5097 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5098 unsigned char secret_arr[32];
5099 CHECK((*env)->GetArrayLength(env, secret) == 32);
5100 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5101 unsigned char (*secret_ref)[32] = &secret_arr;
5102 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5103 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5104 return (int64_t)ret_conv;
5107 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) {
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 LDKHolderCommitmentTransaction commitment_tx_conv;
5112 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5113 commitment_tx_conv.is_owned = false;
5114 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5115 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5116 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5117 return (int64_t)ret_conv;
5120 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) {
5121 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5122 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5123 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5124 LDKTransaction justice_tx_ref;
5125 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5126 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5127 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5128 justice_tx_ref.data_is_owned = true;
5129 unsigned char per_commitment_key_arr[32];
5130 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5131 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5132 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5133 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5134 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5135 return (int64_t)ret_conv;
5138 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) {
5139 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5140 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5141 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5142 LDKTransaction justice_tx_ref;
5143 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5144 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5145 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5146 justice_tx_ref.data_is_owned = true;
5147 unsigned char per_commitment_key_arr[32];
5148 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5149 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5150 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5151 LDKHTLCOutputInCommitment htlc_conv;
5152 htlc_conv.inner = (void*)(htlc & (~1));
5153 htlc_conv.is_owned = false;
5154 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5155 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5156 *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);
5157 return (int64_t)ret_conv;
5160 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) {
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 LDKTransaction htlc_tx_ref;
5165 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5166 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5167 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5168 htlc_tx_ref.data_is_owned = true;
5169 LDKPublicKey per_commitment_point_ref;
5170 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5171 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5172 LDKHTLCOutputInCommitment htlc_conv;
5173 htlc_conv.inner = (void*)(htlc & (~1));
5174 htlc_conv.is_owned = false;
5175 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5176 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5177 *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);
5178 return (int64_t)ret_conv;
5181 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) {
5182 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5183 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5184 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5185 LDKClosingTransaction closing_tx_conv;
5186 closing_tx_conv.inner = (void*)(closing_tx & (~1));
5187 closing_tx_conv.is_owned = false;
5188 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5189 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5190 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5191 return (int64_t)ret_conv;
5194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5195 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5196 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5197 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5198 LDKUnsignedChannelAnnouncement msg_conv;
5199 msg_conv.inner = (void*)(msg & (~1));
5200 msg_conv.is_owned = false;
5201 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5202 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5203 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5204 return (int64_t)ret_conv;
5207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5208 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5209 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5210 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5211 LDKChannelTransactionParameters channel_parameters_conv;
5212 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
5213 channel_parameters_conv.is_owned = false;
5214 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5215 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5218 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5219 if (this_arg->set_pubkeys != NULL)
5220 this_arg->set_pubkeys(this_arg);
5221 return this_arg->pubkeys;
5223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5224 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5225 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5226 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5227 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5228 int64_t ret_ref = 0;
5229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5232 ret_ref = (uintptr_t)ret_var.inner;
5233 if (ret_var.is_owned) {
5239 typedef struct LDKSign_JCalls {
5240 atomic_size_t refcnt;
5243 LDKBaseSign_JCalls* BaseSign;
5244 jmethodID write_meth;
5246 static void LDKSign_JCalls_free(void* this_arg) {
5247 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5248 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5250 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5251 if (get_jenv_res == JNI_EDETACHED) {
5252 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5254 DO_ASSERT(get_jenv_res == JNI_OK);
5256 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5257 if (get_jenv_res == JNI_EDETACHED) {
5258 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5263 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5264 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5266 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5267 if (get_jenv_res == JNI_EDETACHED) {
5268 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5270 DO_ASSERT(get_jenv_res == JNI_OK);
5272 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5274 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5275 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5276 (*env)->ExceptionDescribe(env);
5277 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5279 LDKCVec_u8Z ret_ref;
5280 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5281 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5282 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5283 if (get_jenv_res == JNI_EDETACHED) {
5284 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5288 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5289 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5290 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5291 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5293 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5294 jclass c = (*env)->GetObjectClass(env, o);
5296 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5297 atomic_init(&calls->refcnt, 1);
5298 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5299 calls->o = (*env)->NewWeakGlobalRef(env, o);
5300 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5301 CHECK(calls->write_meth != NULL);
5303 LDKChannelPublicKeys pubkeys_conv;
5304 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5305 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5306 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5309 .this_arg = (void*) calls,
5310 .write = write_LDKSign_jcall,
5311 .cloned = LDKSign_JCalls_cloned,
5312 .free = LDKSign_JCalls_free,
5313 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5315 calls->BaseSign = ret.BaseSign.this_arg;
5318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5319 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5320 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5321 return (uint64_t)res_ptr;
5323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5324 LDKSign *inp = (LDKSign *)(arg & ~1);
5325 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
5326 DO_ASSERT((res_ptr & 1) == 0);
5327 return (int64_t)(res_ptr | 1);
5329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5330 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5331 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5332 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5333 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5334 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5335 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5336 CVec_u8Z_free(ret_var);
5340 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5341 CHECK(owner->result_ok);
5342 return Sign_clone(&*owner->contents.result);
5344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5345 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5346 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5347 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5348 return (int64_t)ret_ret;
5351 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5352 CHECK(!owner->result_ok);
5353 return DecodeError_clone(&*owner->contents.err);
5355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5356 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5357 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5358 int64_t ret_ref = 0;
5359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5362 ret_ref = (uintptr_t)ret_var.inner;
5363 if (ret_var.is_owned) {
5369 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5370 CHECK(owner->result_ok);
5371 return *owner->contents.result;
5373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5374 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5375 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5380 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5381 CHECK(!owner->result_ok);
5382 return *owner->contents.err;
5384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5385 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5386 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5389 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5390 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5391 for (size_t i = 0; i < ret.datalen; i++) {
5392 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5396 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5397 CHECK(owner->result_ok);
5398 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5400 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5401 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5402 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5403 jobjectArray ret_arr = NULL;
5404 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5406 for (size_t i = 0; i < ret_var.datalen; i++) {
5407 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5408 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5409 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5410 CVec_u8Z_free(ret_conv_8_var);
5411 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5418 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5419 CHECK(!owner->result_ok);
5420 return *owner->contents.err;
5422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5423 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5424 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5427 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5428 CHECK(owner->result_ok);
5429 return InMemorySigner_clone(&*owner->contents.result);
5431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5432 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5433 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5434 int64_t ret_ref = 0;
5435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5438 ret_ref = (uintptr_t)ret_var.inner;
5439 if (ret_var.is_owned) {
5445 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5446 CHECK(!owner->result_ok);
5447 return DecodeError_clone(&*owner->contents.err);
5449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5450 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5451 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5452 int64_t ret_ref = 0;
5453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5456 ret_ref = (uintptr_t)ret_var.inner;
5457 if (ret_var.is_owned) {
5463 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5464 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5465 for (size_t i = 0; i < ret.datalen; i++) {
5466 ret.data[i] = TxOut_clone(&orig->data[i]);
5470 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5471 CHECK(owner->result_ok);
5472 return *owner->contents.result;
5474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5475 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5476 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5477 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5478 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5482 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5483 CHECK(!owner->result_ok);
5484 return *owner->contents.err;
5486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5487 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5488 CResult_TransactionNoneZ_get_err(owner_conv);
5491 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5492 return ThirtyTwoBytes_clone(&owner->a);
5494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5495 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5496 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5497 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5501 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5502 return ChannelMonitor_clone(&owner->b);
5504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5505 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5506 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5507 int64_t ret_ref = 0;
5508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5511 ret_ref = (uintptr_t)ret_var.inner;
5512 if (ret_var.is_owned) {
5518 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5519 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5520 for (size_t i = 0; i < ret.datalen; i++) {
5521 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5525 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5526 CHECK(owner->result_ok);
5527 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5529 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5530 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5531 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5532 int64_tArray ret_arr = NULL;
5533 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5534 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5535 for (size_t j = 0; j < ret_var.datalen; j++) {
5536 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5537 *ret_conv_35_conv = ret_var.data[j];
5538 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
5540 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5545 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5546 CHECK(!owner->result_ok);
5547 return *owner->contents.err;
5549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5550 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5551 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5555 static jclass LDKCOption_u16Z_Some_class = NULL;
5556 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5557 static jclass LDKCOption_u16Z_None_class = NULL;
5558 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5560 LDKCOption_u16Z_Some_class =
5561 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5562 CHECK(LDKCOption_u16Z_Some_class != NULL);
5563 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5564 CHECK(LDKCOption_u16Z_Some_meth != NULL);
5565 LDKCOption_u16Z_None_class =
5566 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5567 CHECK(LDKCOption_u16Z_None_class != NULL);
5568 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5569 CHECK(LDKCOption_u16Z_None_meth != NULL);
5571 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5572 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5574 case LDKCOption_u16Z_Some: {
5575 int16_t some_conv = obj->some;
5576 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5578 case LDKCOption_u16Z_None: {
5579 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5584 static jclass LDKAPIError_APIMisuseError_class = NULL;
5585 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5586 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5587 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5588 static jclass LDKAPIError_RouteError_class = NULL;
5589 static jmethodID LDKAPIError_RouteError_meth = NULL;
5590 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5591 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5592 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5593 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5594 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5595 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5597 LDKAPIError_APIMisuseError_class =
5598 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5599 CHECK(LDKAPIError_APIMisuseError_class != NULL);
5600 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5601 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5602 LDKAPIError_FeeRateTooHigh_class =
5603 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5604 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5605 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5606 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5607 LDKAPIError_RouteError_class =
5608 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5609 CHECK(LDKAPIError_RouteError_class != NULL);
5610 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5611 CHECK(LDKAPIError_RouteError_meth != NULL);
5612 LDKAPIError_ChannelUnavailable_class =
5613 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5614 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5615 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5616 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5617 LDKAPIError_MonitorUpdateFailed_class =
5618 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5619 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5620 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5621 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5622 LDKAPIError_IncompatibleShutdownScript_class =
5623 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5624 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5625 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5626 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5628 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5629 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5631 case LDKAPIError_APIMisuseError: {
5632 LDKStr err_str = obj->api_misuse_error.err;
5633 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5634 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5636 case LDKAPIError_FeeRateTooHigh: {
5637 LDKStr err_str = obj->fee_rate_too_high.err;
5638 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5639 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5640 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5642 case LDKAPIError_RouteError: {
5643 LDKStr err_str = obj->route_error.err;
5644 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5645 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5647 case LDKAPIError_ChannelUnavailable: {
5648 LDKStr err_str = obj->channel_unavailable.err;
5649 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5650 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5652 case LDKAPIError_MonitorUpdateFailed: {
5653 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5655 case LDKAPIError_IncompatibleShutdownScript: {
5656 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5657 int64_t script_ref = 0;
5658 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5659 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5660 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5661 script_ref = (uintptr_t)script_var.inner & ~1;
5662 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5667 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5668 CHECK(owner->result_ok);
5669 return *owner->contents.result;
5671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5672 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5673 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5676 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5677 CHECK(!owner->result_ok);
5678 return APIError_clone(&*owner->contents.err);
5680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5681 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5682 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5683 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5684 int64_t ret_ref = (uintptr_t)ret_copy;
5688 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5689 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5690 for (size_t i = 0; i < ret.datalen; i++) {
5691 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5695 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5696 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5697 for (size_t i = 0; i < ret.datalen; i++) {
5698 ret.data[i] = APIError_clone(&orig->data[i]);
5702 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5703 CHECK(owner->result_ok);
5704 return ThirtyTwoBytes_clone(&*owner->contents.result);
5706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5707 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5708 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
5713 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5714 CHECK(!owner->result_ok);
5715 return APIError_clone(&*owner->contents.err);
5717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5718 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5719 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5720 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5721 int64_t ret_ref = (uintptr_t)ret_copy;
5725 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
5726 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
5727 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
5728 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
5729 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
5730 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
5731 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
5732 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
5734 LDKPaymentSendFailure_ParameterError_class =
5735 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
5736 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
5737 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
5738 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
5739 LDKPaymentSendFailure_PathParameterError_class =
5740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
5741 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
5742 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
5743 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
5744 LDKPaymentSendFailure_AllFailedRetrySafe_class =
5745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
5746 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
5747 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
5748 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
5749 LDKPaymentSendFailure_PartialFailure_class =
5750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
5751 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5752 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5753 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5755 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5756 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5758 case LDKPaymentSendFailure_ParameterError: {
5759 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
5760 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5762 case LDKPaymentSendFailure_PathParameterError: {
5763 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5764 int64_tArray path_parameter_error_arr = NULL;
5765 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5766 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5767 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5768 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5769 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5770 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5771 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
5773 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5774 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5776 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5777 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5778 int64_tArray all_failed_retry_safe_arr = NULL;
5779 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5780 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5781 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5782 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
5783 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5785 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5786 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5788 case LDKPaymentSendFailure_PartialFailure: {
5789 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5790 int64_tArray results_arr = NULL;
5791 results_arr = (*env)->NewLongArray(env, results_var.datalen);
5792 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5793 for (size_t w = 0; w < results_var.datalen; w++) {
5794 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5795 *results_conv_22_conv = results_var.data[w];
5796 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5797 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
5799 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5800 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5801 int64_t failed_paths_retry_ref = 0;
5802 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
5803 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5804 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5805 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5806 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
5808 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5809 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5810 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5815 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5816 CHECK(owner->result_ok);
5817 return ThirtyTwoBytes_clone(&*owner->contents.result);
5819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5820 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5821 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5826 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5827 CHECK(!owner->result_ok);
5828 return PaymentSendFailure_clone(&*owner->contents.err);
5830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5831 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5832 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5833 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5834 int64_t ret_ref = (uintptr_t)ret_copy;
5838 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5839 CHECK(owner->result_ok);
5840 return *owner->contents.result;
5842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5843 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5844 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5847 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5848 CHECK(!owner->result_ok);
5849 return PaymentSendFailure_clone(&*owner->contents.err);
5851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5852 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5853 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5854 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5855 int64_t ret_ref = (uintptr_t)ret_copy;
5859 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5860 return ThirtyTwoBytes_clone(&owner->a);
5862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5863 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5864 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5865 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5869 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5870 return ThirtyTwoBytes_clone(&owner->b);
5872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5873 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5874 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5879 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5880 CHECK(owner->result_ok);
5881 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5884 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5885 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5886 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5887 return ((int64_t)ret_conv);
5890 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5891 CHECK(!owner->result_ok);
5892 return PaymentSendFailure_clone(&*owner->contents.err);
5894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5895 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5896 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5897 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5898 int64_t ret_ref = (uintptr_t)ret_copy;
5902 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5903 return ThirtyTwoBytes_clone(&owner->a);
5905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5906 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5907 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5908 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5912 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5913 return ThirtyTwoBytes_clone(&owner->b);
5915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5916 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5917 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5918 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5922 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5923 CHECK(owner->result_ok);
5924 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5927 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5928 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5929 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5930 return ((int64_t)ret_conv);
5933 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5934 CHECK(!owner->result_ok);
5935 return *owner->contents.err;
5937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5938 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5939 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5942 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5943 CHECK(owner->result_ok);
5944 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5947 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5948 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5949 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5950 return ((int64_t)ret_conv);
5953 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5954 CHECK(!owner->result_ok);
5955 return APIError_clone(&*owner->contents.err);
5957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5958 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5959 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5960 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5961 int64_t ret_ref = (uintptr_t)ret_copy;
5965 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5966 CHECK(owner->result_ok);
5967 return ThirtyTwoBytes_clone(&*owner->contents.result);
5969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5970 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5971 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5972 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5976 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5977 CHECK(!owner->result_ok);
5978 return *owner->contents.err;
5980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5981 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5982 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5985 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5986 CHECK(owner->result_ok);
5987 return ThirtyTwoBytes_clone(&*owner->contents.result);
5989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5990 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5991 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5996 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5997 CHECK(!owner->result_ok);
5998 return APIError_clone(&*owner->contents.err);
6000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6001 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6002 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6003 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6004 int64_t ret_ref = (uintptr_t)ret_copy;
6008 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6009 CHECK(owner->result_ok);
6010 return ThirtyTwoBytes_clone(&*owner->contents.result);
6012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6013 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6014 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6019 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6020 CHECK(!owner->result_ok);
6021 return APIError_clone(&*owner->contents.err);
6023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6024 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6025 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6026 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6027 int64_t ret_ref = (uintptr_t)ret_copy;
6031 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6032 CHECK(owner->result_ok);
6033 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
6035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6036 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6037 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6038 int64_t ret_ref = 0;
6039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6042 ret_ref = (uintptr_t)ret_var.inner;
6043 if (ret_var.is_owned) {
6049 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6050 CHECK(!owner->result_ok);
6051 return DecodeError_clone(&*owner->contents.err);
6053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6054 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6055 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6056 int64_t ret_ref = 0;
6057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6060 ret_ref = (uintptr_t)ret_var.inner;
6061 if (ret_var.is_owned) {
6067 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6068 CHECK(owner->result_ok);
6069 return ChannelCounterparty_clone(&*owner->contents.result);
6071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6072 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6073 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6074 int64_t ret_ref = 0;
6075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6078 ret_ref = (uintptr_t)ret_var.inner;
6079 if (ret_var.is_owned) {
6085 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6086 CHECK(!owner->result_ok);
6087 return DecodeError_clone(&*owner->contents.err);
6089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6090 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6091 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6092 int64_t ret_ref = 0;
6093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6096 ret_ref = (uintptr_t)ret_var.inner;
6097 if (ret_var.is_owned) {
6103 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6104 CHECK(owner->result_ok);
6105 return ChannelDetails_clone(&*owner->contents.result);
6107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6108 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6109 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6110 int64_t ret_ref = 0;
6111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6114 ret_ref = (uintptr_t)ret_var.inner;
6115 if (ret_var.is_owned) {
6121 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6122 CHECK(!owner->result_ok);
6123 return DecodeError_clone(&*owner->contents.err);
6125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6126 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6127 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6128 int64_t ret_ref = 0;
6129 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6130 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6132 ret_ref = (uintptr_t)ret_var.inner;
6133 if (ret_var.is_owned) {
6139 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6140 CHECK(owner->result_ok);
6141 return PhantomRouteHints_clone(&*owner->contents.result);
6143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6144 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6145 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6146 int64_t ret_ref = 0;
6147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6150 ret_ref = (uintptr_t)ret_var.inner;
6151 if (ret_var.is_owned) {
6157 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6158 CHECK(!owner->result_ok);
6159 return DecodeError_clone(&*owner->contents.err);
6161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6162 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6163 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6164 int64_t ret_ref = 0;
6165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6168 ret_ref = (uintptr_t)ret_var.inner;
6169 if (ret_var.is_owned) {
6175 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6176 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6177 for (size_t i = 0; i < ret.datalen; i++) {
6178 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6182 typedef struct LDKWatch_JCalls {
6183 atomic_size_t refcnt;
6186 jmethodID watch_channel_meth;
6187 jmethodID update_channel_meth;
6188 jmethodID release_pending_monitor_events_meth;
6190 static void LDKWatch_JCalls_free(void* this_arg) {
6191 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6192 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6194 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6195 if (get_jenv_res == JNI_EDETACHED) {
6196 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6198 DO_ASSERT(get_jenv_res == JNI_OK);
6200 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6201 if (get_jenv_res == JNI_EDETACHED) {
6202 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6207 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6208 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6211 if (get_jenv_res == JNI_EDETACHED) {
6212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6214 DO_ASSERT(get_jenv_res == JNI_OK);
6216 LDKOutPoint funding_txo_var = funding_txo;
6217 int64_t funding_txo_ref = 0;
6218 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6219 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6220 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6221 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6222 if (funding_txo_var.is_owned) {
6223 funding_txo_ref |= 1;
6225 LDKChannelMonitor monitor_var = monitor;
6226 int64_t monitor_ref = 0;
6227 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6228 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6229 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6230 monitor_ref = (uintptr_t)monitor_var.inner;
6231 if (monitor_var.is_owned) {
6234 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6236 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6237 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6238 (*env)->ExceptionDescribe(env);
6239 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6241 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6242 CHECK_ACCESS(ret_ptr);
6243 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6245 if (get_jenv_res == JNI_EDETACHED) {
6246 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6250 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6251 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6253 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6254 if (get_jenv_res == JNI_EDETACHED) {
6255 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6257 DO_ASSERT(get_jenv_res == JNI_OK);
6259 LDKOutPoint funding_txo_var = funding_txo;
6260 int64_t funding_txo_ref = 0;
6261 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6262 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6263 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6264 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6265 if (funding_txo_var.is_owned) {
6266 funding_txo_ref |= 1;
6268 LDKChannelMonitorUpdate update_var = update;
6269 int64_t update_ref = 0;
6270 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6271 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6272 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6273 update_ref = (uintptr_t)update_var.inner;
6274 if (update_var.is_owned) {
6277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6279 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6280 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6281 (*env)->ExceptionDescribe(env);
6282 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6284 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6285 CHECK_ACCESS(ret_ptr);
6286 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6288 if (get_jenv_res == JNI_EDETACHED) {
6289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6293 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6294 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6296 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6297 if (get_jenv_res == JNI_EDETACHED) {
6298 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6300 DO_ASSERT(get_jenv_res == JNI_OK);
6302 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6304 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6305 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6306 (*env)->ExceptionDescribe(env);
6307 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6309 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr;
6310 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6311 if (ret_constr.datalen > 0)
6312 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
6314 ret_constr.data = NULL;
6315 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6316 for (size_t m = 0; m < ret_constr.datalen; m++) {
6317 int64_t ret_conv_38 = ret_vals[m];
6318 void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1);
6319 CHECK_ACCESS(ret_conv_38_ptr);
6320 LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr);
6321 FREE((void*)ret_conv_38);
6322 ret_constr.data[m] = ret_conv_38_conv;
6324 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6325 if (get_jenv_res == JNI_EDETACHED) {
6326 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6330 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6331 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6332 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6334 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6335 jclass c = (*env)->GetObjectClass(env, o);
6337 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6338 atomic_init(&calls->refcnt, 1);
6339 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6340 calls->o = (*env)->NewWeakGlobalRef(env, o);
6341 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6342 CHECK(calls->watch_channel_meth != NULL);
6343 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6344 CHECK(calls->update_channel_meth != NULL);
6345 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6346 CHECK(calls->release_pending_monitor_events_meth != NULL);
6349 .this_arg = (void*) calls,
6350 .watch_channel = watch_channel_LDKWatch_jcall,
6351 .update_channel = update_channel_LDKWatch_jcall,
6352 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6353 .free = LDKWatch_JCalls_free,
6357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6358 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6359 *res_ptr = LDKWatch_init(env, clz, o);
6360 return (uint64_t)res_ptr;
6362 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) {
6363 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6364 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6365 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6366 LDKOutPoint funding_txo_conv;
6367 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6368 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6369 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6370 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6371 LDKChannelMonitor monitor_conv;
6372 monitor_conv.inner = (void*)(monitor & (~1));
6373 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6374 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6375 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6376 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6377 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6378 return (int64_t)ret_conv;
6381 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) {
6382 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6383 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6384 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6385 LDKOutPoint funding_txo_conv;
6386 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6387 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6388 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6389 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6390 LDKChannelMonitorUpdate update_conv;
6391 update_conv.inner = (void*)(update & (~1));
6392 update_conv.is_owned = (update & 1) || (update == 0);
6393 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6394 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6395 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6396 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6397 return (int64_t)ret_conv;
6400 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6401 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6402 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6403 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6404 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6405 int64_tArray ret_arr = NULL;
6406 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6407 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6408 for (size_t m = 0; m < ret_var.datalen; m++) {
6409 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
6410 *ret_conv_38_conv = ret_var.data[m];
6411 ret_arr_ptr[m] = ((int64_t)ret_conv_38_conv);
6413 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6418 typedef struct LDKBroadcasterInterface_JCalls {
6419 atomic_size_t refcnt;
6422 jmethodID broadcast_transaction_meth;
6423 } LDKBroadcasterInterface_JCalls;
6424 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6425 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6426 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6428 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6429 if (get_jenv_res == JNI_EDETACHED) {
6430 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6432 DO_ASSERT(get_jenv_res == JNI_OK);
6434 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6435 if (get_jenv_res == JNI_EDETACHED) {
6436 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6441 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6442 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6444 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6445 if (get_jenv_res == JNI_EDETACHED) {
6446 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6448 DO_ASSERT(get_jenv_res == JNI_OK);
6450 LDKTransaction tx_var = tx;
6451 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6452 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6453 Transaction_free(tx_var);
6454 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6456 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6457 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6458 (*env)->ExceptionDescribe(env);
6459 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6461 if (get_jenv_res == JNI_EDETACHED) {
6462 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6465 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6466 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6467 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6469 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6470 jclass c = (*env)->GetObjectClass(env, o);
6472 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6473 atomic_init(&calls->refcnt, 1);
6474 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6475 calls->o = (*env)->NewWeakGlobalRef(env, o);
6476 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6477 CHECK(calls->broadcast_transaction_meth != NULL);
6479 LDKBroadcasterInterface ret = {
6480 .this_arg = (void*) calls,
6481 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6482 .free = LDKBroadcasterInterface_JCalls_free,
6486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6487 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6488 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6489 return (uint64_t)res_ptr;
6491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6492 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6494 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6495 LDKTransaction tx_ref;
6496 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6497 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6498 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6499 tx_ref.data_is_owned = true;
6500 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6503 typedef struct LDKKeysInterface_JCalls {
6504 atomic_size_t refcnt;
6507 jmethodID get_node_secret_meth;
6508 jmethodID get_destination_script_meth;
6509 jmethodID get_shutdown_scriptpubkey_meth;
6510 jmethodID get_channel_signer_meth;
6511 jmethodID get_secure_random_bytes_meth;
6512 jmethodID read_chan_signer_meth;
6513 jmethodID sign_invoice_meth;
6514 jmethodID get_inbound_payment_key_material_meth;
6515 } LDKKeysInterface_JCalls;
6516 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6517 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6518 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6520 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6521 if (get_jenv_res == JNI_EDETACHED) {
6522 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6524 DO_ASSERT(get_jenv_res == JNI_OK);
6526 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6527 if (get_jenv_res == JNI_EDETACHED) {
6528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6533 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6534 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6536 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6537 if (get_jenv_res == JNI_EDETACHED) {
6538 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6540 DO_ASSERT(get_jenv_res == JNI_OK);
6542 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6543 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6545 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6546 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6547 (*env)->ExceptionDescribe(env);
6548 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6550 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6551 CHECK_ACCESS(ret_ptr);
6552 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6554 if (get_jenv_res == JNI_EDETACHED) {
6555 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6559 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6560 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6563 if (get_jenv_res == JNI_EDETACHED) {
6564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6566 DO_ASSERT(get_jenv_res == JNI_OK);
6568 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6570 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6571 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6572 (*env)->ExceptionDescribe(env);
6573 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6575 LDKCVec_u8Z ret_ref;
6576 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6577 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6578 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6579 if (get_jenv_res == JNI_EDETACHED) {
6580 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6584 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6585 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6587 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6588 if (get_jenv_res == JNI_EDETACHED) {
6589 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6591 DO_ASSERT(get_jenv_res == JNI_OK);
6593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6595 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6596 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6597 (*env)->ExceptionDescribe(env);
6598 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6600 LDKShutdownScript ret_conv;
6601 ret_conv.inner = (void*)(ret & (~1));
6602 ret_conv.is_owned = (ret & 1) || (ret == 0);
6603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6604 if (get_jenv_res == JNI_EDETACHED) {
6605 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6609 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6610 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6612 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6613 if (get_jenv_res == JNI_EDETACHED) {
6614 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6616 DO_ASSERT(get_jenv_res == JNI_OK);
6618 jboolean inbound_conv = inbound;
6619 int64_t channel_value_satoshis_conv = channel_value_satoshis;
6620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6622 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6623 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6624 (*env)->ExceptionDescribe(env);
6625 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6627 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6628 CHECK_ACCESS(ret_ptr);
6629 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6631 if (get_jenv_res == JNI_EDETACHED) {
6632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6636 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6637 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6640 if (get_jenv_res == JNI_EDETACHED) {
6641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6643 DO_ASSERT(get_jenv_res == JNI_OK);
6645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6647 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6648 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6649 (*env)->ExceptionDescribe(env);
6650 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6652 LDKThirtyTwoBytes ret_ref;
6653 CHECK((*env)->GetArrayLength(env, ret) == 32);
6654 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6655 if (get_jenv_res == JNI_EDETACHED) {
6656 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6660 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6661 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6663 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6664 if (get_jenv_res == JNI_EDETACHED) {
6665 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6667 DO_ASSERT(get_jenv_res == JNI_OK);
6669 LDKu8slice reader_var = reader;
6670 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6671 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6672 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6674 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6675 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6676 (*env)->ExceptionDescribe(env);
6677 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6679 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6680 CHECK_ACCESS(ret_ptr);
6681 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6683 if (get_jenv_res == JNI_EDETACHED) {
6684 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6688 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6689 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6691 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6692 if (get_jenv_res == JNI_EDETACHED) {
6693 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6695 DO_ASSERT(get_jenv_res == JNI_OK);
6697 LDKu8slice hrp_bytes_var = hrp_bytes;
6698 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6699 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6700 LDKCVec_u5Z invoice_data_var = invoice_data;
6701 jobjectArray invoice_data_arr = NULL;
6702 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6703 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6704 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6705 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6706 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6708 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6709 FREE(invoice_data_var.data);
6710 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6711 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6713 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6714 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6715 (*env)->ExceptionDescribe(env);
6716 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6718 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6719 CHECK_ACCESS(ret_ptr);
6720 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6722 if (get_jenv_res == JNI_EDETACHED) {
6723 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6727 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6728 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6730 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6731 if (get_jenv_res == JNI_EDETACHED) {
6732 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6734 DO_ASSERT(get_jenv_res == JNI_OK);
6736 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6738 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6739 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6740 (*env)->ExceptionDescribe(env);
6741 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6743 LDKThirtyTwoBytes ret_ref;
6744 CHECK((*env)->GetArrayLength(env, ret) == 32);
6745 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6746 if (get_jenv_res == JNI_EDETACHED) {
6747 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6751 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6752 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6753 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6755 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6756 jclass c = (*env)->GetObjectClass(env, o);
6758 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6759 atomic_init(&calls->refcnt, 1);
6760 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6761 calls->o = (*env)->NewWeakGlobalRef(env, o);
6762 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6763 CHECK(calls->get_node_secret_meth != NULL);
6764 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6765 CHECK(calls->get_destination_script_meth != NULL);
6766 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6767 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6768 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6769 CHECK(calls->get_channel_signer_meth != NULL);
6770 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6771 CHECK(calls->get_secure_random_bytes_meth != NULL);
6772 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6773 CHECK(calls->read_chan_signer_meth != NULL);
6774 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6775 CHECK(calls->sign_invoice_meth != NULL);
6776 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6777 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6779 LDKKeysInterface ret = {
6780 .this_arg = (void*) calls,
6781 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6782 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6783 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6784 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6785 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6786 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6787 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6788 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6789 .free = LDKKeysInterface_JCalls_free,
6793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6794 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6795 *res_ptr = LDKKeysInterface_init(env, clz, o);
6796 return (uint64_t)res_ptr;
6798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6799 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6800 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6801 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6802 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6803 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6804 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6805 return (int64_t)ret_conv;
6808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6809 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6810 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6811 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6812 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6813 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6814 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6815 CVec_u8Z_free(ret_var);
6819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6820 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6821 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6822 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6823 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6824 int64_t ret_ref = 0;
6825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6828 ret_ref = (uintptr_t)ret_var.inner;
6829 if (ret_var.is_owned) {
6835 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) {
6836 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6837 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6838 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6839 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6840 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6841 return (int64_t)ret_ret;
6844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6845 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6846 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6847 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6848 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6849 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6854 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6855 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6856 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6857 LDKu8slice reader_ref;
6858 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6859 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6860 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6861 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6862 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6863 return (int64_t)ret_conv;
6866 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) {
6867 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6868 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6869 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6870 LDKu8slice hrp_bytes_ref;
6871 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6872 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6873 LDKCVec_u5Z invoice_data_constr;
6874 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6875 if (invoice_data_constr.datalen > 0)
6876 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6878 invoice_data_constr.data = NULL;
6879 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6880 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6881 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6883 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6885 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6886 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6887 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6888 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6889 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6890 return (int64_t)ret_conv;
6893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6894 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6895 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6896 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6897 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6898 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6902 typedef struct LDKFeeEstimator_JCalls {
6903 atomic_size_t refcnt;
6906 jmethodID get_est_sat_per_1000_weight_meth;
6907 } LDKFeeEstimator_JCalls;
6908 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6909 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6910 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6912 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6913 if (get_jenv_res == JNI_EDETACHED) {
6914 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6916 DO_ASSERT(get_jenv_res == JNI_OK);
6918 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6919 if (get_jenv_res == JNI_EDETACHED) {
6920 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6925 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6926 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6928 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6929 if (get_jenv_res == JNI_EDETACHED) {
6930 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6932 DO_ASSERT(get_jenv_res == JNI_OK);
6934 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6935 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6937 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6938 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6939 (*env)->ExceptionDescribe(env);
6940 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6942 if (get_jenv_res == JNI_EDETACHED) {
6943 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6947 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6948 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6949 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6951 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6952 jclass c = (*env)->GetObjectClass(env, o);
6954 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6955 atomic_init(&calls->refcnt, 1);
6956 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6957 calls->o = (*env)->NewWeakGlobalRef(env, o);
6958 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6959 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6961 LDKFeeEstimator ret = {
6962 .this_arg = (void*) calls,
6963 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6964 .free = LDKFeeEstimator_JCalls_free,
6968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6969 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6970 *res_ptr = LDKFeeEstimator_init(env, clz, o);
6971 return (uint64_t)res_ptr;
6973 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) {
6974 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6975 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6976 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6977 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6978 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6982 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6983 return ThirtyTwoBytes_clone(&owner->a);
6985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6986 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6987 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6988 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6992 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6996 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6997 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6998 int64_t ret_ref = 0;
6999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7002 ret_ref = (uintptr_t)ret_var.inner & ~1;
7006 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7007 CHECK(owner->result_ok);
7008 return &*owner->contents.result;
7010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7011 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7012 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
7016 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7017 CHECK(!owner->result_ok);
7018 return DecodeError_clone(&*owner->contents.err);
7020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7021 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7022 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7023 int64_t ret_ref = 0;
7024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7027 ret_ref = (uintptr_t)ret_var.inner;
7028 if (ret_var.is_owned) {
7034 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7035 CHECK(owner->result_ok);
7036 return ChannelConfig_clone(&*owner->contents.result);
7038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7039 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7040 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7041 int64_t ret_ref = 0;
7042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7045 ret_ref = (uintptr_t)ret_var.inner;
7046 if (ret_var.is_owned) {
7052 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7053 CHECK(!owner->result_ok);
7054 return DecodeError_clone(&*owner->contents.err);
7056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7057 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7058 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7059 int64_t ret_ref = 0;
7060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7063 ret_ref = (uintptr_t)ret_var.inner;
7064 if (ret_var.is_owned) {
7070 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7071 CHECK(owner->result_ok);
7072 return OutPoint_clone(&*owner->contents.result);
7074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7075 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7076 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7077 int64_t ret_ref = 0;
7078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7081 ret_ref = (uintptr_t)ret_var.inner;
7082 if (ret_var.is_owned) {
7088 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7089 CHECK(!owner->result_ok);
7090 return DecodeError_clone(&*owner->contents.err);
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7093 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7094 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7095 int64_t ret_ref = 0;
7096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7099 ret_ref = (uintptr_t)ret_var.inner;
7100 if (ret_var.is_owned) {
7106 typedef struct LDKType_JCalls {
7107 atomic_size_t refcnt;
7110 jmethodID type_id_meth;
7111 jmethodID debug_str_meth;
7112 jmethodID write_meth;
7114 static void LDKType_JCalls_free(void* this_arg) {
7115 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7118 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7119 if (get_jenv_res == JNI_EDETACHED) {
7120 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7122 DO_ASSERT(get_jenv_res == JNI_OK);
7124 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7125 if (get_jenv_res == JNI_EDETACHED) {
7126 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7131 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7132 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7134 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7135 if (get_jenv_res == JNI_EDETACHED) {
7136 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7138 DO_ASSERT(get_jenv_res == JNI_OK);
7140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7142 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
7143 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7144 (*env)->ExceptionDescribe(env);
7145 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
7147 if (get_jenv_res == JNI_EDETACHED) {
7148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7152 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7153 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7155 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7156 if (get_jenv_res == JNI_EDETACHED) {
7157 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7159 DO_ASSERT(get_jenv_res == JNI_OK);
7161 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7163 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
7164 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7165 (*env)->ExceptionDescribe(env);
7166 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
7168 LDKStr ret_conv = java_to_owned_str(env, ret);
7169 if (get_jenv_res == JNI_EDETACHED) {
7170 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7174 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7175 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7177 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7178 if (get_jenv_res == JNI_EDETACHED) {
7179 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7181 DO_ASSERT(get_jenv_res == JNI_OK);
7183 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7185 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
7186 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7187 (*env)->ExceptionDescribe(env);
7188 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
7190 LDKCVec_u8Z ret_ref;
7191 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7192 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7193 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7194 if (get_jenv_res == JNI_EDETACHED) {
7195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7199 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7200 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7201 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7203 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7204 jclass c = (*env)->GetObjectClass(env, o);
7206 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7207 atomic_init(&calls->refcnt, 1);
7208 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7209 calls->o = (*env)->NewWeakGlobalRef(env, o);
7210 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7211 CHECK(calls->type_id_meth != NULL);
7212 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7213 CHECK(calls->debug_str_meth != NULL);
7214 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7215 CHECK(calls->write_meth != NULL);
7218 .this_arg = (void*) calls,
7219 .type_id = type_id_LDKType_jcall,
7220 .debug_str = debug_str_LDKType_jcall,
7221 .write = write_LDKType_jcall,
7222 .cloned = LDKType_JCalls_cloned,
7223 .free = LDKType_JCalls_free,
7227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7228 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7229 *res_ptr = LDKType_init(env, clz, o);
7230 return (uint64_t)res_ptr;
7232 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7233 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7234 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7235 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7236 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7240 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7241 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7242 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7243 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7244 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7245 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7251 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7252 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7253 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7254 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7255 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7256 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7257 CVec_u8Z_free(ret_var);
7261 static jclass LDKCOption_TypeZ_Some_class = NULL;
7262 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7263 static jclass LDKCOption_TypeZ_None_class = NULL;
7264 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7266 LDKCOption_TypeZ_Some_class =
7267 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7268 CHECK(LDKCOption_TypeZ_Some_class != NULL);
7269 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7270 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7271 LDKCOption_TypeZ_None_class =
7272 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7273 CHECK(LDKCOption_TypeZ_None_class != NULL);
7274 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7275 CHECK(LDKCOption_TypeZ_None_meth != NULL);
7277 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7278 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
7280 case LDKCOption_TypeZ_Some: {
7281 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7282 *some_ret = Type_clone(&obj->some);
7283 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
7285 case LDKCOption_TypeZ_None: {
7286 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7291 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7292 CHECK(owner->result_ok);
7293 return COption_TypeZ_clone(&*owner->contents.result);
7295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7296 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7297 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7298 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7299 int64_t ret_ref = (uintptr_t)ret_copy;
7303 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7304 CHECK(!owner->result_ok);
7305 return DecodeError_clone(&*owner->contents.err);
7307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7308 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7309 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7310 int64_t ret_ref = 0;
7311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7314 ret_ref = (uintptr_t)ret_var.inner;
7315 if (ret_var.is_owned) {
7321 static jclass LDKPaymentError_Invoice_class = NULL;
7322 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7323 static jclass LDKPaymentError_Routing_class = NULL;
7324 static jmethodID LDKPaymentError_Routing_meth = NULL;
7325 static jclass LDKPaymentError_Sending_class = NULL;
7326 static jmethodID LDKPaymentError_Sending_meth = NULL;
7327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7328 LDKPaymentError_Invoice_class =
7329 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7330 CHECK(LDKPaymentError_Invoice_class != NULL);
7331 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7332 CHECK(LDKPaymentError_Invoice_meth != NULL);
7333 LDKPaymentError_Routing_class =
7334 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7335 CHECK(LDKPaymentError_Routing_class != NULL);
7336 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7337 CHECK(LDKPaymentError_Routing_meth != NULL);
7338 LDKPaymentError_Sending_class =
7339 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7340 CHECK(LDKPaymentError_Sending_class != NULL);
7341 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7342 CHECK(LDKPaymentError_Sending_meth != NULL);
7344 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7345 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
7347 case LDKPaymentError_Invoice: {
7348 LDKStr invoice_str = obj->invoice;
7349 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7350 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7352 case LDKPaymentError_Routing: {
7353 LDKLightningError routing_var = obj->routing;
7354 int64_t routing_ref = 0;
7355 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7356 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7357 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7358 routing_ref = (uintptr_t)routing_var.inner & ~1;
7359 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7361 case LDKPaymentError_Sending: {
7362 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
7363 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7368 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7369 CHECK(owner->result_ok);
7370 return ThirtyTwoBytes_clone(&*owner->contents.result);
7372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7373 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7374 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7375 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7379 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7380 CHECK(!owner->result_ok);
7381 return PaymentError_clone(&*owner->contents.err);
7383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7384 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7385 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7386 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7387 int64_t ret_ref = (uintptr_t)ret_copy;
7391 static jclass LDKParseError_Bech32Error_class = NULL;
7392 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7393 static jclass LDKParseError_ParseAmountError_class = NULL;
7394 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7395 static jclass LDKParseError_MalformedSignature_class = NULL;
7396 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7397 static jclass LDKParseError_BadPrefix_class = NULL;
7398 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7399 static jclass LDKParseError_UnknownCurrency_class = NULL;
7400 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7401 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7402 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7403 static jclass LDKParseError_MalformedHRP_class = NULL;
7404 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7405 static jclass LDKParseError_TooShortDataPart_class = NULL;
7406 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7407 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7408 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7409 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7410 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7411 static jclass LDKParseError_PaddingError_class = NULL;
7412 static jmethodID LDKParseError_PaddingError_meth = NULL;
7413 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7414 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7415 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7416 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7417 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7418 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7419 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7420 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7421 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7422 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7423 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7424 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7425 static jclass LDKParseError_Skip_class = NULL;
7426 static jmethodID LDKParseError_Skip_meth = NULL;
7427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7428 LDKParseError_Bech32Error_class =
7429 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7430 CHECK(LDKParseError_Bech32Error_class != NULL);
7431 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7432 CHECK(LDKParseError_Bech32Error_meth != NULL);
7433 LDKParseError_ParseAmountError_class =
7434 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7435 CHECK(LDKParseError_ParseAmountError_class != NULL);
7436 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7437 CHECK(LDKParseError_ParseAmountError_meth != NULL);
7438 LDKParseError_MalformedSignature_class =
7439 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7440 CHECK(LDKParseError_MalformedSignature_class != NULL);
7441 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7442 CHECK(LDKParseError_MalformedSignature_meth != NULL);
7443 LDKParseError_BadPrefix_class =
7444 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7445 CHECK(LDKParseError_BadPrefix_class != NULL);
7446 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7447 CHECK(LDKParseError_BadPrefix_meth != NULL);
7448 LDKParseError_UnknownCurrency_class =
7449 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7450 CHECK(LDKParseError_UnknownCurrency_class != NULL);
7451 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7452 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7453 LDKParseError_UnknownSiPrefix_class =
7454 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7455 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7456 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7457 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7458 LDKParseError_MalformedHRP_class =
7459 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7460 CHECK(LDKParseError_MalformedHRP_class != NULL);
7461 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7462 CHECK(LDKParseError_MalformedHRP_meth != NULL);
7463 LDKParseError_TooShortDataPart_class =
7464 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7465 CHECK(LDKParseError_TooShortDataPart_class != NULL);
7466 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7467 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7468 LDKParseError_UnexpectedEndOfTaggedFields_class =
7469 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7470 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7471 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7472 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7473 LDKParseError_DescriptionDecodeError_class =
7474 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7475 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7476 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7477 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7478 LDKParseError_PaddingError_class =
7479 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7480 CHECK(LDKParseError_PaddingError_class != NULL);
7481 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7482 CHECK(LDKParseError_PaddingError_meth != NULL);
7483 LDKParseError_IntegerOverflowError_class =
7484 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7485 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7486 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7487 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7488 LDKParseError_InvalidSegWitProgramLength_class =
7489 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7490 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7491 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7492 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7493 LDKParseError_InvalidPubKeyHashLength_class =
7494 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7495 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7496 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7497 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7498 LDKParseError_InvalidScriptHashLength_class =
7499 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7500 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7501 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7502 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7503 LDKParseError_InvalidRecoveryId_class =
7504 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7505 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7506 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7507 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7508 LDKParseError_InvalidSliceLength_class =
7509 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7510 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7511 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7512 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7513 LDKParseError_Skip_class =
7514 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7515 CHECK(LDKParseError_Skip_class != NULL);
7516 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7517 CHECK(LDKParseError_Skip_meth != NULL);
7519 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7520 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
7522 case LDKParseError_Bech32Error: {
7523 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
7524 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7526 case LDKParseError_ParseAmountError: {
7527 /*obj->parse_amount_error*/
7528 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7530 case LDKParseError_MalformedSignature: {
7531 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7532 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7534 case LDKParseError_BadPrefix: {
7535 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7537 case LDKParseError_UnknownCurrency: {
7538 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7540 case LDKParseError_UnknownSiPrefix: {
7541 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7543 case LDKParseError_MalformedHRP: {
7544 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7546 case LDKParseError_TooShortDataPart: {
7547 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7549 case LDKParseError_UnexpectedEndOfTaggedFields: {
7550 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7552 case LDKParseError_DescriptionDecodeError: {
7553 /*obj->description_decode_error*/
7554 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7556 case LDKParseError_PaddingError: {
7557 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7559 case LDKParseError_IntegerOverflowError: {
7560 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7562 case LDKParseError_InvalidSegWitProgramLength: {
7563 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7565 case LDKParseError_InvalidPubKeyHashLength: {
7566 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7568 case LDKParseError_InvalidScriptHashLength: {
7569 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7571 case LDKParseError_InvalidRecoveryId: {
7572 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7574 case LDKParseError_InvalidSliceLength: {
7575 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7576 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7577 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7579 case LDKParseError_Skip: {
7580 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7585 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7586 CHECK(owner->result_ok);
7587 return SiPrefix_clone(&*owner->contents.result);
7589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7590 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7591 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7595 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7596 CHECK(!owner->result_ok);
7597 return ParseError_clone(&*owner->contents.err);
7599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7600 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7601 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7602 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7603 int64_t ret_ref = (uintptr_t)ret_copy;
7607 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7608 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7609 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7610 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7612 LDKParseOrSemanticError_ParseError_class =
7613 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7614 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7615 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7616 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7617 LDKParseOrSemanticError_SemanticError_class =
7618 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7619 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7620 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7621 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7623 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7624 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
7626 case LDKParseOrSemanticError_ParseError: {
7627 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
7628 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7630 case LDKParseOrSemanticError_SemanticError: {
7631 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7632 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7637 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7638 CHECK(owner->result_ok);
7639 return Invoice_clone(&*owner->contents.result);
7641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7642 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7643 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7644 int64_t ret_ref = 0;
7645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7648 ret_ref = (uintptr_t)ret_var.inner;
7649 if (ret_var.is_owned) {
7655 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7656 CHECK(!owner->result_ok);
7657 return ParseOrSemanticError_clone(&*owner->contents.err);
7659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7660 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7661 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7662 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7663 int64_t ret_ref = (uintptr_t)ret_copy;
7667 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7668 CHECK(owner->result_ok);
7669 return SignedRawInvoice_clone(&*owner->contents.result);
7671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7672 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7673 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7674 int64_t ret_ref = 0;
7675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7678 ret_ref = (uintptr_t)ret_var.inner;
7679 if (ret_var.is_owned) {
7685 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7686 CHECK(!owner->result_ok);
7687 return ParseError_clone(&*owner->contents.err);
7689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7690 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7691 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7692 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7693 int64_t ret_ref = (uintptr_t)ret_copy;
7697 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7698 return RawInvoice_clone(&owner->a);
7700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7701 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7702 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7703 int64_t ret_ref = 0;
7704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7707 ret_ref = (uintptr_t)ret_var.inner;
7708 if (ret_var.is_owned) {
7714 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7715 return ThirtyTwoBytes_clone(&owner->b);
7717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7718 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7719 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7720 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7724 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7725 return InvoiceSignature_clone(&owner->c);
7727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7728 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7729 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7730 int64_t ret_ref = 0;
7731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7734 ret_ref = (uintptr_t)ret_var.inner;
7735 if (ret_var.is_owned) {
7741 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7742 CHECK(owner->result_ok);
7743 return PayeePubKey_clone(&*owner->contents.result);
7745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7746 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7747 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7748 int64_t ret_ref = 0;
7749 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7750 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7752 ret_ref = (uintptr_t)ret_var.inner;
7753 if (ret_var.is_owned) {
7759 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7760 CHECK(!owner->result_ok);
7761 return *owner->contents.err;
7763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7764 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7765 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7769 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7770 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7771 for (size_t i = 0; i < ret.datalen; i++) {
7772 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7776 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7777 CHECK(owner->result_ok);
7778 return PositiveTimestamp_clone(&*owner->contents.result);
7780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7781 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7782 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7783 int64_t ret_ref = 0;
7784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7787 ret_ref = (uintptr_t)ret_var.inner;
7788 if (ret_var.is_owned) {
7794 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7795 CHECK(!owner->result_ok);
7796 return CreationError_clone(&*owner->contents.err);
7798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7799 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7800 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7804 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7805 CHECK(owner->result_ok);
7806 return *owner->contents.result;
7808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7809 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7810 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7813 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7814 CHECK(!owner->result_ok);
7815 return SemanticError_clone(&*owner->contents.err);
7817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7818 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7819 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7823 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7824 CHECK(owner->result_ok);
7825 return Invoice_clone(&*owner->contents.result);
7827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7828 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7829 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7830 int64_t ret_ref = 0;
7831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7834 ret_ref = (uintptr_t)ret_var.inner;
7835 if (ret_var.is_owned) {
7841 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7842 CHECK(!owner->result_ok);
7843 return SemanticError_clone(&*owner->contents.err);
7845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7846 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7847 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7851 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7852 CHECK(owner->result_ok);
7853 return Description_clone(&*owner->contents.result);
7855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7856 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7857 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7858 int64_t ret_ref = 0;
7859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7862 ret_ref = (uintptr_t)ret_var.inner;
7863 if (ret_var.is_owned) {
7869 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7870 CHECK(!owner->result_ok);
7871 return CreationError_clone(&*owner->contents.err);
7873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7874 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7875 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7879 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7880 CHECK(owner->result_ok);
7881 return PrivateRoute_clone(&*owner->contents.result);
7883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7884 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7885 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7886 int64_t ret_ref = 0;
7887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7890 ret_ref = (uintptr_t)ret_var.inner;
7891 if (ret_var.is_owned) {
7897 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7898 CHECK(!owner->result_ok);
7899 return CreationError_clone(&*owner->contents.err);
7901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7902 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7903 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7907 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7908 CHECK(owner->result_ok);
7909 return *owner->contents.result;
7911 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7912 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7913 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7914 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7918 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7919 CHECK(!owner->result_ok);
7920 return *owner->contents.err;
7922 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7923 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7924 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7928 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7929 CHECK(owner->result_ok);
7930 return ChannelMonitorUpdate_clone(&*owner->contents.result);
7932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7933 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7934 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7935 int64_t ret_ref = 0;
7936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7939 ret_ref = (uintptr_t)ret_var.inner;
7940 if (ret_var.is_owned) {
7946 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7947 CHECK(!owner->result_ok);
7948 return DecodeError_clone(&*owner->contents.err);
7950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7951 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7952 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7953 int64_t ret_ref = 0;
7954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7957 ret_ref = (uintptr_t)ret_var.inner;
7958 if (ret_var.is_owned) {
7964 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7965 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7966 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7967 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7969 LDKCOption_MonitorEventZ_Some_class =
7970 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7971 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7972 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7973 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7974 LDKCOption_MonitorEventZ_None_class =
7975 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7976 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7977 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7978 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7980 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7981 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
7983 case LDKCOption_MonitorEventZ_Some: {
7984 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7985 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7987 case LDKCOption_MonitorEventZ_None: {
7988 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7993 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7994 CHECK(owner->result_ok);
7995 return COption_MonitorEventZ_clone(&*owner->contents.result);
7997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7998 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7999 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8000 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8001 int64_t ret_ref = (uintptr_t)ret_copy;
8005 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8006 CHECK(!owner->result_ok);
8007 return DecodeError_clone(&*owner->contents.err);
8009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8010 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8011 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8012 int64_t ret_ref = 0;
8013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8016 ret_ref = (uintptr_t)ret_var.inner;
8017 if (ret_var.is_owned) {
8023 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8024 CHECK(owner->result_ok);
8025 return HTLCUpdate_clone(&*owner->contents.result);
8027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8028 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8029 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8030 int64_t ret_ref = 0;
8031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8034 ret_ref = (uintptr_t)ret_var.inner;
8035 if (ret_var.is_owned) {
8041 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8042 CHECK(!owner->result_ok);
8043 return DecodeError_clone(&*owner->contents.err);
8045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8046 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8047 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8048 int64_t ret_ref = 0;
8049 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8050 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8052 ret_ref = (uintptr_t)ret_var.inner;
8053 if (ret_var.is_owned) {
8059 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8060 return OutPoint_clone(&owner->a);
8062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8063 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8064 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8065 int64_t ret_ref = 0;
8066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8069 ret_ref = (uintptr_t)ret_var.inner;
8070 if (ret_var.is_owned) {
8076 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8077 return CVec_u8Z_clone(&owner->b);
8079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8080 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8081 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8082 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8083 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8084 CVec_u8Z_free(ret_var);
8088 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8091 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8092 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8093 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8097 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8098 return CVec_u8Z_clone(&owner->b);
8100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8101 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8102 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8103 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8104 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8105 CVec_u8Z_free(ret_var);
8109 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8110 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8111 for (size_t i = 0; i < ret.datalen; i++) {
8112 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8116 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8117 return ThirtyTwoBytes_clone(&owner->a);
8119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8120 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8121 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8122 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8126 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8127 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8129 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8130 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8131 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8132 int64_tArray ret_arr = NULL;
8133 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8134 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8135 for (size_t v = 0; v < ret_var.datalen; v++) {
8136 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8137 *ret_conv_21_conv = ret_var.data[v];
8138 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
8140 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8145 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8146 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 };
8147 for (size_t i = 0; i < ret.datalen; i++) {
8148 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8152 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
8153 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
8154 for (size_t i = 0; i < ret.datalen; i++) {
8155 ret.data[i] = Event_clone(&orig->data[i]);
8159 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8162 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8163 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8164 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8168 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8169 return TxOut_clone(&owner->b);
8171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8172 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8173 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8174 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8175 return (int64_t)ret_ref;
8178 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8179 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8180 for (size_t i = 0; i < ret.datalen; i++) {
8181 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8185 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8186 return ThirtyTwoBytes_clone(&owner->a);
8188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8189 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8190 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8191 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8195 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8196 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8198 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8199 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8200 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8201 int64_tArray ret_arr = NULL;
8202 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8203 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8204 for (size_t u = 0; u < ret_var.datalen; u++) {
8205 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8206 *ret_conv_20_conv = ret_var.data[u];
8207 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
8209 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8214 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8215 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 };
8216 for (size_t i = 0; i < ret.datalen; i++) {
8217 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8221 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8222 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8223 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8224 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8225 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8226 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8227 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
8228 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
8229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8230 LDKBalance_ClaimableOnChannelClose_class =
8231 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8232 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8233 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8234 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8235 LDKBalance_ClaimableAwaitingConfirmations_class =
8236 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8237 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8238 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8239 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8240 LDKBalance_ContentiousClaimable_class =
8241 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8242 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8243 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
8244 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8245 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
8246 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
8247 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
8248 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
8249 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
8251 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8252 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
8254 case LDKBalance_ClaimableOnChannelClose: {
8255 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8256 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8258 case LDKBalance_ClaimableAwaitingConfirmations: {
8259 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8260 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8261 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8263 case LDKBalance_ContentiousClaimable: {
8264 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8265 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8266 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8268 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8269 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8270 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8271 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8276 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8277 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8278 for (size_t i = 0; i < ret.datalen; i++) {
8279 ret.data[i] = Balance_clone(&orig->data[i]);
8283 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8284 CHECK(owner->result_ok);
8285 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8288 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8289 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8290 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8291 return ((int64_t)ret_conv);
8294 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8295 CHECK(!owner->result_ok);
8296 return DecodeError_clone(&*owner->contents.err);
8298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8299 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8300 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8301 int64_t ret_ref = 0;
8302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8305 ret_ref = (uintptr_t)ret_var.inner;
8306 if (ret_var.is_owned) {
8312 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8316 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8317 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8322 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8323 return Type_clone(&owner->b);
8325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8326 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8327 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8328 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8329 return (int64_t)ret_ret;
8332 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8333 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8334 for (size_t i = 0; i < ret.datalen; i++) {
8335 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8339 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8340 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8341 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8342 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8344 LDKCOption_NetAddressZ_Some_class =
8345 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8346 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8347 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8348 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8349 LDKCOption_NetAddressZ_None_class =
8350 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8351 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8352 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8353 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8355 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8356 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
8358 case LDKCOption_NetAddressZ_Some: {
8359 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8360 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8362 case LDKCOption_NetAddressZ_None: {
8363 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8368 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8369 CHECK(owner->result_ok);
8370 return CVec_u8Z_clone(&*owner->contents.result);
8372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8373 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8374 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8375 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8376 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8377 CVec_u8Z_free(ret_var);
8381 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8382 CHECK(!owner->result_ok);
8383 return PeerHandleError_clone(&*owner->contents.err);
8385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8386 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8387 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8388 int64_t ret_ref = 0;
8389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8392 ret_ref = (uintptr_t)ret_var.inner;
8393 if (ret_var.is_owned) {
8399 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8400 CHECK(owner->result_ok);
8401 return *owner->contents.result;
8403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8404 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8405 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8408 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8409 CHECK(!owner->result_ok);
8410 return PeerHandleError_clone(&*owner->contents.err);
8412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8413 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8414 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8415 int64_t ret_ref = 0;
8416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8419 ret_ref = (uintptr_t)ret_var.inner;
8420 if (ret_var.is_owned) {
8426 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8427 CHECK(owner->result_ok);
8428 return *owner->contents.result;
8430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8431 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8432 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8436 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8437 CHECK(!owner->result_ok);
8438 return PeerHandleError_clone(&*owner->contents.err);
8440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8441 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8442 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8443 int64_t ret_ref = 0;
8444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8447 ret_ref = (uintptr_t)ret_var.inner;
8448 if (ret_var.is_owned) {
8454 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8455 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8456 static jclass LDKGraphSyncError_LightningError_class = NULL;
8457 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8459 LDKGraphSyncError_DecodeError_class =
8460 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8461 CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8462 LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8463 CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8464 LDKGraphSyncError_LightningError_class =
8465 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8466 CHECK(LDKGraphSyncError_LightningError_class != NULL);
8467 LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8468 CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8470 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8471 LDKGraphSyncError *obj = (LDKGraphSyncError*)(ptr & ~1);
8473 case LDKGraphSyncError_DecodeError: {
8474 LDKDecodeError decode_error_var = obj->decode_error;
8475 int64_t decode_error_ref = 0;
8476 CHECK((((uintptr_t)decode_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8477 CHECK((((uintptr_t)&decode_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8478 CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8479 decode_error_ref = (uintptr_t)decode_error_var.inner & ~1;
8480 return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8482 case LDKGraphSyncError_LightningError: {
8483 LDKLightningError lightning_error_var = obj->lightning_error;
8484 int64_t lightning_error_ref = 0;
8485 CHECK((((uintptr_t)lightning_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8486 CHECK((((uintptr_t)&lightning_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8487 CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8488 lightning_error_ref = (uintptr_t)lightning_error_var.inner & ~1;
8489 return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8494 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8495 CHECK(owner->result_ok);
8496 return *owner->contents.result;
8498 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8499 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8500 int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8504 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8505 CHECK(!owner->result_ok);
8506 return GraphSyncError_clone(&*owner->contents.err);
8508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8509 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8510 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8511 *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8512 int64_t ret_ref = (uintptr_t)ret_copy;
8516 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8517 CHECK(owner->result_ok);
8518 return NetAddress_clone(&*owner->contents.result);
8520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8521 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8522 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8523 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8524 int64_t ret_ref = (uintptr_t)ret_copy;
8528 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8529 CHECK(!owner->result_ok);
8530 return DecodeError_clone(&*owner->contents.err);
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8533 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8534 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8535 int64_t ret_ref = 0;
8536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8539 ret_ref = (uintptr_t)ret_var.inner;
8540 if (ret_var.is_owned) {
8546 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8547 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8548 for (size_t i = 0; i < ret.datalen; i++) {
8549 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8553 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8554 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8555 for (size_t i = 0; i < ret.datalen; i++) {
8556 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8560 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8561 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8562 for (size_t i = 0; i < ret.datalen; i++) {
8563 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8567 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8568 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8569 for (size_t i = 0; i < ret.datalen; i++) {
8570 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8574 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8575 CHECK(owner->result_ok);
8576 return AcceptChannel_clone(&*owner->contents.result);
8578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8579 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8580 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8581 int64_t ret_ref = 0;
8582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8585 ret_ref = (uintptr_t)ret_var.inner;
8586 if (ret_var.is_owned) {
8592 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8593 CHECK(!owner->result_ok);
8594 return DecodeError_clone(&*owner->contents.err);
8596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8597 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8598 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8599 int64_t ret_ref = 0;
8600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8603 ret_ref = (uintptr_t)ret_var.inner;
8604 if (ret_var.is_owned) {
8610 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8611 CHECK(owner->result_ok);
8612 return AnnouncementSignatures_clone(&*owner->contents.result);
8614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8615 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8616 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8617 int64_t ret_ref = 0;
8618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8621 ret_ref = (uintptr_t)ret_var.inner;
8622 if (ret_var.is_owned) {
8628 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8629 CHECK(!owner->result_ok);
8630 return DecodeError_clone(&*owner->contents.err);
8632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8633 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8634 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8635 int64_t ret_ref = 0;
8636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8639 ret_ref = (uintptr_t)ret_var.inner;
8640 if (ret_var.is_owned) {
8646 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8647 CHECK(owner->result_ok);
8648 return ChannelReestablish_clone(&*owner->contents.result);
8650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8651 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8652 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8653 int64_t ret_ref = 0;
8654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8657 ret_ref = (uintptr_t)ret_var.inner;
8658 if (ret_var.is_owned) {
8664 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8665 CHECK(!owner->result_ok);
8666 return DecodeError_clone(&*owner->contents.err);
8668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8669 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8670 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8671 int64_t ret_ref = 0;
8672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8675 ret_ref = (uintptr_t)ret_var.inner;
8676 if (ret_var.is_owned) {
8682 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8683 CHECK(owner->result_ok);
8684 return ClosingSigned_clone(&*owner->contents.result);
8686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8687 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8688 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8689 int64_t ret_ref = 0;
8690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8693 ret_ref = (uintptr_t)ret_var.inner;
8694 if (ret_var.is_owned) {
8700 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8701 CHECK(!owner->result_ok);
8702 return DecodeError_clone(&*owner->contents.err);
8704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8705 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8706 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8707 int64_t ret_ref = 0;
8708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8711 ret_ref = (uintptr_t)ret_var.inner;
8712 if (ret_var.is_owned) {
8718 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8719 CHECK(owner->result_ok);
8720 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8723 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8724 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8725 int64_t ret_ref = 0;
8726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8729 ret_ref = (uintptr_t)ret_var.inner;
8730 if (ret_var.is_owned) {
8736 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8737 CHECK(!owner->result_ok);
8738 return DecodeError_clone(&*owner->contents.err);
8740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8741 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8742 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8743 int64_t ret_ref = 0;
8744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8747 ret_ref = (uintptr_t)ret_var.inner;
8748 if (ret_var.is_owned) {
8754 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8755 CHECK(owner->result_ok);
8756 return CommitmentSigned_clone(&*owner->contents.result);
8758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8759 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8760 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8761 int64_t ret_ref = 0;
8762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8765 ret_ref = (uintptr_t)ret_var.inner;
8766 if (ret_var.is_owned) {
8772 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8773 CHECK(!owner->result_ok);
8774 return DecodeError_clone(&*owner->contents.err);
8776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8777 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8778 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8779 int64_t ret_ref = 0;
8780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8783 ret_ref = (uintptr_t)ret_var.inner;
8784 if (ret_var.is_owned) {
8790 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8791 CHECK(owner->result_ok);
8792 return FundingCreated_clone(&*owner->contents.result);
8794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8795 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8796 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8797 int64_t ret_ref = 0;
8798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8801 ret_ref = (uintptr_t)ret_var.inner;
8802 if (ret_var.is_owned) {
8808 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8809 CHECK(!owner->result_ok);
8810 return DecodeError_clone(&*owner->contents.err);
8812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8813 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8814 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8815 int64_t ret_ref = 0;
8816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8819 ret_ref = (uintptr_t)ret_var.inner;
8820 if (ret_var.is_owned) {
8826 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8827 CHECK(owner->result_ok);
8828 return FundingSigned_clone(&*owner->contents.result);
8830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8831 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8832 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8833 int64_t ret_ref = 0;
8834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8837 ret_ref = (uintptr_t)ret_var.inner;
8838 if (ret_var.is_owned) {
8844 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8845 CHECK(!owner->result_ok);
8846 return DecodeError_clone(&*owner->contents.err);
8848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8849 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8850 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8851 int64_t ret_ref = 0;
8852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8855 ret_ref = (uintptr_t)ret_var.inner;
8856 if (ret_var.is_owned) {
8862 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8863 CHECK(owner->result_ok);
8864 return ChannelReady_clone(&*owner->contents.result);
8866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8867 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
8868 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8869 int64_t ret_ref = 0;
8870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8873 ret_ref = (uintptr_t)ret_var.inner;
8874 if (ret_var.is_owned) {
8880 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8881 CHECK(!owner->result_ok);
8882 return DecodeError_clone(&*owner->contents.err);
8884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8885 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
8886 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8887 int64_t ret_ref = 0;
8888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8891 ret_ref = (uintptr_t)ret_var.inner;
8892 if (ret_var.is_owned) {
8898 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8899 CHECK(owner->result_ok);
8900 return Init_clone(&*owner->contents.result);
8902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8903 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8904 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8905 int64_t ret_ref = 0;
8906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8909 ret_ref = (uintptr_t)ret_var.inner;
8910 if (ret_var.is_owned) {
8916 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8917 CHECK(!owner->result_ok);
8918 return DecodeError_clone(&*owner->contents.err);
8920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8921 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8922 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8923 int64_t ret_ref = 0;
8924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8927 ret_ref = (uintptr_t)ret_var.inner;
8928 if (ret_var.is_owned) {
8934 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8935 CHECK(owner->result_ok);
8936 return OpenChannel_clone(&*owner->contents.result);
8938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8939 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8940 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8941 int64_t ret_ref = 0;
8942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8945 ret_ref = (uintptr_t)ret_var.inner;
8946 if (ret_var.is_owned) {
8952 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8953 CHECK(!owner->result_ok);
8954 return DecodeError_clone(&*owner->contents.err);
8956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8957 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8958 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8959 int64_t ret_ref = 0;
8960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8963 ret_ref = (uintptr_t)ret_var.inner;
8964 if (ret_var.is_owned) {
8970 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8971 CHECK(owner->result_ok);
8972 return RevokeAndACK_clone(&*owner->contents.result);
8974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8975 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8976 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8977 int64_t ret_ref = 0;
8978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8981 ret_ref = (uintptr_t)ret_var.inner;
8982 if (ret_var.is_owned) {
8988 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8989 CHECK(!owner->result_ok);
8990 return DecodeError_clone(&*owner->contents.err);
8992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8993 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8994 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8995 int64_t ret_ref = 0;
8996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8999 ret_ref = (uintptr_t)ret_var.inner;
9000 if (ret_var.is_owned) {
9006 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9007 CHECK(owner->result_ok);
9008 return Shutdown_clone(&*owner->contents.result);
9010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9011 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9012 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9013 int64_t ret_ref = 0;
9014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9017 ret_ref = (uintptr_t)ret_var.inner;
9018 if (ret_var.is_owned) {
9024 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9025 CHECK(!owner->result_ok);
9026 return DecodeError_clone(&*owner->contents.err);
9028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9029 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9030 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9031 int64_t ret_ref = 0;
9032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9035 ret_ref = (uintptr_t)ret_var.inner;
9036 if (ret_var.is_owned) {
9042 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9043 CHECK(owner->result_ok);
9044 return UpdateFailHTLC_clone(&*owner->contents.result);
9046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9047 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9048 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9049 int64_t ret_ref = 0;
9050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9053 ret_ref = (uintptr_t)ret_var.inner;
9054 if (ret_var.is_owned) {
9060 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9061 CHECK(!owner->result_ok);
9062 return DecodeError_clone(&*owner->contents.err);
9064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9065 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9066 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9067 int64_t ret_ref = 0;
9068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9071 ret_ref = (uintptr_t)ret_var.inner;
9072 if (ret_var.is_owned) {
9078 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9079 CHECK(owner->result_ok);
9080 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
9082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9083 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9084 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9085 int64_t ret_ref = 0;
9086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9089 ret_ref = (uintptr_t)ret_var.inner;
9090 if (ret_var.is_owned) {
9096 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9097 CHECK(!owner->result_ok);
9098 return DecodeError_clone(&*owner->contents.err);
9100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9101 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9102 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9103 int64_t ret_ref = 0;
9104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9107 ret_ref = (uintptr_t)ret_var.inner;
9108 if (ret_var.is_owned) {
9114 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9115 CHECK(owner->result_ok);
9116 return UpdateFee_clone(&*owner->contents.result);
9118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9119 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9120 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9121 int64_t ret_ref = 0;
9122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9125 ret_ref = (uintptr_t)ret_var.inner;
9126 if (ret_var.is_owned) {
9132 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9133 CHECK(!owner->result_ok);
9134 return DecodeError_clone(&*owner->contents.err);
9136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9137 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9138 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9139 int64_t ret_ref = 0;
9140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9143 ret_ref = (uintptr_t)ret_var.inner;
9144 if (ret_var.is_owned) {
9150 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9151 CHECK(owner->result_ok);
9152 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9155 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9156 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9157 int64_t ret_ref = 0;
9158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9161 ret_ref = (uintptr_t)ret_var.inner;
9162 if (ret_var.is_owned) {
9168 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9169 CHECK(!owner->result_ok);
9170 return DecodeError_clone(&*owner->contents.err);
9172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9173 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9174 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9175 int64_t ret_ref = 0;
9176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9179 ret_ref = (uintptr_t)ret_var.inner;
9180 if (ret_var.is_owned) {
9186 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9187 CHECK(owner->result_ok);
9188 return UpdateAddHTLC_clone(&*owner->contents.result);
9190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9191 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9192 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9193 int64_t ret_ref = 0;
9194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9197 ret_ref = (uintptr_t)ret_var.inner;
9198 if (ret_var.is_owned) {
9204 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9205 CHECK(!owner->result_ok);
9206 return DecodeError_clone(&*owner->contents.err);
9208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9209 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9210 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9211 int64_t ret_ref = 0;
9212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9215 ret_ref = (uintptr_t)ret_var.inner;
9216 if (ret_var.is_owned) {
9222 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9223 CHECK(owner->result_ok);
9224 return Ping_clone(&*owner->contents.result);
9226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9227 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9228 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9229 int64_t ret_ref = 0;
9230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9233 ret_ref = (uintptr_t)ret_var.inner;
9234 if (ret_var.is_owned) {
9240 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9241 CHECK(!owner->result_ok);
9242 return DecodeError_clone(&*owner->contents.err);
9244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9245 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9246 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9247 int64_t ret_ref = 0;
9248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9251 ret_ref = (uintptr_t)ret_var.inner;
9252 if (ret_var.is_owned) {
9258 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9259 CHECK(owner->result_ok);
9260 return Pong_clone(&*owner->contents.result);
9262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9263 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9264 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9265 int64_t ret_ref = 0;
9266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9269 ret_ref = (uintptr_t)ret_var.inner;
9270 if (ret_var.is_owned) {
9276 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9277 CHECK(!owner->result_ok);
9278 return DecodeError_clone(&*owner->contents.err);
9280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9281 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9282 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9283 int64_t ret_ref = 0;
9284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9287 ret_ref = (uintptr_t)ret_var.inner;
9288 if (ret_var.is_owned) {
9294 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9295 CHECK(owner->result_ok);
9296 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9299 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9300 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9301 int64_t ret_ref = 0;
9302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9305 ret_ref = (uintptr_t)ret_var.inner;
9306 if (ret_var.is_owned) {
9312 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9313 CHECK(!owner->result_ok);
9314 return DecodeError_clone(&*owner->contents.err);
9316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9317 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9318 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9319 int64_t ret_ref = 0;
9320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9323 ret_ref = (uintptr_t)ret_var.inner;
9324 if (ret_var.is_owned) {
9330 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9331 CHECK(owner->result_ok);
9332 return ChannelAnnouncement_clone(&*owner->contents.result);
9334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9335 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9336 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9337 int64_t ret_ref = 0;
9338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9341 ret_ref = (uintptr_t)ret_var.inner;
9342 if (ret_var.is_owned) {
9348 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9349 CHECK(!owner->result_ok);
9350 return DecodeError_clone(&*owner->contents.err);
9352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9353 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9354 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9355 int64_t ret_ref = 0;
9356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9359 ret_ref = (uintptr_t)ret_var.inner;
9360 if (ret_var.is_owned) {
9366 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9367 CHECK(owner->result_ok);
9368 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9371 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9372 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9373 int64_t ret_ref = 0;
9374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9377 ret_ref = (uintptr_t)ret_var.inner;
9378 if (ret_var.is_owned) {
9384 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9385 CHECK(!owner->result_ok);
9386 return DecodeError_clone(&*owner->contents.err);
9388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9389 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9390 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9391 int64_t ret_ref = 0;
9392 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9393 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9395 ret_ref = (uintptr_t)ret_var.inner;
9396 if (ret_var.is_owned) {
9402 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9403 CHECK(owner->result_ok);
9404 return ChannelUpdate_clone(&*owner->contents.result);
9406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9407 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9408 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9409 int64_t ret_ref = 0;
9410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9413 ret_ref = (uintptr_t)ret_var.inner;
9414 if (ret_var.is_owned) {
9420 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9421 CHECK(!owner->result_ok);
9422 return DecodeError_clone(&*owner->contents.err);
9424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9425 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9426 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9427 int64_t ret_ref = 0;
9428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9431 ret_ref = (uintptr_t)ret_var.inner;
9432 if (ret_var.is_owned) {
9438 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9439 CHECK(owner->result_ok);
9440 return ErrorMessage_clone(&*owner->contents.result);
9442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9443 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9444 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9445 int64_t ret_ref = 0;
9446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9449 ret_ref = (uintptr_t)ret_var.inner;
9450 if (ret_var.is_owned) {
9456 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9457 CHECK(!owner->result_ok);
9458 return DecodeError_clone(&*owner->contents.err);
9460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9461 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9462 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9463 int64_t ret_ref = 0;
9464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9467 ret_ref = (uintptr_t)ret_var.inner;
9468 if (ret_var.is_owned) {
9474 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9475 CHECK(owner->result_ok);
9476 return WarningMessage_clone(&*owner->contents.result);
9478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9479 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9480 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9481 int64_t ret_ref = 0;
9482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9485 ret_ref = (uintptr_t)ret_var.inner;
9486 if (ret_var.is_owned) {
9492 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9493 CHECK(!owner->result_ok);
9494 return DecodeError_clone(&*owner->contents.err);
9496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9497 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9498 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9499 int64_t ret_ref = 0;
9500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9503 ret_ref = (uintptr_t)ret_var.inner;
9504 if (ret_var.is_owned) {
9510 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9511 CHECK(owner->result_ok);
9512 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9515 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9516 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9517 int64_t ret_ref = 0;
9518 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9519 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9521 ret_ref = (uintptr_t)ret_var.inner;
9522 if (ret_var.is_owned) {
9528 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9529 CHECK(!owner->result_ok);
9530 return DecodeError_clone(&*owner->contents.err);
9532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9533 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9534 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9535 int64_t ret_ref = 0;
9536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9539 ret_ref = (uintptr_t)ret_var.inner;
9540 if (ret_var.is_owned) {
9546 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9547 CHECK(owner->result_ok);
9548 return NodeAnnouncement_clone(&*owner->contents.result);
9550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9551 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9552 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9553 int64_t ret_ref = 0;
9554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9557 ret_ref = (uintptr_t)ret_var.inner;
9558 if (ret_var.is_owned) {
9564 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9565 CHECK(!owner->result_ok);
9566 return DecodeError_clone(&*owner->contents.err);
9568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9569 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9570 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9571 int64_t ret_ref = 0;
9572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9575 ret_ref = (uintptr_t)ret_var.inner;
9576 if (ret_var.is_owned) {
9582 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9583 CHECK(owner->result_ok);
9584 return QueryShortChannelIds_clone(&*owner->contents.result);
9586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9587 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9588 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9589 int64_t ret_ref = 0;
9590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9593 ret_ref = (uintptr_t)ret_var.inner;
9594 if (ret_var.is_owned) {
9600 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9601 CHECK(!owner->result_ok);
9602 return DecodeError_clone(&*owner->contents.err);
9604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9605 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9606 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9607 int64_t ret_ref = 0;
9608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9611 ret_ref = (uintptr_t)ret_var.inner;
9612 if (ret_var.is_owned) {
9618 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9619 CHECK(owner->result_ok);
9620 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9623 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9624 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9625 int64_t ret_ref = 0;
9626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9629 ret_ref = (uintptr_t)ret_var.inner;
9630 if (ret_var.is_owned) {
9636 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9637 CHECK(!owner->result_ok);
9638 return DecodeError_clone(&*owner->contents.err);
9640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9641 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9642 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9643 int64_t ret_ref = 0;
9644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9647 ret_ref = (uintptr_t)ret_var.inner;
9648 if (ret_var.is_owned) {
9654 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9655 CHECK(owner->result_ok);
9656 return QueryChannelRange_clone(&*owner->contents.result);
9658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9659 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9660 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9661 int64_t ret_ref = 0;
9662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9665 ret_ref = (uintptr_t)ret_var.inner;
9666 if (ret_var.is_owned) {
9672 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9673 CHECK(!owner->result_ok);
9674 return DecodeError_clone(&*owner->contents.err);
9676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9677 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9678 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9679 int64_t ret_ref = 0;
9680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9683 ret_ref = (uintptr_t)ret_var.inner;
9684 if (ret_var.is_owned) {
9690 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9691 CHECK(owner->result_ok);
9692 return ReplyChannelRange_clone(&*owner->contents.result);
9694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9695 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9696 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9697 int64_t ret_ref = 0;
9698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9701 ret_ref = (uintptr_t)ret_var.inner;
9702 if (ret_var.is_owned) {
9708 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9709 CHECK(!owner->result_ok);
9710 return DecodeError_clone(&*owner->contents.err);
9712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9713 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9714 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9715 int64_t ret_ref = 0;
9716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9719 ret_ref = (uintptr_t)ret_var.inner;
9720 if (ret_var.is_owned) {
9726 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9727 CHECK(owner->result_ok);
9728 return GossipTimestampFilter_clone(&*owner->contents.result);
9730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9731 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9732 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9733 int64_t ret_ref = 0;
9734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9737 ret_ref = (uintptr_t)ret_var.inner;
9738 if (ret_var.is_owned) {
9744 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9745 CHECK(!owner->result_ok);
9746 return DecodeError_clone(&*owner->contents.err);
9748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9749 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9750 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9751 int64_t ret_ref = 0;
9752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9755 ret_ref = (uintptr_t)ret_var.inner;
9756 if (ret_var.is_owned) {
9762 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9763 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9764 for (size_t i = 0; i < ret.datalen; i++) {
9765 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9769 static jclass LDKSignOrCreationError_SignError_class = NULL;
9770 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9771 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9772 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9774 LDKSignOrCreationError_SignError_class =
9775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9776 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9777 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9778 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9779 LDKSignOrCreationError_CreationError_class =
9780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9781 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9782 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9783 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9785 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9786 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9788 case LDKSignOrCreationError_SignError: {
9789 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9791 case LDKSignOrCreationError_CreationError: {
9792 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9793 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9798 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9799 CHECK(owner->result_ok);
9800 return Invoice_clone(&*owner->contents.result);
9802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9803 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9804 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9805 int64_t ret_ref = 0;
9806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9809 ret_ref = (uintptr_t)ret_var.inner;
9810 if (ret_var.is_owned) {
9816 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9817 CHECK(!owner->result_ok);
9818 return SignOrCreationError_clone(&*owner->contents.err);
9820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9821 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9822 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9823 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9824 int64_t ret_ref = (uintptr_t)ret_copy;
9828 typedef struct LDKFilter_JCalls {
9829 atomic_size_t refcnt;
9832 jmethodID register_tx_meth;
9833 jmethodID register_output_meth;
9835 static void LDKFilter_JCalls_free(void* this_arg) {
9836 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9837 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9839 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9840 if (get_jenv_res == JNI_EDETACHED) {
9841 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9843 DO_ASSERT(get_jenv_res == JNI_OK);
9845 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9846 if (get_jenv_res == JNI_EDETACHED) {
9847 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9852 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9853 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9855 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9856 if (get_jenv_res == JNI_EDETACHED) {
9857 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9859 DO_ASSERT(get_jenv_res == JNI_OK);
9861 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9862 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9863 LDKu8slice script_pubkey_var = script_pubkey;
9864 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9865 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9866 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9868 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9869 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9870 (*env)->ExceptionDescribe(env);
9871 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9873 if (get_jenv_res == JNI_EDETACHED) {
9874 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9877 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9878 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9880 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9881 if (get_jenv_res == JNI_EDETACHED) {
9882 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9884 DO_ASSERT(get_jenv_res == JNI_OK);
9886 LDKWatchedOutput output_var = output;
9887 int64_t output_ref = 0;
9888 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9889 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9890 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9891 output_ref = (uintptr_t)output_var.inner;
9892 if (output_var.is_owned) {
9895 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9897 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9898 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9899 (*env)->ExceptionDescribe(env);
9900 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9902 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9903 CHECK_ACCESS(ret_ptr);
9904 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9906 if (get_jenv_res == JNI_EDETACHED) {
9907 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9911 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9912 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9913 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9915 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9916 jclass c = (*env)->GetObjectClass(env, o);
9918 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9919 atomic_init(&calls->refcnt, 1);
9920 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9921 calls->o = (*env)->NewWeakGlobalRef(env, o);
9922 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9923 CHECK(calls->register_tx_meth != NULL);
9924 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9925 CHECK(calls->register_output_meth != NULL);
9928 .this_arg = (void*) calls,
9929 .register_tx = register_tx_LDKFilter_jcall,
9930 .register_output = register_output_LDKFilter_jcall,
9931 .free = LDKFilter_JCalls_free,
9935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9936 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9937 *res_ptr = LDKFilter_init(env, clz, o);
9938 return (uint64_t)res_ptr;
9940 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) {
9941 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9942 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9943 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9944 unsigned char txid_arr[32];
9945 CHECK((*env)->GetArrayLength(env, txid) == 32);
9946 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9947 unsigned char (*txid_ref)[32] = &txid_arr;
9948 LDKu8slice script_pubkey_ref;
9949 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9950 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9951 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9952 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9956 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9957 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9958 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9959 LDKWatchedOutput output_conv;
9960 output_conv.inner = (void*)(output & (~1));
9961 output_conv.is_owned = (output & 1) || (output == 0);
9962 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9963 output_conv = WatchedOutput_clone(&output_conv);
9964 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9965 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9966 int64_t ret_ref = (uintptr_t)ret_copy;
9970 static jclass LDKCOption_FilterZ_Some_class = NULL;
9971 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9972 static jclass LDKCOption_FilterZ_None_class = NULL;
9973 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9975 LDKCOption_FilterZ_Some_class =
9976 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9977 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9978 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9979 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9980 LDKCOption_FilterZ_None_class =
9981 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9982 CHECK(LDKCOption_FilterZ_None_class != NULL);
9983 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9984 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9986 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9987 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9989 case LDKCOption_FilterZ_Some: {
9990 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9991 *some_ret = obj->some;
9992 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9993 if ((*some_ret).free == LDKFilter_JCalls_free) {
9994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9995 LDKFilter_JCalls_cloned(&(*some_ret));
9997 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
9999 case LDKCOption_FilterZ_None: {
10000 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
10005 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10006 CHECK(owner->result_ok);
10007 return &*owner->contents.result;
10009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10010 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10011 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10012 int64_t ret_ref = 0;
10013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10016 ret_ref = (uintptr_t)ret_var.inner & ~1;
10020 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10021 CHECK(!owner->result_ok);
10022 return *owner->contents.err;
10024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10025 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10026 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10029 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10030 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10031 for (size_t i = 0; i < ret.datalen; i++) {
10032 ret.data[i] = OutPoint_clone(&orig->data[i]);
10036 typedef struct LDKMessageSendEventsProvider_JCalls {
10037 atomic_size_t refcnt;
10040 jmethodID get_and_clear_pending_msg_events_meth;
10041 } LDKMessageSendEventsProvider_JCalls;
10042 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
10043 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10044 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10046 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10047 if (get_jenv_res == JNI_EDETACHED) {
10048 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10050 DO_ASSERT(get_jenv_res == JNI_OK);
10052 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10053 if (get_jenv_res == JNI_EDETACHED) {
10054 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10059 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
10060 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10062 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10063 if (get_jenv_res == JNI_EDETACHED) {
10064 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10066 DO_ASSERT(get_jenv_res == JNI_OK);
10068 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10069 CHECK(obj != NULL);
10070 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
10071 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10072 (*env)->ExceptionDescribe(env);
10073 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
10075 LDKCVec_MessageSendEventZ ret_constr;
10076 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10077 if (ret_constr.datalen > 0)
10078 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10080 ret_constr.data = NULL;
10081 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10082 for (size_t s = 0; s < ret_constr.datalen; s++) {
10083 int64_t ret_conv_18 = ret_vals[s];
10084 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
10085 CHECK_ACCESS(ret_conv_18_ptr);
10086 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10087 FREE((void*)ret_conv_18);
10088 ret_constr.data[s] = ret_conv_18_conv;
10090 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10091 if (get_jenv_res == JNI_EDETACHED) {
10092 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10096 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10097 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10098 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10100 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10101 jclass c = (*env)->GetObjectClass(env, o);
10103 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10104 atomic_init(&calls->refcnt, 1);
10105 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10106 calls->o = (*env)->NewWeakGlobalRef(env, o);
10107 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10108 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10110 LDKMessageSendEventsProvider ret = {
10111 .this_arg = (void*) calls,
10112 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10113 .free = LDKMessageSendEventsProvider_JCalls_free,
10117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10118 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10119 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10120 return (uint64_t)res_ptr;
10122 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10123 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10124 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10125 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10126 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10127 int64_tArray ret_arr = NULL;
10128 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10129 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10130 for (size_t s = 0; s < ret_var.datalen; s++) {
10131 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10132 *ret_conv_18_copy = ret_var.data[s];
10133 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
10134 ret_arr_ptr[s] = ret_conv_18_ref;
10136 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10137 FREE(ret_var.data);
10141 typedef struct LDKEventHandler_JCalls {
10142 atomic_size_t refcnt;
10145 jmethodID handle_event_meth;
10146 } LDKEventHandler_JCalls;
10147 static void LDKEventHandler_JCalls_free(void* this_arg) {
10148 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10149 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10151 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10152 if (get_jenv_res == JNI_EDETACHED) {
10153 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10155 DO_ASSERT(get_jenv_res == JNI_OK);
10157 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10158 if (get_jenv_res == JNI_EDETACHED) {
10159 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10164 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10165 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10167 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10168 if (get_jenv_res == JNI_EDETACHED) {
10169 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10171 DO_ASSERT(get_jenv_res == JNI_OK);
10173 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10174 *ret_event = Event_clone(event);
10175 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10176 CHECK(obj != NULL);
10177 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10178 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10179 (*env)->ExceptionDescribe(env);
10180 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10182 if (get_jenv_res == JNI_EDETACHED) {
10183 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10186 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10187 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10188 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10190 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10191 jclass c = (*env)->GetObjectClass(env, o);
10193 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10194 atomic_init(&calls->refcnt, 1);
10195 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10196 calls->o = (*env)->NewWeakGlobalRef(env, o);
10197 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10198 CHECK(calls->handle_event_meth != NULL);
10200 LDKEventHandler ret = {
10201 .this_arg = (void*) calls,
10202 .handle_event = handle_event_LDKEventHandler_jcall,
10203 .free = LDKEventHandler_JCalls_free,
10207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10208 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10209 *res_ptr = LDKEventHandler_init(env, clz, o);
10210 return (uint64_t)res_ptr;
10212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10213 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10214 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10215 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10216 LDKEvent* event_conv = (LDKEvent*)event;
10217 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10220 typedef struct LDKEventsProvider_JCalls {
10221 atomic_size_t refcnt;
10224 jmethodID process_pending_events_meth;
10225 } LDKEventsProvider_JCalls;
10226 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10227 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10228 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10230 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10231 if (get_jenv_res == JNI_EDETACHED) {
10232 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10234 DO_ASSERT(get_jenv_res == JNI_OK);
10236 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10237 if (get_jenv_res == JNI_EDETACHED) {
10238 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10243 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10244 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10246 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10247 if (get_jenv_res == JNI_EDETACHED) {
10248 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10250 DO_ASSERT(get_jenv_res == JNI_OK);
10252 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10253 *handler_ret = handler;
10254 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10255 CHECK(obj != NULL);
10256 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10257 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10258 (*env)->ExceptionDescribe(env);
10259 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10261 if (get_jenv_res == JNI_EDETACHED) {
10262 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10265 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10266 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10267 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10269 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10270 jclass c = (*env)->GetObjectClass(env, o);
10272 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10273 atomic_init(&calls->refcnt, 1);
10274 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10275 calls->o = (*env)->NewWeakGlobalRef(env, o);
10276 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10277 CHECK(calls->process_pending_events_meth != NULL);
10279 LDKEventsProvider ret = {
10280 .this_arg = (void*) calls,
10281 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10282 .free = LDKEventsProvider_JCalls_free,
10286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10287 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10288 *res_ptr = LDKEventsProvider_init(env, clz, o);
10289 return (uint64_t)res_ptr;
10291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10292 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10294 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10295 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10296 CHECK_ACCESS(handler_ptr);
10297 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10298 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10300 LDKEventHandler_JCalls_cloned(&handler_conv);
10302 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10305 typedef struct LDKScore_JCalls {
10306 atomic_size_t refcnt;
10309 jmethodID channel_penalty_msat_meth;
10310 jmethodID payment_path_failed_meth;
10311 jmethodID payment_path_successful_meth;
10312 jmethodID write_meth;
10314 static void LDKScore_JCalls_free(void* this_arg) {
10315 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10316 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10318 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10319 if (get_jenv_res == JNI_EDETACHED) {
10320 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10322 DO_ASSERT(get_jenv_res == JNI_OK);
10324 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10325 if (get_jenv_res == JNI_EDETACHED) {
10326 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10331 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
10332 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10334 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10335 if (get_jenv_res == JNI_EDETACHED) {
10336 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10338 DO_ASSERT(get_jenv_res == JNI_OK);
10340 int64_t short_channel_id_conv = short_channel_id;
10341 LDKNodeId source_var = *source;
10342 int64_t source_ref = 0;
10343 source_var = NodeId_clone(&source_var);
10344 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10345 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10346 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10347 source_ref = (uintptr_t)source_var.inner;
10348 if (source_var.is_owned) {
10351 LDKNodeId target_var = *target;
10352 int64_t target_ref = 0;
10353 target_var = NodeId_clone(&target_var);
10354 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10355 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10356 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10357 target_ref = (uintptr_t)target_var.inner;
10358 if (target_var.is_owned) {
10361 LDKChannelUsage usage_var = usage;
10362 int64_t usage_ref = 0;
10363 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10364 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10365 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10366 usage_ref = (uintptr_t)usage_var.inner;
10367 if (usage_var.is_owned) {
10370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10371 CHECK(obj != NULL);
10372 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
10373 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10374 (*env)->ExceptionDescribe(env);
10375 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10377 if (get_jenv_res == JNI_EDETACHED) {
10378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10382 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10383 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10385 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10386 if (get_jenv_res == JNI_EDETACHED) {
10387 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10389 DO_ASSERT(get_jenv_res == JNI_OK);
10391 LDKCVec_RouteHopZ path_var = path;
10392 int64_tArray path_arr = NULL;
10393 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10394 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10395 for (size_t k = 0; k < path_var.datalen; k++) {
10396 LDKRouteHop path_conv_10_var = path_var.data[k];
10397 int64_t path_conv_10_ref = 0;
10398 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10399 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10400 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10401 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10402 if (path_conv_10_var.is_owned) {
10403 path_conv_10_ref |= 1;
10405 path_arr_ptr[k] = path_conv_10_ref;
10407 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10408 FREE(path_var.data);
10409 int64_t short_channel_id_conv = short_channel_id;
10410 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10411 CHECK(obj != NULL);
10412 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
10413 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10414 (*env)->ExceptionDescribe(env);
10415 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10417 if (get_jenv_res == JNI_EDETACHED) {
10418 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10421 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10422 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10424 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10425 if (get_jenv_res == JNI_EDETACHED) {
10426 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10428 DO_ASSERT(get_jenv_res == JNI_OK);
10430 LDKCVec_RouteHopZ path_var = path;
10431 int64_tArray path_arr = NULL;
10432 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10433 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10434 for (size_t k = 0; k < path_var.datalen; k++) {
10435 LDKRouteHop path_conv_10_var = path_var.data[k];
10436 int64_t path_conv_10_ref = 0;
10437 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10438 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10439 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10440 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10441 if (path_conv_10_var.is_owned) {
10442 path_conv_10_ref |= 1;
10444 path_arr_ptr[k] = path_conv_10_ref;
10446 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10447 FREE(path_var.data);
10448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10449 CHECK(obj != NULL);
10450 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
10451 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10452 (*env)->ExceptionDescribe(env);
10453 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
10455 if (get_jenv_res == JNI_EDETACHED) {
10456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10459 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10460 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10462 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10463 if (get_jenv_res == JNI_EDETACHED) {
10464 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10466 DO_ASSERT(get_jenv_res == JNI_OK);
10468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10469 CHECK(obj != NULL);
10470 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10471 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10472 (*env)->ExceptionDescribe(env);
10473 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10475 LDKCVec_u8Z ret_ref;
10476 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10477 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10478 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10479 if (get_jenv_res == JNI_EDETACHED) {
10480 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10484 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10485 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10486 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10488 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10489 jclass c = (*env)->GetObjectClass(env, o);
10491 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10492 atomic_init(&calls->refcnt, 1);
10493 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10494 calls->o = (*env)->NewWeakGlobalRef(env, o);
10495 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
10496 CHECK(calls->channel_penalty_msat_meth != NULL);
10497 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10498 CHECK(calls->payment_path_failed_meth != NULL);
10499 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
10500 CHECK(calls->payment_path_successful_meth != NULL);
10501 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10502 CHECK(calls->write_meth != NULL);
10505 .this_arg = (void*) calls,
10506 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10507 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10508 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10509 .write = write_LDKScore_jcall,
10510 .free = LDKScore_JCalls_free,
10514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10515 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10516 *res_ptr = LDKScore_init(env, clz, o);
10517 return (uint64_t)res_ptr;
10519 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) {
10520 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10521 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10522 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10523 LDKNodeId source_conv;
10524 source_conv.inner = (void*)(source & (~1));
10525 source_conv.is_owned = false;
10526 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10527 LDKNodeId target_conv;
10528 target_conv.inner = (void*)(target & (~1));
10529 target_conv.is_owned = false;
10530 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10531 LDKChannelUsage usage_conv;
10532 usage_conv.inner = (void*)(usage & (~1));
10533 usage_conv.is_owned = (usage & 1) || (usage == 0);
10534 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10535 usage_conv = ChannelUsage_clone(&usage_conv);
10536 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10540 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) {
10541 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10542 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10543 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10544 LDKCVec_RouteHopZ path_constr;
10545 path_constr.datalen = (*env)->GetArrayLength(env, path);
10546 if (path_constr.datalen > 0)
10547 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10549 path_constr.data = NULL;
10550 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10551 for (size_t k = 0; k < path_constr.datalen; k++) {
10552 int64_t path_conv_10 = path_vals[k];
10553 LDKRouteHop path_conv_10_conv;
10554 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10555 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10556 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10557 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10558 path_constr.data[k] = path_conv_10_conv;
10560 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10561 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10565 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10566 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10567 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10568 LDKCVec_RouteHopZ path_constr;
10569 path_constr.datalen = (*env)->GetArrayLength(env, path);
10570 if (path_constr.datalen > 0)
10571 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10573 path_constr.data = NULL;
10574 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10575 for (size_t k = 0; k < path_constr.datalen; k++) {
10576 int64_t path_conv_10 = path_vals[k];
10577 LDKRouteHop path_conv_10_conv;
10578 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10579 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10580 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10581 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10582 path_constr.data[k] = path_conv_10_conv;
10584 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10585 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10589 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10590 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10591 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10592 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10593 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10594 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10595 CVec_u8Z_free(ret_var);
10599 typedef struct LDKPersister_JCalls {
10600 atomic_size_t refcnt;
10603 jmethodID persist_manager_meth;
10604 jmethodID persist_graph_meth;
10605 jmethodID persist_scorer_meth;
10606 } LDKPersister_JCalls;
10607 static void LDKPersister_JCalls_free(void* this_arg) {
10608 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10609 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10611 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10612 if (get_jenv_res == JNI_EDETACHED) {
10613 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10615 DO_ASSERT(get_jenv_res == JNI_OK);
10617 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10618 if (get_jenv_res == JNI_EDETACHED) {
10619 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10624 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10625 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10627 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10628 if (get_jenv_res == JNI_EDETACHED) {
10629 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10631 DO_ASSERT(get_jenv_res == JNI_OK);
10633 LDKChannelManager channel_manager_var = *channel_manager;
10634 int64_t channel_manager_ref = 0;
10635 // WARNING: we may need a move here but no clone is available for LDKChannelManager
10636 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10637 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10638 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10639 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
10640 if (channel_manager_var.is_owned) {
10641 channel_manager_ref |= 1;
10643 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10644 CHECK(obj != NULL);
10645 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10646 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10647 (*env)->ExceptionDescribe(env);
10648 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
10650 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10651 CHECK_ACCESS(ret_ptr);
10652 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10654 if (get_jenv_res == JNI_EDETACHED) {
10655 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10659 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10660 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10662 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10663 if (get_jenv_res == JNI_EDETACHED) {
10664 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10666 DO_ASSERT(get_jenv_res == JNI_OK);
10668 LDKNetworkGraph network_graph_var = *network_graph;
10669 int64_t network_graph_ref = 0;
10670 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10671 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10672 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10673 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10674 network_graph_ref = (uintptr_t)network_graph_var.inner;
10675 if (network_graph_var.is_owned) {
10676 network_graph_ref |= 1;
10678 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10679 CHECK(obj != NULL);
10680 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10681 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10682 (*env)->ExceptionDescribe(env);
10683 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10685 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10686 CHECK_ACCESS(ret_ptr);
10687 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10689 if (get_jenv_res == JNI_EDETACHED) {
10690 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10694 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
10695 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10697 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10698 if (get_jenv_res == JNI_EDETACHED) {
10699 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10701 DO_ASSERT(get_jenv_res == JNI_OK);
10703 LDKMultiThreadedLockableScore scorer_var = *scorer;
10704 int64_t scorer_ref = 0;
10705 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
10706 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10707 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10708 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
10709 scorer_ref = (uintptr_t)scorer_var.inner;
10710 if (scorer_var.is_owned) {
10713 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10714 CHECK(obj != NULL);
10715 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
10716 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10717 (*env)->ExceptionDescribe(env);
10718 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10720 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10721 CHECK_ACCESS(ret_ptr);
10722 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10724 if (get_jenv_res == JNI_EDETACHED) {
10725 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10729 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10730 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10731 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10733 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10734 jclass c = (*env)->GetObjectClass(env, o);
10736 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10737 atomic_init(&calls->refcnt, 1);
10738 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10739 calls->o = (*env)->NewWeakGlobalRef(env, o);
10740 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10741 CHECK(calls->persist_manager_meth != NULL);
10742 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10743 CHECK(calls->persist_graph_meth != NULL);
10744 calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10745 CHECK(calls->persist_scorer_meth != NULL);
10747 LDKPersister ret = {
10748 .this_arg = (void*) calls,
10749 .persist_manager = persist_manager_LDKPersister_jcall,
10750 .persist_graph = persist_graph_LDKPersister_jcall,
10751 .persist_scorer = persist_scorer_LDKPersister_jcall,
10752 .free = LDKPersister_JCalls_free,
10756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10757 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10758 *res_ptr = LDKPersister_init(env, clz, o);
10759 return (uint64_t)res_ptr;
10761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10762 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10764 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10765 LDKChannelManager channel_manager_conv;
10766 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10767 channel_manager_conv.is_owned = false;
10768 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10769 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10770 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10771 return (int64_t)ret_conv;
10774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10775 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10776 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10777 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10778 LDKNetworkGraph network_graph_conv;
10779 network_graph_conv.inner = (void*)(network_graph & (~1));
10780 network_graph_conv.is_owned = false;
10781 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10782 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10783 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10784 return (int64_t)ret_conv;
10787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10788 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10789 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10790 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10791 LDKMultiThreadedLockableScore scorer_conv;
10792 scorer_conv.inner = (void*)(scorer & (~1));
10793 scorer_conv.is_owned = false;
10794 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
10795 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10796 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
10797 return (int64_t)ret_conv;
10800 typedef struct LDKListen_JCalls {
10801 atomic_size_t refcnt;
10804 jmethodID filtered_block_connected_meth;
10805 jmethodID block_connected_meth;
10806 jmethodID block_disconnected_meth;
10807 } LDKListen_JCalls;
10808 static void LDKListen_JCalls_free(void* this_arg) {
10809 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10810 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10812 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10813 if (get_jenv_res == JNI_EDETACHED) {
10814 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10816 DO_ASSERT(get_jenv_res == JNI_OK);
10818 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10819 if (get_jenv_res == JNI_EDETACHED) {
10820 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10825 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10826 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10828 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10829 if (get_jenv_res == JNI_EDETACHED) {
10830 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10832 DO_ASSERT(get_jenv_res == JNI_OK);
10834 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10835 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10836 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10837 int64_tArray txdata_arr = NULL;
10838 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10839 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10840 for (size_t c = 0; c < txdata_var.datalen; c++) {
10841 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10842 *txdata_conv_28_conv = txdata_var.data[c];
10843 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
10845 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10846 FREE(txdata_var.data);
10847 int32_t height_conv = height;
10848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10849 CHECK(obj != NULL);
10850 (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
10851 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10852 (*env)->ExceptionDescribe(env);
10853 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
10855 if (get_jenv_res == JNI_EDETACHED) {
10856 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10859 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10860 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10862 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10863 if (get_jenv_res == JNI_EDETACHED) {
10864 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10866 DO_ASSERT(get_jenv_res == JNI_OK);
10868 LDKu8slice block_var = block;
10869 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10870 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10871 int32_t height_conv = height;
10872 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10873 CHECK(obj != NULL);
10874 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10875 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10876 (*env)->ExceptionDescribe(env);
10877 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10879 if (get_jenv_res == JNI_EDETACHED) {
10880 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10883 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10884 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10886 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10887 if (get_jenv_res == JNI_EDETACHED) {
10888 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10890 DO_ASSERT(get_jenv_res == JNI_OK);
10892 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10893 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10894 int32_t height_conv = height;
10895 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10896 CHECK(obj != NULL);
10897 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10898 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10899 (*env)->ExceptionDescribe(env);
10900 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10902 if (get_jenv_res == JNI_EDETACHED) {
10903 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10906 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10907 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10908 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10910 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10911 jclass c = (*env)->GetObjectClass(env, o);
10913 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10914 atomic_init(&calls->refcnt, 1);
10915 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10916 calls->o = (*env)->NewWeakGlobalRef(env, o);
10917 calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
10918 CHECK(calls->filtered_block_connected_meth != NULL);
10919 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10920 CHECK(calls->block_connected_meth != NULL);
10921 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10922 CHECK(calls->block_disconnected_meth != NULL);
10925 .this_arg = (void*) calls,
10926 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
10927 .block_connected = block_connected_LDKListen_jcall,
10928 .block_disconnected = block_disconnected_LDKListen_jcall,
10929 .free = LDKListen_JCalls_free,
10933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10934 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10935 *res_ptr = LDKListen_init(env, clz, o);
10936 return (uint64_t)res_ptr;
10938 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) {
10939 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10940 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10941 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10942 unsigned char header_arr[80];
10943 CHECK((*env)->GetArrayLength(env, header) == 80);
10944 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10945 unsigned char (*header_ref)[80] = &header_arr;
10946 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10947 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10948 if (txdata_constr.datalen > 0)
10949 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10951 txdata_constr.data = NULL;
10952 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10953 for (size_t c = 0; c < txdata_constr.datalen; c++) {
10954 int64_t txdata_conv_28 = txdata_vals[c];
10955 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
10956 CHECK_ACCESS(txdata_conv_28_ptr);
10957 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10958 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
10959 txdata_constr.data[c] = txdata_conv_28_conv;
10961 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10962 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10965 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) {
10966 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10967 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10968 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10969 LDKu8slice block_ref;
10970 block_ref.datalen = (*env)->GetArrayLength(env, block);
10971 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10972 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10973 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10976 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) {
10977 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10978 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10979 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10980 unsigned char header_arr[80];
10981 CHECK((*env)->GetArrayLength(env, header) == 80);
10982 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10983 unsigned char (*header_ref)[80] = &header_arr;
10984 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10987 typedef struct LDKConfirm_JCalls {
10988 atomic_size_t refcnt;
10991 jmethodID transactions_confirmed_meth;
10992 jmethodID transaction_unconfirmed_meth;
10993 jmethodID best_block_updated_meth;
10994 jmethodID get_relevant_txids_meth;
10995 } LDKConfirm_JCalls;
10996 static void LDKConfirm_JCalls_free(void* this_arg) {
10997 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10998 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11000 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11001 if (get_jenv_res == JNI_EDETACHED) {
11002 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11004 DO_ASSERT(get_jenv_res == JNI_OK);
11006 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11007 if (get_jenv_res == JNI_EDETACHED) {
11008 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11013 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11014 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11016 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11017 if (get_jenv_res == JNI_EDETACHED) {
11018 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11020 DO_ASSERT(get_jenv_res == JNI_OK);
11022 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11023 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11024 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11025 int64_tArray txdata_arr = NULL;
11026 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11027 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11028 for (size_t c = 0; c < txdata_var.datalen; c++) {
11029 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11030 *txdata_conv_28_conv = txdata_var.data[c];
11031 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11033 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11034 FREE(txdata_var.data);
11035 int32_t height_conv = height;
11036 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11037 CHECK(obj != NULL);
11038 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
11039 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11040 (*env)->ExceptionDescribe(env);
11041 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
11043 if (get_jenv_res == JNI_EDETACHED) {
11044 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11047 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11048 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11050 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11051 if (get_jenv_res == JNI_EDETACHED) {
11052 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11054 DO_ASSERT(get_jenv_res == JNI_OK);
11056 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11057 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11059 CHECK(obj != NULL);
11060 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
11061 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11062 (*env)->ExceptionDescribe(env);
11063 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
11065 if (get_jenv_res == JNI_EDETACHED) {
11066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11069 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11070 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11073 if (get_jenv_res == JNI_EDETACHED) {
11074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11076 DO_ASSERT(get_jenv_res == JNI_OK);
11078 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11079 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11080 int32_t height_conv = height;
11081 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11082 CHECK(obj != NULL);
11083 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
11084 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11085 (*env)->ExceptionDescribe(env);
11086 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
11088 if (get_jenv_res == JNI_EDETACHED) {
11089 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11092 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11093 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11095 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11096 if (get_jenv_res == JNI_EDETACHED) {
11097 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11099 DO_ASSERT(get_jenv_res == JNI_OK);
11101 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11102 CHECK(obj != NULL);
11103 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
11104 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11105 (*env)->ExceptionDescribe(env);
11106 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
11108 LDKCVec_TxidZ ret_constr;
11109 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11110 if (ret_constr.datalen > 0)
11111 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11113 ret_constr.data = NULL;
11114 for (size_t i = 0; i < ret_constr.datalen; i++) {
11115 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
11116 LDKThirtyTwoBytes ret_conv_8_ref;
11117 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
11118 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
11119 ret_constr.data[i] = ret_conv_8_ref;
11121 if (get_jenv_res == JNI_EDETACHED) {
11122 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11126 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11127 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11128 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11130 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
11131 jclass c = (*env)->GetObjectClass(env, o);
11133 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11134 atomic_init(&calls->refcnt, 1);
11135 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11136 calls->o = (*env)->NewWeakGlobalRef(env, o);
11137 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
11138 CHECK(calls->transactions_confirmed_meth != NULL);
11139 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
11140 CHECK(calls->transaction_unconfirmed_meth != NULL);
11141 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
11142 CHECK(calls->best_block_updated_meth != NULL);
11143 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
11144 CHECK(calls->get_relevant_txids_meth != NULL);
11147 .this_arg = (void*) calls,
11148 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11149 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11150 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11151 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11152 .free = LDKConfirm_JCalls_free,
11156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
11157 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11158 *res_ptr = LDKConfirm_init(env, clz, o);
11159 return (uint64_t)res_ptr;
11161 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) {
11162 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11163 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11164 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11165 unsigned char header_arr[80];
11166 CHECK((*env)->GetArrayLength(env, header) == 80);
11167 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11168 unsigned char (*header_ref)[80] = &header_arr;
11169 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11170 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11171 if (txdata_constr.datalen > 0)
11172 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11174 txdata_constr.data = NULL;
11175 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11176 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11177 int64_t txdata_conv_28 = txdata_vals[c];
11178 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11179 CHECK_ACCESS(txdata_conv_28_ptr);
11180 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11181 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11182 txdata_constr.data[c] = txdata_conv_28_conv;
11184 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11185 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
11189 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11190 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11191 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11192 unsigned char txid_arr[32];
11193 CHECK((*env)->GetArrayLength(env, txid) == 32);
11194 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11195 unsigned char (*txid_ref)[32] = &txid_arr;
11196 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11199 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) {
11200 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11201 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11202 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11203 unsigned char header_arr[80];
11204 CHECK((*env)->GetArrayLength(env, header) == 80);
11205 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11206 unsigned char (*header_ref)[80] = &header_arr;
11207 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11210 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
11211 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11212 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11213 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11214 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11215 jobjectArray ret_arr = NULL;
11216 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11218 for (size_t i = 0; i < ret_var.datalen; i++) {
11219 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
11220 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
11221 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11224 FREE(ret_var.data);
11228 typedef struct LDKPersist_JCalls {
11229 atomic_size_t refcnt;
11232 jmethodID persist_new_channel_meth;
11233 jmethodID update_persisted_channel_meth;
11234 } LDKPersist_JCalls;
11235 static void LDKPersist_JCalls_free(void* this_arg) {
11236 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11237 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11239 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11240 if (get_jenv_res == JNI_EDETACHED) {
11241 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11243 DO_ASSERT(get_jenv_res == JNI_OK);
11245 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11246 if (get_jenv_res == JNI_EDETACHED) {
11247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11252 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11253 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11255 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11256 if (get_jenv_res == JNI_EDETACHED) {
11257 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11259 DO_ASSERT(get_jenv_res == JNI_OK);
11261 LDKOutPoint channel_id_var = channel_id;
11262 int64_t channel_id_ref = 0;
11263 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11264 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11265 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11266 channel_id_ref = (uintptr_t)channel_id_var.inner;
11267 if (channel_id_var.is_owned) {
11268 channel_id_ref |= 1;
11270 LDKChannelMonitor data_var = *data;
11271 int64_t data_ref = 0;
11272 data_var = ChannelMonitor_clone(&data_var);
11273 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11274 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11275 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11276 data_ref = (uintptr_t)data_var.inner;
11277 if (data_var.is_owned) {
11280 LDKMonitorUpdateId update_id_var = update_id;
11281 int64_t update_id_ref = 0;
11282 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11283 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11284 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11285 update_id_ref = (uintptr_t)update_id_var.inner;
11286 if (update_id_var.is_owned) {
11287 update_id_ref |= 1;
11289 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11290 CHECK(obj != NULL);
11291 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
11292 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11293 (*env)->ExceptionDescribe(env);
11294 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
11296 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11297 CHECK_ACCESS(ret_ptr);
11298 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11300 if (get_jenv_res == JNI_EDETACHED) {
11301 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11305 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11306 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11308 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11309 if (get_jenv_res == JNI_EDETACHED) {
11310 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11312 DO_ASSERT(get_jenv_res == JNI_OK);
11314 LDKOutPoint channel_id_var = channel_id;
11315 int64_t channel_id_ref = 0;
11316 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11317 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11318 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11319 channel_id_ref = (uintptr_t)channel_id_var.inner;
11320 if (channel_id_var.is_owned) {
11321 channel_id_ref |= 1;
11323 LDKChannelMonitorUpdate update_var = *update;
11324 int64_t update_ref = 0;
11325 if ((uintptr_t)update_var.inner > 4096) {
11326 update_var = ChannelMonitorUpdate_clone(&update_var);
11327 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11328 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11329 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11330 update_ref = (uintptr_t)update_var.inner;
11331 if (update_var.is_owned) {
11335 LDKChannelMonitor data_var = *data;
11336 int64_t data_ref = 0;
11337 data_var = ChannelMonitor_clone(&data_var);
11338 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11339 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11340 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11341 data_ref = (uintptr_t)data_var.inner;
11342 if (data_var.is_owned) {
11345 LDKMonitorUpdateId update_id_var = update_id;
11346 int64_t update_id_ref = 0;
11347 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11348 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11349 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11350 update_id_ref = (uintptr_t)update_id_var.inner;
11351 if (update_id_var.is_owned) {
11352 update_id_ref |= 1;
11354 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11355 CHECK(obj != NULL);
11356 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
11357 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11358 (*env)->ExceptionDescribe(env);
11359 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
11361 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11362 CHECK_ACCESS(ret_ptr);
11363 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11365 if (get_jenv_res == JNI_EDETACHED) {
11366 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11370 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11371 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11372 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11374 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
11375 jclass c = (*env)->GetObjectClass(env, o);
11377 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11378 atomic_init(&calls->refcnt, 1);
11379 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11380 calls->o = (*env)->NewWeakGlobalRef(env, o);
11381 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
11382 CHECK(calls->persist_new_channel_meth != NULL);
11383 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
11384 CHECK(calls->update_persisted_channel_meth != NULL);
11387 .this_arg = (void*) calls,
11388 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11389 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11390 .free = LDKPersist_JCalls_free,
11394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
11395 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11396 *res_ptr = LDKPersist_init(env, clz, o);
11397 return (uint64_t)res_ptr;
11399 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) {
11400 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11401 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11402 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11403 LDKOutPoint channel_id_conv;
11404 channel_id_conv.inner = (void*)(channel_id & (~1));
11405 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11406 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11407 channel_id_conv = OutPoint_clone(&channel_id_conv);
11408 LDKChannelMonitor data_conv;
11409 data_conv.inner = (void*)(data & (~1));
11410 data_conv.is_owned = false;
11411 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11412 LDKMonitorUpdateId update_id_conv;
11413 update_id_conv.inner = (void*)(update_id & (~1));
11414 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11415 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11416 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11417 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11418 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
11419 return (int64_t)ret_conv;
11422 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) {
11423 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11424 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11425 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11426 LDKOutPoint channel_id_conv;
11427 channel_id_conv.inner = (void*)(channel_id & (~1));
11428 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11429 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11430 channel_id_conv = OutPoint_clone(&channel_id_conv);
11431 LDKChannelMonitorUpdate update_conv;
11432 update_conv.inner = (void*)(update & (~1));
11433 update_conv.is_owned = false;
11434 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11435 LDKChannelMonitor data_conv;
11436 data_conv.inner = (void*)(data & (~1));
11437 data_conv.is_owned = false;
11438 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11439 LDKMonitorUpdateId update_id_conv;
11440 update_id_conv.inner = (void*)(update_id & (~1));
11441 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11442 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11443 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11444 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11445 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
11446 return (int64_t)ret_conv;
11449 typedef struct LDKChannelMessageHandler_JCalls {
11450 atomic_size_t refcnt;
11453 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11454 jmethodID handle_open_channel_meth;
11455 jmethodID handle_accept_channel_meth;
11456 jmethodID handle_funding_created_meth;
11457 jmethodID handle_funding_signed_meth;
11458 jmethodID handle_channel_ready_meth;
11459 jmethodID handle_shutdown_meth;
11460 jmethodID handle_closing_signed_meth;
11461 jmethodID handle_update_add_htlc_meth;
11462 jmethodID handle_update_fulfill_htlc_meth;
11463 jmethodID handle_update_fail_htlc_meth;
11464 jmethodID handle_update_fail_malformed_htlc_meth;
11465 jmethodID handle_commitment_signed_meth;
11466 jmethodID handle_revoke_and_ack_meth;
11467 jmethodID handle_update_fee_meth;
11468 jmethodID handle_announcement_signatures_meth;
11469 jmethodID peer_disconnected_meth;
11470 jmethodID peer_connected_meth;
11471 jmethodID handle_channel_reestablish_meth;
11472 jmethodID handle_channel_update_meth;
11473 jmethodID handle_error_meth;
11474 } LDKChannelMessageHandler_JCalls;
11475 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11476 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11477 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11479 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11480 if (get_jenv_res == JNI_EDETACHED) {
11481 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11483 DO_ASSERT(get_jenv_res == JNI_OK);
11485 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11486 if (get_jenv_res == JNI_EDETACHED) {
11487 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11492 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
11493 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11495 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11496 if (get_jenv_res == JNI_EDETACHED) {
11497 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11499 DO_ASSERT(get_jenv_res == JNI_OK);
11501 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11502 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11503 LDKInitFeatures their_features_var = their_features;
11504 int64_t their_features_ref = 0;
11505 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11506 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11507 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11508 their_features_ref = (uintptr_t)their_features_var.inner;
11509 if (their_features_var.is_owned) {
11510 their_features_ref |= 1;
11512 LDKOpenChannel msg_var = *msg;
11513 int64_t msg_ref = 0;
11514 msg_var = OpenChannel_clone(&msg_var);
11515 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11516 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11517 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11518 msg_ref = (uintptr_t)msg_var.inner;
11519 if (msg_var.is_owned) {
11522 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11523 CHECK(obj != NULL);
11524 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11525 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11526 (*env)->ExceptionDescribe(env);
11527 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11529 if (get_jenv_res == JNI_EDETACHED) {
11530 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11533 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11534 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11536 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11537 if (get_jenv_res == JNI_EDETACHED) {
11538 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11540 DO_ASSERT(get_jenv_res == JNI_OK);
11542 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11543 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11544 LDKInitFeatures their_features_var = their_features;
11545 int64_t their_features_ref = 0;
11546 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11547 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11548 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11549 their_features_ref = (uintptr_t)their_features_var.inner;
11550 if (their_features_var.is_owned) {
11551 their_features_ref |= 1;
11553 LDKAcceptChannel msg_var = *msg;
11554 int64_t msg_ref = 0;
11555 msg_var = AcceptChannel_clone(&msg_var);
11556 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11557 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11558 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11559 msg_ref = (uintptr_t)msg_var.inner;
11560 if (msg_var.is_owned) {
11563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11564 CHECK(obj != NULL);
11565 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11566 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11567 (*env)->ExceptionDescribe(env);
11568 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
11570 if (get_jenv_res == JNI_EDETACHED) {
11571 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11574 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11575 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11577 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11578 if (get_jenv_res == JNI_EDETACHED) {
11579 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11581 DO_ASSERT(get_jenv_res == JNI_OK);
11583 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11584 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11585 LDKFundingCreated msg_var = *msg;
11586 int64_t msg_ref = 0;
11587 msg_var = FundingCreated_clone(&msg_var);
11588 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11589 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11591 msg_ref = (uintptr_t)msg_var.inner;
11592 if (msg_var.is_owned) {
11595 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11596 CHECK(obj != NULL);
11597 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
11598 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11599 (*env)->ExceptionDescribe(env);
11600 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
11602 if (get_jenv_res == JNI_EDETACHED) {
11603 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11606 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11607 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11609 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11610 if (get_jenv_res == JNI_EDETACHED) {
11611 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11613 DO_ASSERT(get_jenv_res == JNI_OK);
11615 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11616 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11617 LDKFundingSigned msg_var = *msg;
11618 int64_t msg_ref = 0;
11619 msg_var = FundingSigned_clone(&msg_var);
11620 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11621 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11623 msg_ref = (uintptr_t)msg_var.inner;
11624 if (msg_var.is_owned) {
11627 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11628 CHECK(obj != NULL);
11629 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
11630 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11631 (*env)->ExceptionDescribe(env);
11632 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
11634 if (get_jenv_res == JNI_EDETACHED) {
11635 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11638 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11639 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11641 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11642 if (get_jenv_res == JNI_EDETACHED) {
11643 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11645 DO_ASSERT(get_jenv_res == JNI_OK);
11647 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11648 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11649 LDKChannelReady msg_var = *msg;
11650 int64_t msg_ref = 0;
11651 msg_var = ChannelReady_clone(&msg_var);
11652 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11653 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11654 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11655 msg_ref = (uintptr_t)msg_var.inner;
11656 if (msg_var.is_owned) {
11659 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11660 CHECK(obj != NULL);
11661 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
11662 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11663 (*env)->ExceptionDescribe(env);
11664 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
11666 if (get_jenv_res == JNI_EDETACHED) {
11667 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11670 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11671 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11673 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11674 if (get_jenv_res == JNI_EDETACHED) {
11675 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11677 DO_ASSERT(get_jenv_res == JNI_OK);
11679 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11680 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11681 LDKInitFeatures their_features_var = *their_features;
11682 int64_t their_features_ref = 0;
11683 their_features_var = InitFeatures_clone(&their_features_var);
11684 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11685 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11686 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11687 their_features_ref = (uintptr_t)their_features_var.inner;
11688 if (their_features_var.is_owned) {
11689 their_features_ref |= 1;
11691 LDKShutdown msg_var = *msg;
11692 int64_t msg_ref = 0;
11693 msg_var = Shutdown_clone(&msg_var);
11694 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11695 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11696 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11697 msg_ref = (uintptr_t)msg_var.inner;
11698 if (msg_var.is_owned) {
11701 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11702 CHECK(obj != NULL);
11703 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11704 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11705 (*env)->ExceptionDescribe(env);
11706 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11708 if (get_jenv_res == JNI_EDETACHED) {
11709 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11712 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11713 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11715 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11716 if (get_jenv_res == JNI_EDETACHED) {
11717 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11719 DO_ASSERT(get_jenv_res == JNI_OK);
11721 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11722 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11723 LDKClosingSigned msg_var = *msg;
11724 int64_t msg_ref = 0;
11725 msg_var = ClosingSigned_clone(&msg_var);
11726 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11727 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11728 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11729 msg_ref = (uintptr_t)msg_var.inner;
11730 if (msg_var.is_owned) {
11733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11734 CHECK(obj != NULL);
11735 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11736 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11737 (*env)->ExceptionDescribe(env);
11738 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11740 if (get_jenv_res == JNI_EDETACHED) {
11741 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11744 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11745 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11747 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11748 if (get_jenv_res == JNI_EDETACHED) {
11749 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11751 DO_ASSERT(get_jenv_res == JNI_OK);
11753 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11754 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11755 LDKUpdateAddHTLC msg_var = *msg;
11756 int64_t msg_ref = 0;
11757 msg_var = UpdateAddHTLC_clone(&msg_var);
11758 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11759 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11760 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11761 msg_ref = (uintptr_t)msg_var.inner;
11762 if (msg_var.is_owned) {
11765 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11766 CHECK(obj != NULL);
11767 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11768 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11769 (*env)->ExceptionDescribe(env);
11770 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11772 if (get_jenv_res == JNI_EDETACHED) {
11773 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11776 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11777 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11779 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11780 if (get_jenv_res == JNI_EDETACHED) {
11781 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11783 DO_ASSERT(get_jenv_res == JNI_OK);
11785 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11786 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11787 LDKUpdateFulfillHTLC msg_var = *msg;
11788 int64_t msg_ref = 0;
11789 msg_var = UpdateFulfillHTLC_clone(&msg_var);
11790 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11791 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11792 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11793 msg_ref = (uintptr_t)msg_var.inner;
11794 if (msg_var.is_owned) {
11797 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11798 CHECK(obj != NULL);
11799 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11800 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11801 (*env)->ExceptionDescribe(env);
11802 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11804 if (get_jenv_res == JNI_EDETACHED) {
11805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11808 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11809 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11811 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11812 if (get_jenv_res == JNI_EDETACHED) {
11813 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11815 DO_ASSERT(get_jenv_res == JNI_OK);
11817 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11818 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11819 LDKUpdateFailHTLC msg_var = *msg;
11820 int64_t msg_ref = 0;
11821 msg_var = UpdateFailHTLC_clone(&msg_var);
11822 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11823 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11824 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11825 msg_ref = (uintptr_t)msg_var.inner;
11826 if (msg_var.is_owned) {
11829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11830 CHECK(obj != NULL);
11831 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11832 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11833 (*env)->ExceptionDescribe(env);
11834 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11836 if (get_jenv_res == JNI_EDETACHED) {
11837 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11840 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11841 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11843 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11844 if (get_jenv_res == JNI_EDETACHED) {
11845 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11847 DO_ASSERT(get_jenv_res == JNI_OK);
11849 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11850 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11851 LDKUpdateFailMalformedHTLC msg_var = *msg;
11852 int64_t msg_ref = 0;
11853 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11854 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11855 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11856 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11857 msg_ref = (uintptr_t)msg_var.inner;
11858 if (msg_var.is_owned) {
11861 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11862 CHECK(obj != NULL);
11863 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11864 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11865 (*env)->ExceptionDescribe(env);
11866 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11868 if (get_jenv_res == JNI_EDETACHED) {
11869 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11872 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11873 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11875 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11876 if (get_jenv_res == JNI_EDETACHED) {
11877 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11879 DO_ASSERT(get_jenv_res == JNI_OK);
11881 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11882 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11883 LDKCommitmentSigned msg_var = *msg;
11884 int64_t msg_ref = 0;
11885 msg_var = CommitmentSigned_clone(&msg_var);
11886 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11887 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11888 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11889 msg_ref = (uintptr_t)msg_var.inner;
11890 if (msg_var.is_owned) {
11893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11894 CHECK(obj != NULL);
11895 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11896 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11897 (*env)->ExceptionDescribe(env);
11898 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11900 if (get_jenv_res == JNI_EDETACHED) {
11901 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11904 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11905 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11907 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11908 if (get_jenv_res == JNI_EDETACHED) {
11909 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11911 DO_ASSERT(get_jenv_res == JNI_OK);
11913 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11914 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11915 LDKRevokeAndACK msg_var = *msg;
11916 int64_t msg_ref = 0;
11917 msg_var = RevokeAndACK_clone(&msg_var);
11918 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11919 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11920 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11921 msg_ref = (uintptr_t)msg_var.inner;
11922 if (msg_var.is_owned) {
11925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11926 CHECK(obj != NULL);
11927 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11928 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11929 (*env)->ExceptionDescribe(env);
11930 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11932 if (get_jenv_res == JNI_EDETACHED) {
11933 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11936 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11937 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11940 if (get_jenv_res == JNI_EDETACHED) {
11941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11943 DO_ASSERT(get_jenv_res == JNI_OK);
11945 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11946 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11947 LDKUpdateFee msg_var = *msg;
11948 int64_t msg_ref = 0;
11949 msg_var = UpdateFee_clone(&msg_var);
11950 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11951 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11952 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11953 msg_ref = (uintptr_t)msg_var.inner;
11954 if (msg_var.is_owned) {
11957 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11958 CHECK(obj != NULL);
11959 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11960 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11961 (*env)->ExceptionDescribe(env);
11962 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11964 if (get_jenv_res == JNI_EDETACHED) {
11965 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11968 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11969 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11971 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11972 if (get_jenv_res == JNI_EDETACHED) {
11973 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11975 DO_ASSERT(get_jenv_res == JNI_OK);
11977 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11978 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11979 LDKAnnouncementSignatures msg_var = *msg;
11980 int64_t msg_ref = 0;
11981 msg_var = AnnouncementSignatures_clone(&msg_var);
11982 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11983 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11984 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11985 msg_ref = (uintptr_t)msg_var.inner;
11986 if (msg_var.is_owned) {
11989 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11990 CHECK(obj != NULL);
11991 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11992 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11993 (*env)->ExceptionDescribe(env);
11994 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11996 if (get_jenv_res == JNI_EDETACHED) {
11997 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12000 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
12001 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12004 if (get_jenv_res == JNI_EDETACHED) {
12005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12007 DO_ASSERT(get_jenv_res == JNI_OK);
12009 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12010 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12011 jboolean no_connection_possible_conv = no_connection_possible;
12012 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12013 CHECK(obj != NULL);
12014 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
12015 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12016 (*env)->ExceptionDescribe(env);
12017 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
12019 if (get_jenv_res == JNI_EDETACHED) {
12020 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12023 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
12024 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12026 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12027 if (get_jenv_res == JNI_EDETACHED) {
12028 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12030 DO_ASSERT(get_jenv_res == JNI_OK);
12032 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12033 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12034 LDKInit msg_var = *msg;
12035 int64_t msg_ref = 0;
12036 msg_var = Init_clone(&msg_var);
12037 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12038 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12039 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12040 msg_ref = (uintptr_t)msg_var.inner;
12041 if (msg_var.is_owned) {
12044 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12045 CHECK(obj != NULL);
12046 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
12047 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12048 (*env)->ExceptionDescribe(env);
12049 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
12051 if (get_jenv_res == JNI_EDETACHED) {
12052 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12055 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12056 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12059 if (get_jenv_res == JNI_EDETACHED) {
12060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12062 DO_ASSERT(get_jenv_res == JNI_OK);
12064 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12065 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12066 LDKChannelReestablish msg_var = *msg;
12067 int64_t msg_ref = 0;
12068 msg_var = ChannelReestablish_clone(&msg_var);
12069 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12070 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12072 msg_ref = (uintptr_t)msg_var.inner;
12073 if (msg_var.is_owned) {
12076 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12077 CHECK(obj != NULL);
12078 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
12079 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12080 (*env)->ExceptionDescribe(env);
12081 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
12083 if (get_jenv_res == JNI_EDETACHED) {
12084 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12087 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12088 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12090 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12091 if (get_jenv_res == JNI_EDETACHED) {
12092 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12094 DO_ASSERT(get_jenv_res == JNI_OK);
12096 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12097 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12098 LDKChannelUpdate msg_var = *msg;
12099 int64_t msg_ref = 0;
12100 msg_var = ChannelUpdate_clone(&msg_var);
12101 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12102 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12103 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12104 msg_ref = (uintptr_t)msg_var.inner;
12105 if (msg_var.is_owned) {
12108 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12109 CHECK(obj != NULL);
12110 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
12111 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12112 (*env)->ExceptionDescribe(env);
12113 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
12115 if (get_jenv_res == JNI_EDETACHED) {
12116 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12119 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12120 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12122 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12123 if (get_jenv_res == JNI_EDETACHED) {
12124 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12126 DO_ASSERT(get_jenv_res == JNI_OK);
12128 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12129 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12130 LDKErrorMessage msg_var = *msg;
12131 int64_t msg_ref = 0;
12132 msg_var = ErrorMessage_clone(&msg_var);
12133 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12134 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12136 msg_ref = (uintptr_t)msg_var.inner;
12137 if (msg_var.is_owned) {
12140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12141 CHECK(obj != NULL);
12142 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
12143 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12144 (*env)->ExceptionDescribe(env);
12145 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
12147 if (get_jenv_res == JNI_EDETACHED) {
12148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12151 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12152 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12153 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12154 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12156 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12157 jclass c = (*env)->GetObjectClass(env, o);
12159 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12160 atomic_init(&calls->refcnt, 1);
12161 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12162 calls->o = (*env)->NewWeakGlobalRef(env, o);
12163 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
12164 CHECK(calls->handle_open_channel_meth != NULL);
12165 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
12166 CHECK(calls->handle_accept_channel_meth != NULL);
12167 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
12168 CHECK(calls->handle_funding_created_meth != NULL);
12169 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
12170 CHECK(calls->handle_funding_signed_meth != NULL);
12171 calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
12172 CHECK(calls->handle_channel_ready_meth != NULL);
12173 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
12174 CHECK(calls->handle_shutdown_meth != NULL);
12175 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
12176 CHECK(calls->handle_closing_signed_meth != NULL);
12177 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
12178 CHECK(calls->handle_update_add_htlc_meth != NULL);
12179 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
12180 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
12181 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
12182 CHECK(calls->handle_update_fail_htlc_meth != NULL);
12183 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
12184 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
12185 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
12186 CHECK(calls->handle_commitment_signed_meth != NULL);
12187 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
12188 CHECK(calls->handle_revoke_and_ack_meth != NULL);
12189 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
12190 CHECK(calls->handle_update_fee_meth != NULL);
12191 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
12192 CHECK(calls->handle_announcement_signatures_meth != NULL);
12193 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
12194 CHECK(calls->peer_disconnected_meth != NULL);
12195 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12196 CHECK(calls->peer_connected_meth != NULL);
12197 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
12198 CHECK(calls->handle_channel_reestablish_meth != NULL);
12199 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
12200 CHECK(calls->handle_channel_update_meth != NULL);
12201 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
12202 CHECK(calls->handle_error_meth != NULL);
12204 LDKChannelMessageHandler ret = {
12205 .this_arg = (void*) calls,
12206 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12207 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12208 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12209 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12210 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12211 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12212 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12213 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12214 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12215 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12216 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12217 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12218 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12219 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12220 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12221 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12222 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12223 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12224 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12225 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12226 .free = LDKChannelMessageHandler_JCalls_free,
12227 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12229 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12233 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12234 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12235 return (uint64_t)res_ptr;
12237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12238 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
12239 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12240 DO_ASSERT((res_ptr & 1) == 0);
12241 return (int64_t)(res_ptr | 1);
12243 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) {
12244 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12245 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12246 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12247 LDKPublicKey their_node_id_ref;
12248 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12249 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12250 LDKInitFeatures their_features_conv;
12251 their_features_conv.inner = (void*)(their_features & (~1));
12252 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12253 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12254 their_features_conv = InitFeatures_clone(&their_features_conv);
12255 LDKOpenChannel msg_conv;
12256 msg_conv.inner = (void*)(msg & (~1));
12257 msg_conv.is_owned = false;
12258 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12259 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12262 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) {
12263 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12264 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12265 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12266 LDKPublicKey their_node_id_ref;
12267 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12268 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12269 LDKInitFeatures their_features_conv;
12270 their_features_conv.inner = (void*)(their_features & (~1));
12271 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12272 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12273 their_features_conv = InitFeatures_clone(&their_features_conv);
12274 LDKAcceptChannel msg_conv;
12275 msg_conv.inner = (void*)(msg & (~1));
12276 msg_conv.is_owned = false;
12277 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12278 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12281 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) {
12282 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12283 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12284 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12285 LDKPublicKey their_node_id_ref;
12286 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12287 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12288 LDKFundingCreated msg_conv;
12289 msg_conv.inner = (void*)(msg & (~1));
12290 msg_conv.is_owned = false;
12291 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12292 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12295 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) {
12296 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12297 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12298 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12299 LDKPublicKey their_node_id_ref;
12300 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12301 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12302 LDKFundingSigned msg_conv;
12303 msg_conv.inner = (void*)(msg & (~1));
12304 msg_conv.is_owned = false;
12305 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12306 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12309 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) {
12310 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12312 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12313 LDKPublicKey their_node_id_ref;
12314 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12315 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12316 LDKChannelReady msg_conv;
12317 msg_conv.inner = (void*)(msg & (~1));
12318 msg_conv.is_owned = false;
12319 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12320 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12323 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) {
12324 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12325 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12326 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12327 LDKPublicKey their_node_id_ref;
12328 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12329 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12330 LDKInitFeatures their_features_conv;
12331 their_features_conv.inner = (void*)(their_features & (~1));
12332 their_features_conv.is_owned = false;
12333 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12334 LDKShutdown msg_conv;
12335 msg_conv.inner = (void*)(msg & (~1));
12336 msg_conv.is_owned = false;
12337 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12338 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
12341 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) {
12342 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12343 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12344 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12345 LDKPublicKey their_node_id_ref;
12346 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12347 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12348 LDKClosingSigned msg_conv;
12349 msg_conv.inner = (void*)(msg & (~1));
12350 msg_conv.is_owned = false;
12351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12352 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12355 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) {
12356 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12357 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12358 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12359 LDKPublicKey their_node_id_ref;
12360 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12361 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12362 LDKUpdateAddHTLC msg_conv;
12363 msg_conv.inner = (void*)(msg & (~1));
12364 msg_conv.is_owned = false;
12365 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12366 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12369 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) {
12370 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12371 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12372 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12373 LDKPublicKey their_node_id_ref;
12374 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12375 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12376 LDKUpdateFulfillHTLC msg_conv;
12377 msg_conv.inner = (void*)(msg & (~1));
12378 msg_conv.is_owned = false;
12379 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12380 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12383 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) {
12384 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12385 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12386 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12387 LDKPublicKey their_node_id_ref;
12388 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12389 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12390 LDKUpdateFailHTLC msg_conv;
12391 msg_conv.inner = (void*)(msg & (~1));
12392 msg_conv.is_owned = false;
12393 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12394 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12397 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) {
12398 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12399 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12400 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12401 LDKPublicKey their_node_id_ref;
12402 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12403 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12404 LDKUpdateFailMalformedHTLC msg_conv;
12405 msg_conv.inner = (void*)(msg & (~1));
12406 msg_conv.is_owned = false;
12407 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12408 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12411 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) {
12412 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12413 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12414 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12415 LDKPublicKey their_node_id_ref;
12416 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12417 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12418 LDKCommitmentSigned msg_conv;
12419 msg_conv.inner = (void*)(msg & (~1));
12420 msg_conv.is_owned = false;
12421 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12422 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12425 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) {
12426 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12428 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12429 LDKPublicKey their_node_id_ref;
12430 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12431 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12432 LDKRevokeAndACK msg_conv;
12433 msg_conv.inner = (void*)(msg & (~1));
12434 msg_conv.is_owned = false;
12435 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12436 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12439 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) {
12440 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12441 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12442 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12443 LDKPublicKey their_node_id_ref;
12444 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12445 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12446 LDKUpdateFee msg_conv;
12447 msg_conv.inner = (void*)(msg & (~1));
12448 msg_conv.is_owned = false;
12449 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12450 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12453 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) {
12454 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12456 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12457 LDKPublicKey their_node_id_ref;
12458 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12459 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12460 LDKAnnouncementSignatures msg_conv;
12461 msg_conv.inner = (void*)(msg & (~1));
12462 msg_conv.is_owned = false;
12463 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12464 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12467 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) {
12468 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12469 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12470 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12471 LDKPublicKey their_node_id_ref;
12472 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12473 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12474 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
12477 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) {
12478 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12479 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12480 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12481 LDKPublicKey their_node_id_ref;
12482 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12483 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12485 msg_conv.inner = (void*)(msg & (~1));
12486 msg_conv.is_owned = false;
12487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12488 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12491 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) {
12492 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12494 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12495 LDKPublicKey their_node_id_ref;
12496 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12497 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12498 LDKChannelReestablish msg_conv;
12499 msg_conv.inner = (void*)(msg & (~1));
12500 msg_conv.is_owned = false;
12501 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12502 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12505 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) {
12506 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12508 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12509 LDKPublicKey their_node_id_ref;
12510 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12511 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12512 LDKChannelUpdate msg_conv;
12513 msg_conv.inner = (void*)(msg & (~1));
12514 msg_conv.is_owned = false;
12515 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12516 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12519 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) {
12520 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12521 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12522 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12523 LDKPublicKey their_node_id_ref;
12524 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12525 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12526 LDKErrorMessage msg_conv;
12527 msg_conv.inner = (void*)(msg & (~1));
12528 msg_conv.is_owned = false;
12529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12530 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12533 typedef struct LDKRoutingMessageHandler_JCalls {
12534 atomic_size_t refcnt;
12537 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12538 jmethodID handle_node_announcement_meth;
12539 jmethodID handle_channel_announcement_meth;
12540 jmethodID handle_channel_update_meth;
12541 jmethodID get_next_channel_announcements_meth;
12542 jmethodID get_next_node_announcements_meth;
12543 jmethodID peer_connected_meth;
12544 jmethodID handle_reply_channel_range_meth;
12545 jmethodID handle_reply_short_channel_ids_end_meth;
12546 jmethodID handle_query_channel_range_meth;
12547 jmethodID handle_query_short_channel_ids_meth;
12548 } LDKRoutingMessageHandler_JCalls;
12549 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12550 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12551 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12553 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12554 if (get_jenv_res == JNI_EDETACHED) {
12555 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12557 DO_ASSERT(get_jenv_res == JNI_OK);
12559 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12560 if (get_jenv_res == JNI_EDETACHED) {
12561 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12566 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12567 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12569 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12570 if (get_jenv_res == JNI_EDETACHED) {
12571 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12573 DO_ASSERT(get_jenv_res == JNI_OK);
12575 LDKNodeAnnouncement msg_var = *msg;
12576 int64_t msg_ref = 0;
12577 msg_var = NodeAnnouncement_clone(&msg_var);
12578 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12579 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12580 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12581 msg_ref = (uintptr_t)msg_var.inner;
12582 if (msg_var.is_owned) {
12585 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12586 CHECK(obj != NULL);
12587 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
12588 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12589 (*env)->ExceptionDescribe(env);
12590 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12592 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12593 CHECK_ACCESS(ret_ptr);
12594 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12596 if (get_jenv_res == JNI_EDETACHED) {
12597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12601 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12602 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12604 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12605 if (get_jenv_res == JNI_EDETACHED) {
12606 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12608 DO_ASSERT(get_jenv_res == JNI_OK);
12610 LDKChannelAnnouncement msg_var = *msg;
12611 int64_t msg_ref = 0;
12612 msg_var = ChannelAnnouncement_clone(&msg_var);
12613 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12614 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12615 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12616 msg_ref = (uintptr_t)msg_var.inner;
12617 if (msg_var.is_owned) {
12620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12621 CHECK(obj != NULL);
12622 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
12623 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12624 (*env)->ExceptionDescribe(env);
12625 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12627 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12628 CHECK_ACCESS(ret_ptr);
12629 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12631 if (get_jenv_res == JNI_EDETACHED) {
12632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12636 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12637 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12640 if (get_jenv_res == JNI_EDETACHED) {
12641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12643 DO_ASSERT(get_jenv_res == JNI_OK);
12645 LDKChannelUpdate msg_var = *msg;
12646 int64_t msg_ref = 0;
12647 msg_var = ChannelUpdate_clone(&msg_var);
12648 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12649 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12651 msg_ref = (uintptr_t)msg_var.inner;
12652 if (msg_var.is_owned) {
12655 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12656 CHECK(obj != NULL);
12657 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12658 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12659 (*env)->ExceptionDescribe(env);
12660 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12662 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12663 CHECK_ACCESS(ret_ptr);
12664 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12666 if (get_jenv_res == JNI_EDETACHED) {
12667 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12671 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
12672 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12674 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12675 if (get_jenv_res == JNI_EDETACHED) {
12676 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12678 DO_ASSERT(get_jenv_res == JNI_OK);
12680 int64_t starting_point_conv = starting_point;
12681 int8_t batch_amount_conv = batch_amount;
12682 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12683 CHECK(obj != NULL);
12684 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
12685 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12686 (*env)->ExceptionDescribe(env);
12687 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12689 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
12690 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12691 if (ret_constr.datalen > 0)
12692 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12694 ret_constr.data = NULL;
12695 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12696 for (size_t h = 0; h < ret_constr.datalen; h++) {
12697 int64_t ret_conv_59 = ret_vals[h];
12698 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
12699 CHECK_ACCESS(ret_conv_59_ptr);
12700 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
12701 FREE((void*)ret_conv_59);
12702 ret_constr.data[h] = ret_conv_59_conv;
12704 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12705 if (get_jenv_res == JNI_EDETACHED) {
12706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12710 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12711 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12713 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12714 if (get_jenv_res == JNI_EDETACHED) {
12715 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12717 DO_ASSERT(get_jenv_res == JNI_OK);
12719 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12720 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12721 int8_t batch_amount_conv = batch_amount;
12722 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12723 CHECK(obj != NULL);
12724 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
12725 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12726 (*env)->ExceptionDescribe(env);
12727 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12729 LDKCVec_NodeAnnouncementZ ret_constr;
12730 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12731 if (ret_constr.datalen > 0)
12732 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12734 ret_constr.data = NULL;
12735 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12736 for (size_t s = 0; s < ret_constr.datalen; s++) {
12737 int64_t ret_conv_18 = ret_vals[s];
12738 LDKNodeAnnouncement ret_conv_18_conv;
12739 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
12740 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
12741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12742 ret_constr.data[s] = ret_conv_18_conv;
12744 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12745 if (get_jenv_res == JNI_EDETACHED) {
12746 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12750 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12751 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12753 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12754 if (get_jenv_res == JNI_EDETACHED) {
12755 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12757 DO_ASSERT(get_jenv_res == JNI_OK);
12759 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12760 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12761 LDKInit init_var = *init;
12762 int64_t init_ref = 0;
12763 init_var = Init_clone(&init_var);
12764 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12765 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12766 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12767 init_ref = (uintptr_t)init_var.inner;
12768 if (init_var.is_owned) {
12771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12772 CHECK(obj != NULL);
12773 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12775 (*env)->ExceptionDescribe(env);
12776 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12778 if (get_jenv_res == JNI_EDETACHED) {
12779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12782 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12783 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12785 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12786 if (get_jenv_res == JNI_EDETACHED) {
12787 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12789 DO_ASSERT(get_jenv_res == JNI_OK);
12791 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12792 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12793 LDKReplyChannelRange msg_var = msg;
12794 int64_t msg_ref = 0;
12795 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12796 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12797 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12798 msg_ref = (uintptr_t)msg_var.inner;
12799 if (msg_var.is_owned) {
12802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12803 CHECK(obj != NULL);
12804 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12805 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12806 (*env)->ExceptionDescribe(env);
12807 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12809 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12810 CHECK_ACCESS(ret_ptr);
12811 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12813 if (get_jenv_res == JNI_EDETACHED) {
12814 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12818 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12819 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12822 if (get_jenv_res == JNI_EDETACHED) {
12823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12825 DO_ASSERT(get_jenv_res == JNI_OK);
12827 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12828 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12829 LDKReplyShortChannelIdsEnd msg_var = msg;
12830 int64_t msg_ref = 0;
12831 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12832 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12833 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12834 msg_ref = (uintptr_t)msg_var.inner;
12835 if (msg_var.is_owned) {
12838 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12839 CHECK(obj != NULL);
12840 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12841 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12842 (*env)->ExceptionDescribe(env);
12843 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12845 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12846 CHECK_ACCESS(ret_ptr);
12847 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12849 if (get_jenv_res == JNI_EDETACHED) {
12850 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12854 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12855 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12857 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12858 if (get_jenv_res == JNI_EDETACHED) {
12859 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12861 DO_ASSERT(get_jenv_res == JNI_OK);
12863 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12864 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12865 LDKQueryChannelRange msg_var = msg;
12866 int64_t msg_ref = 0;
12867 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12868 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12869 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12870 msg_ref = (uintptr_t)msg_var.inner;
12871 if (msg_var.is_owned) {
12874 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12875 CHECK(obj != NULL);
12876 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12877 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12878 (*env)->ExceptionDescribe(env);
12879 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12881 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12882 CHECK_ACCESS(ret_ptr);
12883 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12885 if (get_jenv_res == JNI_EDETACHED) {
12886 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12890 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12891 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12893 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12894 if (get_jenv_res == JNI_EDETACHED) {
12895 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12897 DO_ASSERT(get_jenv_res == JNI_OK);
12899 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12900 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12901 LDKQueryShortChannelIds msg_var = msg;
12902 int64_t msg_ref = 0;
12903 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12904 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12905 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12906 msg_ref = (uintptr_t)msg_var.inner;
12907 if (msg_var.is_owned) {
12910 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12911 CHECK(obj != NULL);
12912 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12913 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12914 (*env)->ExceptionDescribe(env);
12915 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12917 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12918 CHECK_ACCESS(ret_ptr);
12919 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12921 if (get_jenv_res == JNI_EDETACHED) {
12922 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12926 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12927 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12928 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12929 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12931 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12932 jclass c = (*env)->GetObjectClass(env, o);
12934 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12935 atomic_init(&calls->refcnt, 1);
12936 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12937 calls->o = (*env)->NewWeakGlobalRef(env, o);
12938 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12939 CHECK(calls->handle_node_announcement_meth != NULL);
12940 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12941 CHECK(calls->handle_channel_announcement_meth != NULL);
12942 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12943 CHECK(calls->handle_channel_update_meth != NULL);
12944 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12945 CHECK(calls->get_next_channel_announcements_meth != NULL);
12946 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12947 CHECK(calls->get_next_node_announcements_meth != NULL);
12948 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12949 CHECK(calls->peer_connected_meth != NULL);
12950 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12951 CHECK(calls->handle_reply_channel_range_meth != NULL);
12952 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12953 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12954 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12955 CHECK(calls->handle_query_channel_range_meth != NULL);
12956 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12957 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12959 LDKRoutingMessageHandler ret = {
12960 .this_arg = (void*) calls,
12961 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12962 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12963 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12964 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12965 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12966 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12967 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12968 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12969 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12970 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12971 .free = LDKRoutingMessageHandler_JCalls_free,
12972 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12974 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12978 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12979 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12980 return (uint64_t)res_ptr;
12982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12983 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
12984 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12985 DO_ASSERT((res_ptr & 1) == 0);
12986 return (int64_t)(res_ptr | 1);
12988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12989 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12991 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12992 LDKNodeAnnouncement msg_conv;
12993 msg_conv.inner = (void*)(msg & (~1));
12994 msg_conv.is_owned = false;
12995 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12996 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12997 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12998 return (int64_t)ret_conv;
13001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13002 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13003 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13004 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13005 LDKChannelAnnouncement msg_conv;
13006 msg_conv.inner = (void*)(msg & (~1));
13007 msg_conv.is_owned = false;
13008 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13009 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13010 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13011 return (int64_t)ret_conv;
13014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13015 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13016 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13017 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13018 LDKChannelUpdate msg_conv;
13019 msg_conv.inner = (void*)(msg & (~1));
13020 msg_conv.is_owned = false;
13021 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13022 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13023 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13024 return (int64_t)ret_conv;
13027 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) {
13028 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13030 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13031 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
13032 int64_tArray ret_arr = NULL;
13033 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13034 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13035 for (size_t h = 0; h < ret_var.datalen; h++) {
13036 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13037 *ret_conv_59_conv = ret_var.data[h];
13038 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
13040 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13041 FREE(ret_var.data);
13045 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) {
13046 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13047 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13048 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13049 LDKPublicKey starting_point_ref;
13050 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
13051 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
13052 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
13053 int64_tArray ret_arr = NULL;
13054 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13055 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13056 for (size_t s = 0; s < ret_var.datalen; s++) {
13057 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
13058 int64_t ret_conv_18_ref = 0;
13059 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13060 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
13062 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
13063 if (ret_conv_18_var.is_owned) {
13064 ret_conv_18_ref |= 1;
13066 ret_arr_ptr[s] = ret_conv_18_ref;
13068 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13069 FREE(ret_var.data);
13073 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) {
13074 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13075 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13076 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13077 LDKPublicKey their_node_id_ref;
13078 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13079 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13081 init_conv.inner = (void*)(init & (~1));
13082 init_conv.is_owned = false;
13083 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13084 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13087 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) {
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 LDKPublicKey their_node_id_ref;
13092 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13093 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13094 LDKReplyChannelRange msg_conv;
13095 msg_conv.inner = (void*)(msg & (~1));
13096 msg_conv.is_owned = (msg & 1) || (msg == 0);
13097 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13098 msg_conv = ReplyChannelRange_clone(&msg_conv);
13099 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13100 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13101 return (int64_t)ret_conv;
13104 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) {
13105 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13106 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13107 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13108 LDKPublicKey their_node_id_ref;
13109 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13110 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13111 LDKReplyShortChannelIdsEnd msg_conv;
13112 msg_conv.inner = (void*)(msg & (~1));
13113 msg_conv.is_owned = (msg & 1) || (msg == 0);
13114 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13115 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13116 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13117 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13118 return (int64_t)ret_conv;
13121 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) {
13122 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13123 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13124 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13125 LDKPublicKey their_node_id_ref;
13126 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13127 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13128 LDKQueryChannelRange msg_conv;
13129 msg_conv.inner = (void*)(msg & (~1));
13130 msg_conv.is_owned = (msg & 1) || (msg == 0);
13131 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13132 msg_conv = QueryChannelRange_clone(&msg_conv);
13133 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13134 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13135 return (int64_t)ret_conv;
13138 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) {
13139 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13140 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13141 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13142 LDKPublicKey their_node_id_ref;
13143 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13144 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13145 LDKQueryShortChannelIds msg_conv;
13146 msg_conv.inner = (void*)(msg & (~1));
13147 msg_conv.is_owned = (msg & 1) || (msg == 0);
13148 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13149 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13150 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13151 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13152 return (int64_t)ret_conv;
13155 typedef struct LDKCustomMessageReader_JCalls {
13156 atomic_size_t refcnt;
13159 jmethodID read_meth;
13160 } LDKCustomMessageReader_JCalls;
13161 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13162 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13163 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13165 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13166 if (get_jenv_res == JNI_EDETACHED) {
13167 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13169 DO_ASSERT(get_jenv_res == JNI_OK);
13171 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13172 if (get_jenv_res == JNI_EDETACHED) {
13173 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13178 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13179 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13181 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13182 if (get_jenv_res == JNI_EDETACHED) {
13183 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13185 DO_ASSERT(get_jenv_res == JNI_OK);
13187 int16_t message_type_conv = message_type;
13188 LDKu8slice buffer_var = buffer;
13189 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
13190 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
13191 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13192 CHECK(obj != NULL);
13193 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
13194 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13195 (*env)->ExceptionDescribe(env);
13196 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
13198 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13199 CHECK_ACCESS(ret_ptr);
13200 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13202 if (get_jenv_res == JNI_EDETACHED) {
13203 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13207 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13208 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13209 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13211 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
13212 jclass c = (*env)->GetObjectClass(env, o);
13214 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13215 atomic_init(&calls->refcnt, 1);
13216 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13217 calls->o = (*env)->NewWeakGlobalRef(env, o);
13218 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
13219 CHECK(calls->read_meth != NULL);
13221 LDKCustomMessageReader ret = {
13222 .this_arg = (void*) calls,
13223 .read = read_LDKCustomMessageReader_jcall,
13224 .free = LDKCustomMessageReader_JCalls_free,
13228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
13229 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13230 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
13231 return (uint64_t)res_ptr;
13233 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) {
13234 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13235 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13236 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13237 LDKu8slice buffer_ref;
13238 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
13239 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
13240 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13241 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13242 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
13243 return (int64_t)ret_conv;
13246 typedef struct LDKCustomMessageHandler_JCalls {
13247 atomic_size_t refcnt;
13250 LDKCustomMessageReader_JCalls* CustomMessageReader;
13251 jmethodID handle_custom_message_meth;
13252 jmethodID get_and_clear_pending_msg_meth;
13253 } LDKCustomMessageHandler_JCalls;
13254 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13255 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13256 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13258 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13259 if (get_jenv_res == JNI_EDETACHED) {
13260 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13262 DO_ASSERT(get_jenv_res == JNI_OK);
13264 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13265 if (get_jenv_res == JNI_EDETACHED) {
13266 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13271 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13272 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13274 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13275 if (get_jenv_res == JNI_EDETACHED) {
13276 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13278 DO_ASSERT(get_jenv_res == JNI_OK);
13280 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13282 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
13283 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
13284 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13285 CHECK(obj != NULL);
13286 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
13287 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13288 (*env)->ExceptionDescribe(env);
13289 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
13291 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13292 CHECK_ACCESS(ret_ptr);
13293 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13295 if (get_jenv_res == JNI_EDETACHED) {
13296 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13300 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13301 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13303 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13304 if (get_jenv_res == JNI_EDETACHED) {
13305 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13307 DO_ASSERT(get_jenv_res == JNI_OK);
13309 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13310 CHECK(obj != NULL);
13311 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
13312 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13313 (*env)->ExceptionDescribe(env);
13314 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
13316 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13317 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13318 if (ret_constr.datalen > 0)
13319 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13321 ret_constr.data = NULL;
13322 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13323 for (size_t z = 0; z < ret_constr.datalen; z++) {
13324 int64_t ret_conv_25 = ret_vals[z];
13325 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
13326 CHECK_ACCESS(ret_conv_25_ptr);
13327 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13328 FREE((void*)ret_conv_25);
13329 ret_constr.data[z] = ret_conv_25_conv;
13331 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13332 if (get_jenv_res == JNI_EDETACHED) {
13333 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13337 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13338 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13339 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13340 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13342 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13343 jclass c = (*env)->GetObjectClass(env, o);
13345 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13346 atomic_init(&calls->refcnt, 1);
13347 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13348 calls->o = (*env)->NewWeakGlobalRef(env, o);
13349 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
13350 CHECK(calls->handle_custom_message_meth != NULL);
13351 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
13352 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
13354 LDKCustomMessageHandler ret = {
13355 .this_arg = (void*) calls,
13356 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13357 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13358 .free = LDKCustomMessageHandler_JCalls_free,
13359 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
13361 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13365 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13366 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
13367 return (uint64_t)res_ptr;
13369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
13370 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
13371 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
13372 DO_ASSERT((res_ptr & 1) == 0);
13373 return (int64_t)(res_ptr | 1);
13375 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) {
13376 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13377 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13378 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13379 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
13380 CHECK_ACCESS(msg_ptr);
13381 LDKType msg_conv = *(LDKType*)(msg_ptr);
13382 if (msg_conv.free == LDKType_JCalls_free) {
13383 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13384 LDKType_JCalls_cloned(&msg_conv);
13386 LDKPublicKey sender_node_id_ref;
13387 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
13388 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
13389 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13390 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13391 return (int64_t)ret_conv;
13394 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
13395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13397 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13398 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13399 int64_tArray ret_arr = NULL;
13400 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13401 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13402 for (size_t z = 0; z < ret_var.datalen; z++) {
13403 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13404 *ret_conv_25_conv = ret_var.data[z];
13405 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
13407 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13408 FREE(ret_var.data);
13412 typedef struct LDKSocketDescriptor_JCalls {
13413 atomic_size_t refcnt;
13416 jmethodID send_data_meth;
13417 jmethodID disconnect_socket_meth;
13419 jmethodID hash_meth;
13420 } LDKSocketDescriptor_JCalls;
13421 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13422 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13423 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13425 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13426 if (get_jenv_res == JNI_EDETACHED) {
13427 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13429 DO_ASSERT(get_jenv_res == JNI_OK);
13431 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13432 if (get_jenv_res == JNI_EDETACHED) {
13433 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13438 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13439 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13441 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13442 if (get_jenv_res == JNI_EDETACHED) {
13443 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13445 DO_ASSERT(get_jenv_res == JNI_OK);
13447 LDKu8slice data_var = data;
13448 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
13449 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
13450 jboolean resume_read_conv = resume_read;
13451 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13452 CHECK(obj != NULL);
13453 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
13454 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13455 (*env)->ExceptionDescribe(env);
13456 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
13458 if (get_jenv_res == JNI_EDETACHED) {
13459 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13463 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13464 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13466 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13467 if (get_jenv_res == JNI_EDETACHED) {
13468 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13470 DO_ASSERT(get_jenv_res == JNI_OK);
13472 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13473 CHECK(obj != NULL);
13474 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
13475 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13476 (*env)->ExceptionDescribe(env);
13477 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
13479 if (get_jenv_res == JNI_EDETACHED) {
13480 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13483 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13484 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13486 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13487 if (get_jenv_res == JNI_EDETACHED) {
13488 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13490 DO_ASSERT(get_jenv_res == JNI_OK);
13492 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13493 *other_arg_clone = SocketDescriptor_clone(other_arg);
13494 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13495 CHECK(obj != NULL);
13496 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
13497 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13498 (*env)->ExceptionDescribe(env);
13499 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
13501 if (get_jenv_res == JNI_EDETACHED) {
13502 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13506 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13507 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13509 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13510 if (get_jenv_res == JNI_EDETACHED) {
13511 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13513 DO_ASSERT(get_jenv_res == JNI_OK);
13515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13516 CHECK(obj != NULL);
13517 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
13518 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13519 (*env)->ExceptionDescribe(env);
13520 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
13522 if (get_jenv_res == JNI_EDETACHED) {
13523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13527 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13528 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13529 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13531 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
13532 jclass c = (*env)->GetObjectClass(env, o);
13534 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13535 atomic_init(&calls->refcnt, 1);
13536 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13537 calls->o = (*env)->NewWeakGlobalRef(env, o);
13538 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
13539 CHECK(calls->send_data_meth != NULL);
13540 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
13541 CHECK(calls->disconnect_socket_meth != NULL);
13542 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
13543 CHECK(calls->eq_meth != NULL);
13544 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
13545 CHECK(calls->hash_meth != NULL);
13547 LDKSocketDescriptor ret = {
13548 .this_arg = (void*) calls,
13549 .send_data = send_data_LDKSocketDescriptor_jcall,
13550 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13551 .eq = eq_LDKSocketDescriptor_jcall,
13552 .hash = hash_LDKSocketDescriptor_jcall,
13553 .cloned = LDKSocketDescriptor_JCalls_cloned,
13554 .free = LDKSocketDescriptor_JCalls_free,
13558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
13559 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13560 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
13561 return (uint64_t)res_ptr;
13563 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) {
13564 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13565 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13566 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13567 LDKu8slice data_ref;
13568 data_ref.datalen = (*env)->GetArrayLength(env, data);
13569 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
13570 int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
13571 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
13575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
13576 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13578 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13579 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
13582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
13583 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13584 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13585 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13586 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
13590 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
13591 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
13592 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
13593 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
13594 static jclass LDKEffectiveCapacity_Total_class = NULL;
13595 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
13596 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
13597 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
13598 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
13599 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
13600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
13601 LDKEffectiveCapacity_ExactLiquidity_class =
13602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
13603 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
13604 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
13605 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
13606 LDKEffectiveCapacity_MaximumHTLC_class =
13607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
13608 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
13609 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
13610 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
13611 LDKEffectiveCapacity_Total_class =
13612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
13613 CHECK(LDKEffectiveCapacity_Total_class != NULL);
13614 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(J)V");
13615 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
13616 LDKEffectiveCapacity_Infinite_class =
13617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
13618 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
13619 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
13620 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
13621 LDKEffectiveCapacity_Unknown_class =
13622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
13623 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
13624 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
13625 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
13627 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13628 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
13630 case LDKEffectiveCapacity_ExactLiquidity: {
13631 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
13632 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
13634 case LDKEffectiveCapacity_MaximumHTLC: {
13635 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
13636 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
13638 case LDKEffectiveCapacity_Total: {
13639 int64_t capacity_msat_conv = obj->total.capacity_msat;
13640 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv);
13642 case LDKEffectiveCapacity_Infinite: {
13643 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
13645 case LDKEffectiveCapacity_Unknown: {
13646 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
13651 typedef struct LDKLockableScore_JCalls {
13652 atomic_size_t refcnt;
13655 jmethodID lock_meth;
13656 } LDKLockableScore_JCalls;
13657 static void LDKLockableScore_JCalls_free(void* this_arg) {
13658 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13659 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13661 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13662 if (get_jenv_res == JNI_EDETACHED) {
13663 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13665 DO_ASSERT(get_jenv_res == JNI_OK);
13667 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13668 if (get_jenv_res == JNI_EDETACHED) {
13669 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13674 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13675 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13677 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13678 if (get_jenv_res == JNI_EDETACHED) {
13679 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13681 DO_ASSERT(get_jenv_res == JNI_OK);
13683 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13684 CHECK(obj != NULL);
13685 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13686 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13687 (*env)->ExceptionDescribe(env);
13688 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13690 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13691 CHECK_ACCESS(ret_ptr);
13692 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13693 if (ret_conv.free == LDKScore_JCalls_free) {
13694 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13695 LDKScore_JCalls_cloned(&ret_conv);
13696 }// WARNING: we may need a move here but no clone is available for LDKScore
13698 if (get_jenv_res == JNI_EDETACHED) {
13699 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13703 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13704 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13705 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13707 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13708 jclass c = (*env)->GetObjectClass(env, o);
13710 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13711 atomic_init(&calls->refcnt, 1);
13712 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13713 calls->o = (*env)->NewWeakGlobalRef(env, o);
13714 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13715 CHECK(calls->lock_meth != NULL);
13717 LDKLockableScore ret = {
13718 .this_arg = (void*) calls,
13719 .lock = lock_LDKLockableScore_jcall,
13720 .free = LDKLockableScore_JCalls_free,
13724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13725 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13726 *res_ptr = LDKLockableScore_init(env, clz, o);
13727 return (uint64_t)res_ptr;
13729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13730 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13731 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13732 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13733 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13734 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13735 return (int64_t)ret_ret;
13738 static jclass LDKGossipSync_P2P_class = NULL;
13739 static jmethodID LDKGossipSync_P2P_meth = NULL;
13740 static jclass LDKGossipSync_Rapid_class = NULL;
13741 static jmethodID LDKGossipSync_Rapid_meth = NULL;
13742 static jclass LDKGossipSync_None_class = NULL;
13743 static jmethodID LDKGossipSync_None_meth = NULL;
13744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
13745 LDKGossipSync_P2P_class =
13746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
13747 CHECK(LDKGossipSync_P2P_class != NULL);
13748 LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
13749 CHECK(LDKGossipSync_P2P_meth != NULL);
13750 LDKGossipSync_Rapid_class =
13751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
13752 CHECK(LDKGossipSync_Rapid_class != NULL);
13753 LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
13754 CHECK(LDKGossipSync_Rapid_meth != NULL);
13755 LDKGossipSync_None_class =
13756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
13757 CHECK(LDKGossipSync_None_class != NULL);
13758 LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
13759 CHECK(LDKGossipSync_None_meth != NULL);
13761 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13762 LDKGossipSync *obj = (LDKGossipSync*)(ptr & ~1);
13764 case LDKGossipSync_P2P: {
13765 LDKP2PGossipSync p2p_var = obj->p2p;
13766 int64_t p2p_ref = 0;
13767 CHECK((((uintptr_t)p2p_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13768 CHECK((((uintptr_t)&p2p_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13769 CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
13770 p2p_ref = (uintptr_t)p2p_var.inner & ~1;
13771 return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
13773 case LDKGossipSync_Rapid: {
13774 LDKRapidGossipSync rapid_var = obj->rapid;
13775 int64_t rapid_ref = 0;
13776 CHECK((((uintptr_t)rapid_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13777 CHECK((((uintptr_t)&rapid_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13778 CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
13779 rapid_ref = (uintptr_t)rapid_var.inner & ~1;
13780 return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
13782 case LDKGossipSync_None: {
13783 return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
13788 static jclass LDKFallback_SegWitProgram_class = NULL;
13789 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13790 static jclass LDKFallback_PubKeyHash_class = NULL;
13791 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13792 static jclass LDKFallback_ScriptHash_class = NULL;
13793 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13795 LDKFallback_SegWitProgram_class =
13796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13797 CHECK(LDKFallback_SegWitProgram_class != NULL);
13798 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13799 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13800 LDKFallback_PubKeyHash_class =
13801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13802 CHECK(LDKFallback_PubKeyHash_class != NULL);
13803 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13804 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13805 LDKFallback_ScriptHash_class =
13806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13807 CHECK(LDKFallback_ScriptHash_class != NULL);
13808 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13809 CHECK(LDKFallback_ScriptHash_meth != NULL);
13811 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13812 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13814 case LDKFallback_SegWitProgram: {
13815 uint8_t version_val = obj->seg_wit_program.version._0;
13816 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13817 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13818 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13819 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13821 case LDKFallback_PubKeyHash: {
13822 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13823 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13824 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13826 case LDKFallback_ScriptHash: {
13827 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13828 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13829 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13834 typedef struct LDKPayer_JCalls {
13835 atomic_size_t refcnt;
13838 jmethodID node_id_meth;
13839 jmethodID first_hops_meth;
13840 jmethodID send_payment_meth;
13841 jmethodID send_spontaneous_payment_meth;
13842 jmethodID retry_payment_meth;
13843 jmethodID abandon_payment_meth;
13845 static void LDKPayer_JCalls_free(void* this_arg) {
13846 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13847 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13849 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13850 if (get_jenv_res == JNI_EDETACHED) {
13851 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13853 DO_ASSERT(get_jenv_res == JNI_OK);
13855 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13856 if (get_jenv_res == JNI_EDETACHED) {
13857 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13862 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13863 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13865 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13866 if (get_jenv_res == JNI_EDETACHED) {
13867 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13869 DO_ASSERT(get_jenv_res == JNI_OK);
13871 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13872 CHECK(obj != NULL);
13873 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13874 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13875 (*env)->ExceptionDescribe(env);
13876 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13878 LDKPublicKey ret_ref;
13879 CHECK((*env)->GetArrayLength(env, ret) == 33);
13880 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13881 if (get_jenv_res == JNI_EDETACHED) {
13882 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13886 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13887 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13889 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13890 if (get_jenv_res == JNI_EDETACHED) {
13891 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13893 DO_ASSERT(get_jenv_res == JNI_OK);
13895 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13896 CHECK(obj != NULL);
13897 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13898 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13899 (*env)->ExceptionDescribe(env);
13900 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13902 LDKCVec_ChannelDetailsZ ret_constr;
13903 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13904 if (ret_constr.datalen > 0)
13905 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13907 ret_constr.data = NULL;
13908 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13909 for (size_t q = 0; q < ret_constr.datalen; q++) {
13910 int64_t ret_conv_16 = ret_vals[q];
13911 LDKChannelDetails ret_conv_16_conv;
13912 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
13913 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
13914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13915 ret_constr.data[q] = ret_conv_16_conv;
13917 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13918 if (get_jenv_res == JNI_EDETACHED) {
13919 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13923 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13924 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13926 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13927 if (get_jenv_res == JNI_EDETACHED) {
13928 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13930 DO_ASSERT(get_jenv_res == JNI_OK);
13932 LDKRoute route_var = *route;
13933 int64_t route_ref = 0;
13934 route_var = Route_clone(&route_var);
13935 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13936 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13937 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13938 route_ref = (uintptr_t)route_var.inner;
13939 if (route_var.is_owned) {
13942 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13943 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13944 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13945 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13946 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13947 CHECK(obj != NULL);
13948 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13949 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13950 (*env)->ExceptionDescribe(env);
13951 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13953 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13954 CHECK_ACCESS(ret_ptr);
13955 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13957 if (get_jenv_res == JNI_EDETACHED) {
13958 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13962 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
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 LDKRoute route_var = *route;
13972 int64_t route_ref = 0;
13973 route_var = Route_clone(&route_var);
13974 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13975 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13976 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13977 route_ref = (uintptr_t)route_var.inner;
13978 if (route_var.is_owned) {
13981 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13982 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13983 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13984 CHECK(obj != NULL);
13985 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13986 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13987 (*env)->ExceptionDescribe(env);
13988 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13990 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13991 CHECK_ACCESS(ret_ptr);
13992 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13994 if (get_jenv_res == JNI_EDETACHED) {
13995 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13999 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
14000 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14002 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14003 if (get_jenv_res == JNI_EDETACHED) {
14004 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14006 DO_ASSERT(get_jenv_res == JNI_OK);
14008 LDKRoute route_var = *route;
14009 int64_t route_ref = 0;
14010 route_var = Route_clone(&route_var);
14011 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14012 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14013 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14014 route_ref = (uintptr_t)route_var.inner;
14015 if (route_var.is_owned) {
14018 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14019 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14020 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14021 CHECK(obj != NULL);
14022 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
14023 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14024 (*env)->ExceptionDescribe(env);
14025 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
14027 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14028 CHECK_ACCESS(ret_ptr);
14029 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
14031 if (get_jenv_res == JNI_EDETACHED) {
14032 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14036 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
14037 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14039 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14040 if (get_jenv_res == JNI_EDETACHED) {
14041 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14043 DO_ASSERT(get_jenv_res == JNI_OK);
14045 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14046 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14047 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14048 CHECK(obj != NULL);
14049 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
14050 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14051 (*env)->ExceptionDescribe(env);
14052 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
14054 if (get_jenv_res == JNI_EDETACHED) {
14055 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14058 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
14059 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
14060 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14062 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
14063 jclass c = (*env)->GetObjectClass(env, o);
14065 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
14066 atomic_init(&calls->refcnt, 1);
14067 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14068 calls->o = (*env)->NewWeakGlobalRef(env, o);
14069 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
14070 CHECK(calls->node_id_meth != NULL);
14071 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
14072 CHECK(calls->first_hops_meth != NULL);
14073 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
14074 CHECK(calls->send_payment_meth != NULL);
14075 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
14076 CHECK(calls->send_spontaneous_payment_meth != NULL);
14077 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
14078 CHECK(calls->retry_payment_meth != NULL);
14079 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
14080 CHECK(calls->abandon_payment_meth != NULL);
14083 .this_arg = (void*) calls,
14084 .node_id = node_id_LDKPayer_jcall,
14085 .first_hops = first_hops_LDKPayer_jcall,
14086 .send_payment = send_payment_LDKPayer_jcall,
14087 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
14088 .retry_payment = retry_payment_LDKPayer_jcall,
14089 .abandon_payment = abandon_payment_LDKPayer_jcall,
14090 .free = LDKPayer_JCalls_free,
14094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
14095 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
14096 *res_ptr = LDKPayer_init(env, clz, o);
14097 return (uint64_t)res_ptr;
14099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14100 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14101 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14102 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14103 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
14108 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
14109 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14110 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14111 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14112 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
14113 int64_tArray ret_arr = NULL;
14114 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14115 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14116 for (size_t q = 0; q < ret_var.datalen; q++) {
14117 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14118 int64_t ret_conv_16_ref = 0;
14119 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14120 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
14122 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
14123 if (ret_conv_16_var.is_owned) {
14124 ret_conv_16_ref |= 1;
14126 ret_arr_ptr[q] = ret_conv_16_ref;
14128 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14129 FREE(ret_var.data);
14133 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) {
14134 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14136 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14137 LDKRoute route_conv;
14138 route_conv.inner = (void*)(route & (~1));
14139 route_conv.is_owned = false;
14140 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14141 LDKThirtyTwoBytes payment_hash_ref;
14142 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14143 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14144 LDKThirtyTwoBytes payment_secret_ref;
14145 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14146 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14147 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14148 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
14149 return (int64_t)ret_conv;
14152 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) {
14153 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14154 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14155 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14156 LDKRoute route_conv;
14157 route_conv.inner = (void*)(route & (~1));
14158 route_conv.is_owned = false;
14159 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14160 LDKThirtyTwoBytes payment_preimage_ref;
14161 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14162 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14163 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14164 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
14165 return (int64_t)ret_conv;
14168 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) {
14169 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14170 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14171 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14172 LDKRoute route_conv;
14173 route_conv.inner = (void*)(route & (~1));
14174 route_conv.is_owned = false;
14175 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14176 LDKThirtyTwoBytes payment_id_ref;
14177 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14178 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14179 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14180 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
14181 return (int64_t)ret_conv;
14184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
14185 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14186 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14187 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14188 LDKThirtyTwoBytes payment_id_ref;
14189 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14190 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14191 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
14194 typedef struct LDKRouter_JCalls {
14195 atomic_size_t refcnt;
14198 jmethodID find_route_meth;
14199 } LDKRouter_JCalls;
14200 static void LDKRouter_JCalls_free(void* this_arg) {
14201 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14202 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14204 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14205 if (get_jenv_res == JNI_EDETACHED) {
14206 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14208 DO_ASSERT(get_jenv_res == JNI_OK);
14210 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14211 if (get_jenv_res == JNI_EDETACHED) {
14212 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14217 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) {
14218 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14220 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14221 if (get_jenv_res == JNI_EDETACHED) {
14222 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14224 DO_ASSERT(get_jenv_res == JNI_OK);
14226 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
14227 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
14228 LDKRouteParameters route_params_var = *route_params;
14229 int64_t route_params_ref = 0;
14230 route_params_var = RouteParameters_clone(&route_params_var);
14231 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14232 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14233 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
14234 route_params_ref = (uintptr_t)route_params_var.inner;
14235 if (route_params_var.is_owned) {
14236 route_params_ref |= 1;
14238 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14239 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
14240 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
14241 int64_tArray first_hops_arr = NULL;
14242 if (first_hops != NULL) {
14243 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
14244 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
14245 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
14246 for (size_t q = 0; q < first_hops_var.datalen; q++) {
14247 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
14248 int64_t first_hops_conv_16_ref = 0;
14249 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14250 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14251 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
14252 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
14253 if (first_hops_conv_16_var.is_owned) {
14254 first_hops_conv_16_ref |= 1;
14256 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
14258 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
14260 // WARNING: This object doesn't live past this scope, needs clone!
14261 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
14262 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14263 CHECK(obj != NULL);
14264 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);
14265 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14266 (*env)->ExceptionDescribe(env);
14267 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
14269 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14270 CHECK_ACCESS(ret_ptr);
14271 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
14273 if (get_jenv_res == JNI_EDETACHED) {
14274 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14278 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14279 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14280 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14282 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14283 jclass c = (*env)->GetObjectClass(env, o);
14285 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14286 atomic_init(&calls->refcnt, 1);
14287 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14288 calls->o = (*env)->NewWeakGlobalRef(env, o);
14289 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14290 CHECK(calls->find_route_meth != NULL);
14293 .this_arg = (void*) calls,
14294 .find_route = find_route_LDKRouter_jcall,
14295 .free = LDKRouter_JCalls_free,
14299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14300 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14301 *res_ptr = LDKRouter_init(env, clz, o);
14302 return (uint64_t)res_ptr;
14304 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) {
14305 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14306 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14307 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14308 LDKPublicKey payer_ref;
14309 CHECK((*env)->GetArrayLength(env, payer) == 33);
14310 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14311 LDKRouteParameters route_params_conv;
14312 route_params_conv.inner = (void*)(route_params & (~1));
14313 route_params_conv.is_owned = false;
14314 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14315 unsigned char payment_hash_arr[32];
14316 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14317 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14318 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14319 LDKCVec_ChannelDetailsZ first_hops_constr;
14320 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14321 if (first_hops != NULL) {
14322 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14323 if (first_hops_constr.datalen > 0)
14324 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14326 first_hops_constr.data = NULL;
14327 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14328 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14329 int64_t first_hops_conv_16 = first_hops_vals[q];
14330 LDKChannelDetails first_hops_conv_16_conv;
14331 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
14332 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
14333 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14334 first_hops_constr.data[q] = first_hops_conv_16_conv;
14336 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14337 first_hops_ptr = &first_hops_constr;
14339 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14340 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14341 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14342 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14343 *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);
14344 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14345 return (int64_t)ret_conv;
14348 static jclass LDKRetry_Attempts_class = NULL;
14349 static jmethodID LDKRetry_Attempts_meth = NULL;
14350 static jclass LDKRetry_Timeout_class = NULL;
14351 static jmethodID LDKRetry_Timeout_meth = NULL;
14352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14353 LDKRetry_Attempts_class =
14354 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14355 CHECK(LDKRetry_Attempts_class != NULL);
14356 LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14357 CHECK(LDKRetry_Attempts_meth != NULL);
14358 LDKRetry_Timeout_class =
14359 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14360 CHECK(LDKRetry_Timeout_class != NULL);
14361 LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14362 CHECK(LDKRetry_Timeout_meth != NULL);
14364 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14365 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
14367 case LDKRetry_Attempts: {
14368 int64_t attempts_conv = obj->attempts;
14369 return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14371 case LDKRetry_Timeout: {
14372 int64_t timeout_conv = obj->timeout;
14373 return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14378 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14379 LDKStr ret_str = _ldk_get_compiled_version();
14380 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14385 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14386 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14387 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14392 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14393 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14394 *ret_copy = Bech32Error_clone(arg);
14395 int64_t ret_ref = (uintptr_t)ret_copy;
14398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14399 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14400 int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14405 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14406 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14407 *ret_copy = Bech32Error_clone(orig_conv);
14408 int64_t ret_ref = (uintptr_t)ret_copy;
14412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14413 if ((o & 1) != 0) return;
14414 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14415 CHECK_ACCESS(o_ptr);
14416 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14418 Bech32Error_free(o_conv);
14421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14422 LDKTransaction _res_ref;
14423 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14424 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14425 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14426 _res_ref.data_is_owned = true;
14427 Transaction_free(_res_ref);
14430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14431 LDKCVec_u8Z script_pubkey_ref;
14432 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14433 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14434 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14435 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14436 *ret_ref = TxOut_new(script_pubkey_ref, value);
14437 return (int64_t)ret_ref;
14440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14441 if ((_res & 1) != 0) return;
14442 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14443 CHECK_ACCESS(_res_ptr);
14444 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14446 TxOut_free(_res_conv);
14449 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14450 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14451 *ret_ref = TxOut_clone(arg);
14452 return (int64_t)ret_ref;
14454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14455 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14456 int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14461 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14462 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14463 *ret_ref = TxOut_clone(orig_conv);
14464 return (int64_t)ret_ref;
14467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14468 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14473 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14474 *ret_conv = CResult_NoneNoneZ_ok();
14475 return (int64_t)ret_conv;
14478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14479 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14480 *ret_conv = CResult_NoneNoneZ_err();
14481 return (int64_t)ret_conv;
14484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14485 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14486 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14491 if ((_res & 1) != 0) return;
14492 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14493 CHECK_ACCESS(_res_ptr);
14494 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14496 CResult_NoneNoneZ_free(_res_conv);
14499 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14500 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14501 *ret_conv = CResult_NoneNoneZ_clone(arg);
14502 return (int64_t)ret_conv;
14504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14505 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14506 int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14511 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14512 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14513 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14514 return (int64_t)ret_conv;
14517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14518 LDKCounterpartyCommitmentSecrets o_conv;
14519 o_conv.inner = (void*)(o & (~1));
14520 o_conv.is_owned = (o & 1) || (o == 0);
14521 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14522 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14523 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14524 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14525 return (int64_t)ret_conv;
14528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14529 LDKDecodeError e_conv;
14530 e_conv.inner = (void*)(e & (~1));
14531 e_conv.is_owned = (e & 1) || (e == 0);
14532 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14533 e_conv = DecodeError_clone(&e_conv);
14534 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14535 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14536 return (int64_t)ret_conv;
14539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14540 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14541 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14546 if ((_res & 1) != 0) return;
14547 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14548 CHECK_ACCESS(_res_ptr);
14549 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14551 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14554 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14555 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14556 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14557 return (int64_t)ret_conv;
14559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14560 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14561 int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14566 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
14567 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14568 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14569 return (int64_t)ret_conv;
14572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14573 LDKSecretKey o_ref;
14574 CHECK((*env)->GetArrayLength(env, o) == 32);
14575 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
14576 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14577 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
14578 return (int64_t)ret_conv;
14581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14582 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14583 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14584 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
14585 return (int64_t)ret_conv;
14588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14589 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
14590 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
14594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14595 if ((_res & 1) != 0) return;
14596 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14597 CHECK_ACCESS(_res_ptr);
14598 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
14600 CResult_SecretKeyErrorZ_free(_res_conv);
14603 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
14604 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14605 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
14606 return (int64_t)ret_conv;
14608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14609 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
14610 int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
14614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14615 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
14616 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14617 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
14618 return (int64_t)ret_conv;
14621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14622 LDKPublicKey o_ref;
14623 CHECK((*env)->GetArrayLength(env, o) == 33);
14624 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
14625 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14626 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
14627 return (int64_t)ret_conv;
14630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14631 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14632 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14633 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
14634 return (int64_t)ret_conv;
14637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14638 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
14639 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
14643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14644 if ((_res & 1) != 0) return;
14645 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14646 CHECK_ACCESS(_res_ptr);
14647 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
14649 CResult_PublicKeyErrorZ_free(_res_conv);
14652 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
14653 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14654 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
14655 return (int64_t)ret_conv;
14657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14658 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
14659 int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
14663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14664 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
14665 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14666 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14667 return (int64_t)ret_conv;
14670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14671 LDKTxCreationKeys o_conv;
14672 o_conv.inner = (void*)(o & (~1));
14673 o_conv.is_owned = (o & 1) || (o == 0);
14674 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14675 o_conv = TxCreationKeys_clone(&o_conv);
14676 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14677 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14678 return (int64_t)ret_conv;
14681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14682 LDKDecodeError e_conv;
14683 e_conv.inner = (void*)(e & (~1));
14684 e_conv.is_owned = (e & 1) || (e == 0);
14685 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14686 e_conv = DecodeError_clone(&e_conv);
14687 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14688 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14689 return (int64_t)ret_conv;
14692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14693 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
14694 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14699 if ((_res & 1) != 0) return;
14700 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14701 CHECK_ACCESS(_res_ptr);
14702 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14704 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14707 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14708 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14709 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14710 return (int64_t)ret_conv;
14712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14713 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
14714 int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14719 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
14720 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14721 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14722 return (int64_t)ret_conv;
14725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14726 LDKChannelPublicKeys o_conv;
14727 o_conv.inner = (void*)(o & (~1));
14728 o_conv.is_owned = (o & 1) || (o == 0);
14729 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14730 o_conv = ChannelPublicKeys_clone(&o_conv);
14731 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14732 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14733 return (int64_t)ret_conv;
14736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14737 LDKDecodeError e_conv;
14738 e_conv.inner = (void*)(e & (~1));
14739 e_conv.is_owned = (e & 1) || (e == 0);
14740 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14741 e_conv = DecodeError_clone(&e_conv);
14742 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14743 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14744 return (int64_t)ret_conv;
14747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14748 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
14749 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14754 if ((_res & 1) != 0) return;
14755 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14756 CHECK_ACCESS(_res_ptr);
14757 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14759 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14762 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14763 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14764 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14765 return (int64_t)ret_conv;
14767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14768 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
14769 int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14774 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
14775 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14776 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14777 return (int64_t)ret_conv;
14780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14781 LDKTxCreationKeys o_conv;
14782 o_conv.inner = (void*)(o & (~1));
14783 o_conv.is_owned = (o & 1) || (o == 0);
14784 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14785 o_conv = TxCreationKeys_clone(&o_conv);
14786 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14787 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14788 return (int64_t)ret_conv;
14791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14792 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14793 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14794 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14795 return (int64_t)ret_conv;
14798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14799 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
14800 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14805 if ((_res & 1) != 0) return;
14806 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14807 CHECK_ACCESS(_res_ptr);
14808 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14810 CResult_TxCreationKeysErrorZ_free(_res_conv);
14813 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14814 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14815 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14816 return (int64_t)ret_conv;
14818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14819 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14820 int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14825 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14826 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14827 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14828 return (int64_t)ret_conv;
14831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14832 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14833 *ret_copy = COption_u32Z_some(o);
14834 int64_t ret_ref = (uintptr_t)ret_copy;
14838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14839 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14840 *ret_copy = COption_u32Z_none();
14841 int64_t ret_ref = (uintptr_t)ret_copy;
14845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14846 if ((_res & 1) != 0) return;
14847 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14848 CHECK_ACCESS(_res_ptr);
14849 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14851 COption_u32Z_free(_res_conv);
14854 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14855 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14856 *ret_copy = COption_u32Z_clone(arg);
14857 int64_t ret_ref = (uintptr_t)ret_copy;
14860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14861 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14862 int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
14866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14867 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14868 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14869 *ret_copy = COption_u32Z_clone(orig_conv);
14870 int64_t ret_ref = (uintptr_t)ret_copy;
14874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14875 LDKHTLCOutputInCommitment o_conv;
14876 o_conv.inner = (void*)(o & (~1));
14877 o_conv.is_owned = (o & 1) || (o == 0);
14878 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14879 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14880 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14881 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14882 return (int64_t)ret_conv;
14885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14886 LDKDecodeError e_conv;
14887 e_conv.inner = (void*)(e & (~1));
14888 e_conv.is_owned = (e & 1) || (e == 0);
14889 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14890 e_conv = DecodeError_clone(&e_conv);
14891 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14892 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14893 return (int64_t)ret_conv;
14896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14897 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14898 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14903 if ((_res & 1) != 0) return;
14904 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14905 CHECK_ACCESS(_res_ptr);
14906 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14908 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14911 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14912 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14913 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14914 return (int64_t)ret_conv;
14916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14917 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
14918 int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14923 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
14924 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14925 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14926 return (int64_t)ret_conv;
14929 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14930 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14934 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14935 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14940 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14941 COption_NoneZ_free(_res_conv);
14944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14945 LDKCounterpartyChannelTransactionParameters o_conv;
14946 o_conv.inner = (void*)(o & (~1));
14947 o_conv.is_owned = (o & 1) || (o == 0);
14948 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14949 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14950 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14951 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14952 return (int64_t)ret_conv;
14955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14956 LDKDecodeError e_conv;
14957 e_conv.inner = (void*)(e & (~1));
14958 e_conv.is_owned = (e & 1) || (e == 0);
14959 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14960 e_conv = DecodeError_clone(&e_conv);
14961 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14962 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14963 return (int64_t)ret_conv;
14966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14967 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14968 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14973 if ((_res & 1) != 0) return;
14974 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14975 CHECK_ACCESS(_res_ptr);
14976 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14978 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14981 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14982 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14983 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14984 return (int64_t)ret_conv;
14986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14987 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14988 int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14993 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14994 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14995 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14996 return (int64_t)ret_conv;
14999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15000 LDKChannelTransactionParameters o_conv;
15001 o_conv.inner = (void*)(o & (~1));
15002 o_conv.is_owned = (o & 1) || (o == 0);
15003 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15004 o_conv = ChannelTransactionParameters_clone(&o_conv);
15005 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15006 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15007 return (int64_t)ret_conv;
15010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15011 LDKDecodeError e_conv;
15012 e_conv.inner = (void*)(e & (~1));
15013 e_conv.is_owned = (e & 1) || (e == 0);
15014 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15015 e_conv = DecodeError_clone(&e_conv);
15016 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15017 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15018 return (int64_t)ret_conv;
15021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15022 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15023 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15028 if ((_res & 1) != 0) return;
15029 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15030 CHECK_ACCESS(_res_ptr);
15031 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15033 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15036 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15037 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15038 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15039 return (int64_t)ret_conv;
15041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15042 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15043 int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15048 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15049 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15050 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15051 return (int64_t)ret_conv;
15054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15055 LDKCVec_SignatureZ _res_constr;
15056 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15057 if (_res_constr.datalen > 0)
15058 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15060 _res_constr.data = NULL;
15061 for (size_t i = 0; i < _res_constr.datalen; i++) {
15062 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15063 LDKSignature _res_conv_8_ref;
15064 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
15065 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
15066 _res_constr.data[i] = _res_conv_8_ref;
15068 CVec_SignatureZ_free(_res_constr);
15071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15072 LDKHolderCommitmentTransaction o_conv;
15073 o_conv.inner = (void*)(o & (~1));
15074 o_conv.is_owned = (o & 1) || (o == 0);
15075 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15076 o_conv = HolderCommitmentTransaction_clone(&o_conv);
15077 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15078 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15079 return (int64_t)ret_conv;
15082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15083 LDKDecodeError e_conv;
15084 e_conv.inner = (void*)(e & (~1));
15085 e_conv.is_owned = (e & 1) || (e == 0);
15086 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15087 e_conv = DecodeError_clone(&e_conv);
15088 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15089 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15090 return (int64_t)ret_conv;
15093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15094 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
15095 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15100 if ((_res & 1) != 0) return;
15101 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15102 CHECK_ACCESS(_res_ptr);
15103 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15105 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15108 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15109 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15110 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15111 return (int64_t)ret_conv;
15113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15114 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15115 int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15120 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15121 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15122 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15123 return (int64_t)ret_conv;
15126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15127 LDKBuiltCommitmentTransaction o_conv;
15128 o_conv.inner = (void*)(o & (~1));
15129 o_conv.is_owned = (o & 1) || (o == 0);
15130 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15131 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15132 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15133 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15134 return (int64_t)ret_conv;
15137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15138 LDKDecodeError e_conv;
15139 e_conv.inner = (void*)(e & (~1));
15140 e_conv.is_owned = (e & 1) || (e == 0);
15141 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15142 e_conv = DecodeError_clone(&e_conv);
15143 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15144 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15145 return (int64_t)ret_conv;
15148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15149 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
15150 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15155 if ((_res & 1) != 0) return;
15156 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15157 CHECK_ACCESS(_res_ptr);
15158 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15160 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15163 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15164 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15165 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15166 return (int64_t)ret_conv;
15168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15169 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15170 int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15175 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15176 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15177 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15178 return (int64_t)ret_conv;
15181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15182 LDKTrustedClosingTransaction o_conv;
15183 o_conv.inner = (void*)(o & (~1));
15184 o_conv.is_owned = (o & 1) || (o == 0);
15185 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15186 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15187 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15188 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15189 return (int64_t)ret_conv;
15192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15193 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15194 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15195 return (int64_t)ret_conv;
15198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15199 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
15200 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15205 if ((_res & 1) != 0) return;
15206 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15207 CHECK_ACCESS(_res_ptr);
15208 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15210 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15214 LDKCommitmentTransaction o_conv;
15215 o_conv.inner = (void*)(o & (~1));
15216 o_conv.is_owned = (o & 1) || (o == 0);
15217 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15218 o_conv = CommitmentTransaction_clone(&o_conv);
15219 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15220 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15221 return (int64_t)ret_conv;
15224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15225 LDKDecodeError e_conv;
15226 e_conv.inner = (void*)(e & (~1));
15227 e_conv.is_owned = (e & 1) || (e == 0);
15228 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15229 e_conv = DecodeError_clone(&e_conv);
15230 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15231 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15232 return (int64_t)ret_conv;
15235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15236 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
15237 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15242 if ((_res & 1) != 0) return;
15243 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15244 CHECK_ACCESS(_res_ptr);
15245 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15247 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15250 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15251 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15252 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15253 return (int64_t)ret_conv;
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15256 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
15257 int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15262 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
15263 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15264 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15265 return (int64_t)ret_conv;
15268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15269 LDKTrustedCommitmentTransaction o_conv;
15270 o_conv.inner = (void*)(o & (~1));
15271 o_conv.is_owned = (o & 1) || (o == 0);
15272 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15273 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15274 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15275 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15276 return (int64_t)ret_conv;
15279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15280 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15281 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15282 return (int64_t)ret_conv;
15285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15286 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
15287 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15292 if ((_res & 1) != 0) return;
15293 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15294 CHECK_ACCESS(_res_ptr);
15295 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15297 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
15301 LDKCVec_SignatureZ o_constr;
15302 o_constr.datalen = (*env)->GetArrayLength(env, o);
15303 if (o_constr.datalen > 0)
15304 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15306 o_constr.data = NULL;
15307 for (size_t i = 0; i < o_constr.datalen; i++) {
15308 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15309 LDKSignature o_conv_8_ref;
15310 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
15311 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
15312 o_constr.data[i] = o_conv_8_ref;
15314 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15315 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15316 return (int64_t)ret_conv;
15319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
15320 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15321 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15322 return (int64_t)ret_conv;
15325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15326 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
15327 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15332 if ((_res & 1) != 0) return;
15333 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15334 CHECK_ACCESS(_res_ptr);
15335 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15337 CResult_CVec_SignatureZNoneZ_free(_res_conv);
15340 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15341 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15342 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15343 return (int64_t)ret_conv;
15345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15346 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
15347 int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15352 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
15353 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15354 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15355 return (int64_t)ret_conv;
15358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15359 LDKShutdownScript o_conv;
15360 o_conv.inner = (void*)(o & (~1));
15361 o_conv.is_owned = (o & 1) || (o == 0);
15362 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15363 o_conv = ShutdownScript_clone(&o_conv);
15364 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15365 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15366 return (int64_t)ret_conv;
15369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15370 LDKDecodeError e_conv;
15371 e_conv.inner = (void*)(e & (~1));
15372 e_conv.is_owned = (e & 1) || (e == 0);
15373 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15374 e_conv = DecodeError_clone(&e_conv);
15375 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15376 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15377 return (int64_t)ret_conv;
15380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15381 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15382 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15387 if ((_res & 1) != 0) return;
15388 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15389 CHECK_ACCESS(_res_ptr);
15390 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15392 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15395 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15396 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15397 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15398 return (int64_t)ret_conv;
15400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15401 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15402 int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15407 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15408 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15409 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15410 return (int64_t)ret_conv;
15413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15414 LDKShutdownScript o_conv;
15415 o_conv.inner = (void*)(o & (~1));
15416 o_conv.is_owned = (o & 1) || (o == 0);
15417 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15418 o_conv = ShutdownScript_clone(&o_conv);
15419 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15420 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15421 return (int64_t)ret_conv;
15424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15425 LDKInvalidShutdownScript e_conv;
15426 e_conv.inner = (void*)(e & (~1));
15427 e_conv.is_owned = (e & 1) || (e == 0);
15428 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15429 e_conv = InvalidShutdownScript_clone(&e_conv);
15430 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15431 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15432 return (int64_t)ret_conv;
15435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15436 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15437 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15442 if ((_res & 1) != 0) return;
15443 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15444 CHECK_ACCESS(_res_ptr);
15445 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15447 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15450 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15451 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15452 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15453 return (int64_t)ret_conv;
15455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15456 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15457 int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15462 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15463 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15464 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15465 return (int64_t)ret_conv;
15468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15469 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15470 *ret_conv = CResult_NoneErrorZ_ok();
15471 return (int64_t)ret_conv;
15474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15475 LDKIOError e_conv = LDKIOError_from_java(env, e);
15476 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15477 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15478 return (int64_t)ret_conv;
15481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15482 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15483 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
15487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15488 if ((_res & 1) != 0) return;
15489 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15490 CHECK_ACCESS(_res_ptr);
15491 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15493 CResult_NoneErrorZ_free(_res_conv);
15496 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15497 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15498 *ret_conv = CResult_NoneErrorZ_clone(arg);
15499 return (int64_t)ret_conv;
15501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15502 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15503 int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
15507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15508 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15509 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15510 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15511 return (int64_t)ret_conv;
15514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15515 LDKRouteHop o_conv;
15516 o_conv.inner = (void*)(o & (~1));
15517 o_conv.is_owned = (o & 1) || (o == 0);
15518 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15519 o_conv = RouteHop_clone(&o_conv);
15520 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15521 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15522 return (int64_t)ret_conv;
15525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15526 LDKDecodeError e_conv;
15527 e_conv.inner = (void*)(e & (~1));
15528 e_conv.is_owned = (e & 1) || (e == 0);
15529 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15530 e_conv = DecodeError_clone(&e_conv);
15531 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15532 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15533 return (int64_t)ret_conv;
15536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15537 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15538 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15543 if ((_res & 1) != 0) return;
15544 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15545 CHECK_ACCESS(_res_ptr);
15546 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15548 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15551 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15552 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15553 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15554 return (int64_t)ret_conv;
15556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15557 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15558 int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15563 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15564 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15565 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
15566 return (int64_t)ret_conv;
15569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15570 LDKCVec_RouteHopZ _res_constr;
15571 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15572 if (_res_constr.datalen > 0)
15573 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15575 _res_constr.data = NULL;
15576 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15577 for (size_t k = 0; k < _res_constr.datalen; k++) {
15578 int64_t _res_conv_10 = _res_vals[k];
15579 LDKRouteHop _res_conv_10_conv;
15580 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15581 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15582 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15583 _res_constr.data[k] = _res_conv_10_conv;
15585 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15586 CVec_RouteHopZ_free(_res_constr);
15589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15590 LDKCVec_CVec_RouteHopZZ _res_constr;
15591 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15592 if (_res_constr.datalen > 0)
15593 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15595 _res_constr.data = NULL;
15596 for (size_t m = 0; m < _res_constr.datalen; m++) {
15597 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
15598 LDKCVec_RouteHopZ _res_conv_12_constr;
15599 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
15600 if (_res_conv_12_constr.datalen > 0)
15601 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15603 _res_conv_12_constr.data = NULL;
15604 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
15605 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
15606 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
15607 LDKRouteHop _res_conv_12_conv_10_conv;
15608 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
15609 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
15610 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
15611 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
15613 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
15614 _res_constr.data[m] = _res_conv_12_constr;
15616 CVec_CVec_RouteHopZZ_free(_res_constr);
15619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15621 o_conv.inner = (void*)(o & (~1));
15622 o_conv.is_owned = (o & 1) || (o == 0);
15623 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15624 o_conv = Route_clone(&o_conv);
15625 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15626 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
15627 return (int64_t)ret_conv;
15630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15631 LDKDecodeError e_conv;
15632 e_conv.inner = (void*)(e & (~1));
15633 e_conv.is_owned = (e & 1) || (e == 0);
15634 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15635 e_conv = DecodeError_clone(&e_conv);
15636 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15637 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
15638 return (int64_t)ret_conv;
15641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15642 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
15643 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
15647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15648 if ((_res & 1) != 0) return;
15649 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15650 CHECK_ACCESS(_res_ptr);
15651 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
15653 CResult_RouteDecodeErrorZ_free(_res_conv);
15656 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
15657 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15658 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
15659 return (int64_t)ret_conv;
15661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15662 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
15663 int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15668 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
15669 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15670 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15671 return (int64_t)ret_conv;
15674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15675 LDKRouteParameters o_conv;
15676 o_conv.inner = (void*)(o & (~1));
15677 o_conv.is_owned = (o & 1) || (o == 0);
15678 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15679 o_conv = RouteParameters_clone(&o_conv);
15680 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15681 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15682 return (int64_t)ret_conv;
15685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15686 LDKDecodeError e_conv;
15687 e_conv.inner = (void*)(e & (~1));
15688 e_conv.is_owned = (e & 1) || (e == 0);
15689 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15690 e_conv = DecodeError_clone(&e_conv);
15691 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15692 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15693 return (int64_t)ret_conv;
15696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15697 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
15698 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15703 if ((_res & 1) != 0) return;
15704 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15705 CHECK_ACCESS(_res_ptr);
15706 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15708 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15711 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15712 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15713 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15714 return (int64_t)ret_conv;
15716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15717 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
15718 int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15723 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
15724 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15725 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15726 return (int64_t)ret_conv;
15729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15730 LDKCVec_RouteHintZ _res_constr;
15731 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15732 if (_res_constr.datalen > 0)
15733 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15735 _res_constr.data = NULL;
15736 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15737 for (size_t l = 0; l < _res_constr.datalen; l++) {
15738 int64_t _res_conv_11 = _res_vals[l];
15739 LDKRouteHint _res_conv_11_conv;
15740 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
15741 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
15742 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15743 _res_constr.data[l] = _res_conv_11_conv;
15745 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15746 CVec_RouteHintZ_free(_res_constr);
15749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15750 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15751 *ret_copy = COption_u64Z_some(o);
15752 int64_t ret_ref = (uintptr_t)ret_copy;
15756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15757 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15758 *ret_copy = COption_u64Z_none();
15759 int64_t ret_ref = (uintptr_t)ret_copy;
15763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15764 if ((_res & 1) != 0) return;
15765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15766 CHECK_ACCESS(_res_ptr);
15767 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15769 COption_u64Z_free(_res_conv);
15772 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15773 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15774 *ret_copy = COption_u64Z_clone(arg);
15775 int64_t ret_ref = (uintptr_t)ret_copy;
15778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15779 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
15780 int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15785 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
15786 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15787 *ret_copy = COption_u64Z_clone(orig_conv);
15788 int64_t ret_ref = (uintptr_t)ret_copy;
15792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15793 LDKPaymentParameters o_conv;
15794 o_conv.inner = (void*)(o & (~1));
15795 o_conv.is_owned = (o & 1) || (o == 0);
15796 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15797 o_conv = PaymentParameters_clone(&o_conv);
15798 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15799 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15800 return (int64_t)ret_conv;
15803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15804 LDKDecodeError e_conv;
15805 e_conv.inner = (void*)(e & (~1));
15806 e_conv.is_owned = (e & 1) || (e == 0);
15807 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15808 e_conv = DecodeError_clone(&e_conv);
15809 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15810 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15811 return (int64_t)ret_conv;
15814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15815 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15816 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15821 if ((_res & 1) != 0) return;
15822 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15823 CHECK_ACCESS(_res_ptr);
15824 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15826 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15829 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15830 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15831 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15832 return (int64_t)ret_conv;
15834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15835 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15836 int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15841 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15842 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15843 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15844 return (int64_t)ret_conv;
15847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15848 LDKCVec_RouteHintHopZ _res_constr;
15849 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15850 if (_res_constr.datalen > 0)
15851 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15853 _res_constr.data = NULL;
15854 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15855 for (size_t o = 0; o < _res_constr.datalen; o++) {
15856 int64_t _res_conv_14 = _res_vals[o];
15857 LDKRouteHintHop _res_conv_14_conv;
15858 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15859 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15860 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15861 _res_constr.data[o] = _res_conv_14_conv;
15863 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15864 CVec_RouteHintHopZ_free(_res_constr);
15867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15868 LDKRouteHint o_conv;
15869 o_conv.inner = (void*)(o & (~1));
15870 o_conv.is_owned = (o & 1) || (o == 0);
15871 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15872 o_conv = RouteHint_clone(&o_conv);
15873 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15874 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15875 return (int64_t)ret_conv;
15878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15879 LDKDecodeError e_conv;
15880 e_conv.inner = (void*)(e & (~1));
15881 e_conv.is_owned = (e & 1) || (e == 0);
15882 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15883 e_conv = DecodeError_clone(&e_conv);
15884 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15885 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15886 return (int64_t)ret_conv;
15889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15890 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15891 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15896 if ((_res & 1) != 0) return;
15897 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15898 CHECK_ACCESS(_res_ptr);
15899 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15901 CResult_RouteHintDecodeErrorZ_free(_res_conv);
15904 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15905 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15906 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15907 return (int64_t)ret_conv;
15909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15910 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
15911 int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15916 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
15917 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15918 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15919 return (int64_t)ret_conv;
15922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15923 LDKRouteHintHop o_conv;
15924 o_conv.inner = (void*)(o & (~1));
15925 o_conv.is_owned = (o & 1) || (o == 0);
15926 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15927 o_conv = RouteHintHop_clone(&o_conv);
15928 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15929 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15930 return (int64_t)ret_conv;
15933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15934 LDKDecodeError e_conv;
15935 e_conv.inner = (void*)(e & (~1));
15936 e_conv.is_owned = (e & 1) || (e == 0);
15937 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15938 e_conv = DecodeError_clone(&e_conv);
15939 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15940 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15941 return (int64_t)ret_conv;
15944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15945 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
15946 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15951 if ((_res & 1) != 0) return;
15952 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15953 CHECK_ACCESS(_res_ptr);
15954 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15956 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15959 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15960 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15961 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15962 return (int64_t)ret_conv;
15964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15965 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
15966 int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15971 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
15972 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15973 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15974 return (int64_t)ret_conv;
15977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15978 LDKCVec_ChannelDetailsZ _res_constr;
15979 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15980 if (_res_constr.datalen > 0)
15981 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15983 _res_constr.data = NULL;
15984 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15985 for (size_t q = 0; q < _res_constr.datalen; q++) {
15986 int64_t _res_conv_16 = _res_vals[q];
15987 LDKChannelDetails _res_conv_16_conv;
15988 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15989 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15990 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15991 _res_constr.data[q] = _res_conv_16_conv;
15993 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15994 CVec_ChannelDetailsZ_free(_res_constr);
15997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15999 o_conv.inner = (void*)(o & (~1));
16000 o_conv.is_owned = (o & 1) || (o == 0);
16001 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16002 o_conv = Route_clone(&o_conv);
16003 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16004 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16005 return (int64_t)ret_conv;
16008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16009 LDKLightningError e_conv;
16010 e_conv.inner = (void*)(e & (~1));
16011 e_conv.is_owned = (e & 1) || (e == 0);
16012 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16013 e_conv = LightningError_clone(&e_conv);
16014 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16015 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16016 return (int64_t)ret_conv;
16019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16020 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
16021 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16026 if ((_res & 1) != 0) return;
16027 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16028 CHECK_ACCESS(_res_ptr);
16029 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16031 CResult_RouteLightningErrorZ_free(_res_conv);
16034 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16035 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16036 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16037 return (int64_t)ret_conv;
16039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16040 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
16041 int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16046 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
16047 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16048 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16049 return (int64_t)ret_conv;
16052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16053 LDKCVec_PublicKeyZ _res_constr;
16054 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16055 if (_res_constr.datalen > 0)
16056 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16058 _res_constr.data = NULL;
16059 for (size_t i = 0; i < _res_constr.datalen; i++) {
16060 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16061 LDKPublicKey _res_conv_8_ref;
16062 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
16063 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
16064 _res_constr.data[i] = _res_conv_8_ref;
16066 CVec_PublicKeyZ_free(_res_constr);
16069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16070 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16071 CHECK_ACCESS(o_ptr);
16072 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
16073 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
16074 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16075 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
16076 return (int64_t)ret_conv;
16079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16080 LDKDecodeError e_conv;
16081 e_conv.inner = (void*)(e & (~1));
16082 e_conv.is_owned = (e & 1) || (e == 0);
16083 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16084 e_conv = DecodeError_clone(&e_conv);
16085 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16086 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
16087 return (int64_t)ret_conv;
16090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16091 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
16092 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
16096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16097 if ((_res & 1) != 0) return;
16098 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16099 CHECK_ACCESS(_res_ptr);
16100 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
16102 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
16105 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
16106 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16107 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
16108 return (int64_t)ret_conv;
16110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16111 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
16112 int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
16116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16117 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
16118 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16119 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
16120 return (int64_t)ret_conv;
16123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16124 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16125 CHECK_ACCESS(o_ptr);
16126 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
16127 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
16128 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16129 *ret_copy = COption_ClosureReasonZ_some(o_conv);
16130 int64_t ret_ref = (uintptr_t)ret_copy;
16134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
16135 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16136 *ret_copy = COption_ClosureReasonZ_none();
16137 int64_t ret_ref = (uintptr_t)ret_copy;
16141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16142 if ((_res & 1) != 0) return;
16143 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16144 CHECK_ACCESS(_res_ptr);
16145 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16147 COption_ClosureReasonZ_free(_res_conv);
16150 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16151 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16152 *ret_copy = COption_ClosureReasonZ_clone(arg);
16153 int64_t ret_ref = (uintptr_t)ret_copy;
16156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16157 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
16158 int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16163 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
16164 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16165 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16166 int64_t ret_ref = (uintptr_t)ret_copy;
16170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16171 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16172 CHECK_ACCESS(o_ptr);
16173 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16174 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
16175 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16176 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16177 return (int64_t)ret_conv;
16180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16181 LDKDecodeError e_conv;
16182 e_conv.inner = (void*)(e & (~1));
16183 e_conv.is_owned = (e & 1) || (e == 0);
16184 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16185 e_conv = DecodeError_clone(&e_conv);
16186 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16187 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
16188 return (int64_t)ret_conv;
16191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16192 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
16193 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
16197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16198 if ((_res & 1) != 0) return;
16199 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16200 CHECK_ACCESS(_res_ptr);
16201 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16203 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16206 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16207 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16208 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16209 return (int64_t)ret_conv;
16211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16212 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16213 int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16218 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16219 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16220 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16221 return (int64_t)ret_conv;
16224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16225 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16226 CHECK_ACCESS(o_ptr);
16227 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16228 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16229 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16230 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16231 int64_t ret_ref = (uintptr_t)ret_copy;
16235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16236 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16237 *ret_copy = COption_NetworkUpdateZ_none();
16238 int64_t ret_ref = (uintptr_t)ret_copy;
16242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16243 if ((_res & 1) != 0) return;
16244 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16245 CHECK_ACCESS(_res_ptr);
16246 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16248 COption_NetworkUpdateZ_free(_res_conv);
16251 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16252 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16253 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16254 int64_t ret_ref = (uintptr_t)ret_copy;
16257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16258 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16259 int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16264 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16265 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16266 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16267 int64_t ret_ref = (uintptr_t)ret_copy;
16271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16272 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16273 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16274 if (_res_constr.datalen > 0)
16275 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16277 _res_constr.data = NULL;
16278 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16279 for (size_t b = 0; b < _res_constr.datalen; b++) {
16280 int64_t _res_conv_27 = _res_vals[b];
16281 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16282 CHECK_ACCESS(_res_conv_27_ptr);
16283 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16284 FREE((void*)_res_conv_27);
16285 _res_constr.data[b] = _res_conv_27_conv;
16287 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16288 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16292 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16293 CHECK_ACCESS(o_ptr);
16294 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16295 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16296 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16297 *ret_copy = COption_EventZ_some(o_conv);
16298 int64_t ret_ref = (uintptr_t)ret_copy;
16302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16303 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16304 *ret_copy = COption_EventZ_none();
16305 int64_t ret_ref = (uintptr_t)ret_copy;
16309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16310 if ((_res & 1) != 0) return;
16311 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16312 CHECK_ACCESS(_res_ptr);
16313 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16315 COption_EventZ_free(_res_conv);
16318 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16319 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16320 *ret_copy = COption_EventZ_clone(arg);
16321 int64_t ret_ref = (uintptr_t)ret_copy;
16324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16325 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16326 int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
16330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16331 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16332 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16333 *ret_copy = COption_EventZ_clone(orig_conv);
16334 int64_t ret_ref = (uintptr_t)ret_copy;
16338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16339 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16340 CHECK_ACCESS(o_ptr);
16341 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16342 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16343 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16344 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16345 return (int64_t)ret_conv;
16348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16349 LDKDecodeError e_conv;
16350 e_conv.inner = (void*)(e & (~1));
16351 e_conv.is_owned = (e & 1) || (e == 0);
16352 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16353 e_conv = DecodeError_clone(&e_conv);
16354 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16355 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16356 return (int64_t)ret_conv;
16359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16360 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16361 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16366 if ((_res & 1) != 0) return;
16367 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16368 CHECK_ACCESS(_res_ptr);
16369 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16371 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16374 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16375 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16376 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16377 return (int64_t)ret_conv;
16379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16380 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16381 int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16386 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16387 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16388 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16389 return (int64_t)ret_conv;
16392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16393 LDKCVec_MessageSendEventZ _res_constr;
16394 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16395 if (_res_constr.datalen > 0)
16396 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16398 _res_constr.data = NULL;
16399 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16400 for (size_t s = 0; s < _res_constr.datalen; s++) {
16401 int64_t _res_conv_18 = _res_vals[s];
16402 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16403 CHECK_ACCESS(_res_conv_18_ptr);
16404 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16405 FREE((void*)_res_conv_18);
16406 _res_constr.data[s] = _res_conv_18_conv;
16408 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16409 CVec_MessageSendEventZ_free(_res_constr);
16412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16413 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16414 CHECK_ACCESS(o_ptr);
16415 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
16416 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
16417 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16418 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
16419 return (int64_t)ret_conv;
16422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16423 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
16424 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16425 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
16426 return (int64_t)ret_conv;
16429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16430 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
16431 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
16435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16436 if ((_res & 1) != 0) return;
16437 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16438 CHECK_ACCESS(_res_ptr);
16439 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
16441 CResult_TxOutAccessErrorZ_free(_res_conv);
16444 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
16445 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16446 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
16447 return (int64_t)ret_conv;
16449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16450 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
16451 int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
16455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16456 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
16457 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16458 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
16459 return (int64_t)ret_conv;
16462 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
16463 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16464 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
16465 return ((int64_t)ret_conv);
16467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16468 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
16469 int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
16473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16474 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
16475 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16476 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
16477 return ((int64_t)ret_conv);
16480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
16481 LDKTransaction b_ref;
16482 b_ref.datalen = (*env)->GetArrayLength(env, b);
16483 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
16484 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
16485 b_ref.data_is_owned = true;
16486 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16487 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
16488 return ((int64_t)ret_conv);
16491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16492 if ((_res & 1) != 0) return;
16493 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16494 CHECK_ACCESS(_res_ptr);
16495 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
16497 C2Tuple_usizeTransactionZ_free(_res_conv);
16500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16501 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
16502 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16503 if (_res_constr.datalen > 0)
16504 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16506 _res_constr.data = NULL;
16507 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16508 for (size_t c = 0; c < _res_constr.datalen; c++) {
16509 int64_t _res_conv_28 = _res_vals[c];
16510 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
16511 CHECK_ACCESS(_res_conv_28_ptr);
16512 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
16513 FREE((void*)_res_conv_28);
16514 _res_constr.data[c] = _res_conv_28_conv;
16516 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16517 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
16520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16521 LDKCVec_TxidZ _res_constr;
16522 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16523 if (_res_constr.datalen > 0)
16524 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
16526 _res_constr.data = NULL;
16527 for (size_t i = 0; i < _res_constr.datalen; i++) {
16528 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16529 LDKThirtyTwoBytes _res_conv_8_ref;
16530 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16531 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16532 _res_constr.data[i] = _res_conv_8_ref;
16534 CVec_TxidZ_free(_res_constr);
16537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
16538 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16539 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
16540 return (int64_t)ret_conv;
16543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
16544 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
16545 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16546 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
16547 return (int64_t)ret_conv;
16550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16551 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
16552 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
16556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16557 if ((_res & 1) != 0) return;
16558 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16559 CHECK_ACCESS(_res_ptr);
16560 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
16562 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
16565 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
16566 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16567 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
16568 return (int64_t)ret_conv;
16570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16571 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
16572 int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
16576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16577 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
16578 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16579 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
16580 return (int64_t)ret_conv;
16583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16584 LDKCVec_MonitorEventZ _res_constr;
16585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16586 if (_res_constr.datalen > 0)
16587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16589 _res_constr.data = NULL;
16590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16591 for (size_t o = 0; o < _res_constr.datalen; o++) {
16592 int64_t _res_conv_14 = _res_vals[o];
16593 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
16594 CHECK_ACCESS(_res_conv_14_ptr);
16595 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
16596 FREE((void*)_res_conv_14);
16597 _res_constr.data[o] = _res_conv_14_conv;
16599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16600 CVec_MonitorEventZ_free(_res_constr);
16603 static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) {
16604 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16605 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg);
16606 return ((int64_t)ret_conv);
16608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16609 LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1);
16610 int64_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv);
16614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16615 LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1);
16616 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16617 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv);
16618 return ((int64_t)ret_conv);
16621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
16622 LDKOutPoint a_conv;
16623 a_conv.inner = (void*)(a & (~1));
16624 a_conv.is_owned = (a & 1) || (a == 0);
16625 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16626 a_conv = OutPoint_clone(&a_conv);
16627 LDKCVec_MonitorEventZ b_constr;
16628 b_constr.datalen = (*env)->GetArrayLength(env, b);
16629 if (b_constr.datalen > 0)
16630 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16632 b_constr.data = NULL;
16633 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16634 for (size_t o = 0; o < b_constr.datalen; o++) {
16635 int64_t b_conv_14 = b_vals[o];
16636 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
16637 CHECK_ACCESS(b_conv_14_ptr);
16638 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
16639 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
16640 b_constr.data[o] = b_conv_14_conv;
16642 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16643 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
16644 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr);
16645 return ((int64_t)ret_conv);
16648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16649 if ((_res & 1) != 0) return;
16650 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16651 CHECK_ACCESS(_res_ptr);
16652 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr);
16654 C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv);
16657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorEventZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16658 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr;
16659 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16660 if (_res_constr.datalen > 0)
16661 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
16663 _res_constr.data = NULL;
16664 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16665 for (size_t m = 0; m < _res_constr.datalen; m++) {
16666 int64_t _res_conv_38 = _res_vals[m];
16667 void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1);
16668 CHECK_ACCESS(_res_conv_38_ptr);
16669 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr);
16670 FREE((void*)_res_conv_38);
16671 _res_constr.data[m] = _res_conv_38_conv;
16673 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16674 CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr);
16677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16678 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16679 CHECK_ACCESS(o_ptr);
16680 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
16681 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
16682 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16683 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
16684 int64_t ret_ref = (uintptr_t)ret_copy;
16688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
16689 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16690 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
16691 int64_t ret_ref = (uintptr_t)ret_copy;
16695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16696 if ((_res & 1) != 0) return;
16697 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16698 CHECK_ACCESS(_res_ptr);
16699 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
16701 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
16704 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
16705 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16706 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
16707 int64_t ret_ref = (uintptr_t)ret_copy;
16710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16711 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
16712 int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
16716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16717 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
16718 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16719 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
16720 int64_t ret_ref = (uintptr_t)ret_copy;
16724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16725 LDKFixedPenaltyScorer o_conv;
16726 o_conv.inner = (void*)(o & (~1));
16727 o_conv.is_owned = (o & 1) || (o == 0);
16728 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16729 o_conv = FixedPenaltyScorer_clone(&o_conv);
16730 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16731 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16732 return (int64_t)ret_conv;
16735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16736 LDKDecodeError e_conv;
16737 e_conv.inner = (void*)(e & (~1));
16738 e_conv.is_owned = (e & 1) || (e == 0);
16739 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16740 e_conv = DecodeError_clone(&e_conv);
16741 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16742 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16743 return (int64_t)ret_conv;
16746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16747 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
16748 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16753 if ((_res & 1) != 0) return;
16754 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16755 CHECK_ACCESS(_res_ptr);
16756 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16758 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16761 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16762 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16763 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16764 return (int64_t)ret_conv;
16766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16767 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
16768 int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16773 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
16774 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16775 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16776 return (int64_t)ret_conv;
16779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16780 LDKProbabilisticScorer o_conv;
16781 o_conv.inner = (void*)(o & (~1));
16782 o_conv.is_owned = (o & 1) || (o == 0);
16783 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16784 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16785 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16786 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16787 return (int64_t)ret_conv;
16790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16791 LDKDecodeError e_conv;
16792 e_conv.inner = (void*)(e & (~1));
16793 e_conv.is_owned = (e & 1) || (e == 0);
16794 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16795 e_conv = DecodeError_clone(&e_conv);
16796 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16797 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16798 return (int64_t)ret_conv;
16801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16802 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
16803 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16808 if ((_res & 1) != 0) return;
16809 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16810 CHECK_ACCESS(_res_ptr);
16811 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16813 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16817 LDKInitFeatures o_conv;
16818 o_conv.inner = (void*)(o & (~1));
16819 o_conv.is_owned = (o & 1) || (o == 0);
16820 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16821 o_conv = InitFeatures_clone(&o_conv);
16822 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16823 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16824 return (int64_t)ret_conv;
16827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16828 LDKDecodeError e_conv;
16829 e_conv.inner = (void*)(e & (~1));
16830 e_conv.is_owned = (e & 1) || (e == 0);
16831 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16832 e_conv = DecodeError_clone(&e_conv);
16833 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16834 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16835 return (int64_t)ret_conv;
16838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16839 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
16840 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16845 if ((_res & 1) != 0) return;
16846 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16847 CHECK_ACCESS(_res_ptr);
16848 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16850 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16853 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16854 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16855 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
16856 return (int64_t)ret_conv;
16858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16859 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
16860 int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16865 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
16866 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16867 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
16868 return (int64_t)ret_conv;
16871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16872 LDKChannelFeatures o_conv;
16873 o_conv.inner = (void*)(o & (~1));
16874 o_conv.is_owned = (o & 1) || (o == 0);
16875 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16876 o_conv = ChannelFeatures_clone(&o_conv);
16877 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16878 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16879 return (int64_t)ret_conv;
16882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16883 LDKDecodeError e_conv;
16884 e_conv.inner = (void*)(e & (~1));
16885 e_conv.is_owned = (e & 1) || (e == 0);
16886 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16887 e_conv = DecodeError_clone(&e_conv);
16888 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16889 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16890 return (int64_t)ret_conv;
16893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16894 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
16895 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16900 if ((_res & 1) != 0) return;
16901 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16902 CHECK_ACCESS(_res_ptr);
16903 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16905 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16908 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16909 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16910 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
16911 return (int64_t)ret_conv;
16913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16914 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
16915 int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16920 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
16921 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16922 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
16923 return (int64_t)ret_conv;
16926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16927 LDKNodeFeatures o_conv;
16928 o_conv.inner = (void*)(o & (~1));
16929 o_conv.is_owned = (o & 1) || (o == 0);
16930 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16931 o_conv = NodeFeatures_clone(&o_conv);
16932 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16933 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16934 return (int64_t)ret_conv;
16937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16938 LDKDecodeError e_conv;
16939 e_conv.inner = (void*)(e & (~1));
16940 e_conv.is_owned = (e & 1) || (e == 0);
16941 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16942 e_conv = DecodeError_clone(&e_conv);
16943 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16944 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16945 return (int64_t)ret_conv;
16948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16949 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
16950 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16955 if ((_res & 1) != 0) return;
16956 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16957 CHECK_ACCESS(_res_ptr);
16958 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16960 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16963 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16964 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16965 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
16966 return (int64_t)ret_conv;
16968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16969 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
16970 int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16975 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
16976 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16977 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
16978 return (int64_t)ret_conv;
16981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16982 LDKInvoiceFeatures o_conv;
16983 o_conv.inner = (void*)(o & (~1));
16984 o_conv.is_owned = (o & 1) || (o == 0);
16985 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16986 o_conv = InvoiceFeatures_clone(&o_conv);
16987 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16988 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16989 return (int64_t)ret_conv;
16992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16993 LDKDecodeError e_conv;
16994 e_conv.inner = (void*)(e & (~1));
16995 e_conv.is_owned = (e & 1) || (e == 0);
16996 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16997 e_conv = DecodeError_clone(&e_conv);
16998 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16999 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
17000 return (int64_t)ret_conv;
17003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17004 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
17005 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
17009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17010 if ((_res & 1) != 0) return;
17011 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17012 CHECK_ACCESS(_res_ptr);
17013 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
17015 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
17018 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17019 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17020 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
17021 return (int64_t)ret_conv;
17023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17024 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
17025 int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17030 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
17031 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17032 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
17033 return (int64_t)ret_conv;
17036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17037 LDKChannelTypeFeatures o_conv;
17038 o_conv.inner = (void*)(o & (~1));
17039 o_conv.is_owned = (o & 1) || (o == 0);
17040 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17041 o_conv = ChannelTypeFeatures_clone(&o_conv);
17042 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17043 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
17044 return (int64_t)ret_conv;
17047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17048 LDKDecodeError e_conv;
17049 e_conv.inner = (void*)(e & (~1));
17050 e_conv.is_owned = (e & 1) || (e == 0);
17051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17052 e_conv = DecodeError_clone(&e_conv);
17053 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17054 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
17055 return (int64_t)ret_conv;
17058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17059 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
17060 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
17064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17065 if ((_res & 1) != 0) return;
17066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17067 CHECK_ACCESS(_res_ptr);
17068 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
17070 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
17073 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17074 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17075 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
17076 return (int64_t)ret_conv;
17078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17079 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
17080 int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17085 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
17086 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17087 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
17088 return (int64_t)ret_conv;
17091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17093 o_conv.inner = (void*)(o & (~1));
17094 o_conv.is_owned = (o & 1) || (o == 0);
17095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17096 o_conv = NodeId_clone(&o_conv);
17097 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17098 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
17099 return (int64_t)ret_conv;
17102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17103 LDKDecodeError e_conv;
17104 e_conv.inner = (void*)(e & (~1));
17105 e_conv.is_owned = (e & 1) || (e == 0);
17106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17107 e_conv = DecodeError_clone(&e_conv);
17108 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17109 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
17110 return (int64_t)ret_conv;
17113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17114 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
17115 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
17119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17120 if ((_res & 1) != 0) return;
17121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17122 CHECK_ACCESS(_res_ptr);
17123 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
17125 CResult_NodeIdDecodeErrorZ_free(_res_conv);
17128 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
17129 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17130 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
17131 return (int64_t)ret_conv;
17133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17134 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
17135 int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
17139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17140 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
17141 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17142 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
17143 return (int64_t)ret_conv;
17146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17147 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17148 CHECK_ACCESS(o_ptr);
17149 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
17150 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
17151 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17152 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
17153 return (int64_t)ret_conv;
17156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17157 LDKDecodeError e_conv;
17158 e_conv.inner = (void*)(e & (~1));
17159 e_conv.is_owned = (e & 1) || (e == 0);
17160 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17161 e_conv = DecodeError_clone(&e_conv);
17162 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17163 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
17164 return (int64_t)ret_conv;
17167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17168 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
17169 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
17173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17174 if ((_res & 1) != 0) return;
17175 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17176 CHECK_ACCESS(_res_ptr);
17177 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
17179 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
17182 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
17183 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17184 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
17185 return (int64_t)ret_conv;
17187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17188 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
17189 int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
17193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17194 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
17195 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17196 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
17197 return (int64_t)ret_conv;
17200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17201 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17202 CHECK_ACCESS(o_ptr);
17203 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
17204 if (o_conv.free == LDKAccess_JCalls_free) {
17205 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17206 LDKAccess_JCalls_cloned(&o_conv);
17208 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17209 *ret_copy = COption_AccessZ_some(o_conv);
17210 int64_t ret_ref = (uintptr_t)ret_copy;
17214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
17215 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17216 *ret_copy = COption_AccessZ_none();
17217 int64_t ret_ref = (uintptr_t)ret_copy;
17221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17222 if ((_res & 1) != 0) return;
17223 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17224 CHECK_ACCESS(_res_ptr);
17225 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
17227 COption_AccessZ_free(_res_conv);
17230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17231 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17232 *ret_conv = CResult_boolLightningErrorZ_ok(o);
17233 return (int64_t)ret_conv;
17236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17237 LDKLightningError e_conv;
17238 e_conv.inner = (void*)(e & (~1));
17239 e_conv.is_owned = (e & 1) || (e == 0);
17240 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17241 e_conv = LightningError_clone(&e_conv);
17242 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17243 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
17244 return (int64_t)ret_conv;
17247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17248 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
17249 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
17253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17254 if ((_res & 1) != 0) return;
17255 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17256 CHECK_ACCESS(_res_ptr);
17257 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
17259 CResult_boolLightningErrorZ_free(_res_conv);
17262 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
17263 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17264 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
17265 return (int64_t)ret_conv;
17267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17268 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
17269 int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
17273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17274 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
17275 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17276 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
17277 return (int64_t)ret_conv;
17280 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
17281 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17282 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
17283 return ((int64_t)ret_conv);
17285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17286 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
17287 int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
17291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17292 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
17293 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17294 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
17295 return ((int64_t)ret_conv);
17298 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) {
17299 LDKChannelAnnouncement a_conv;
17300 a_conv.inner = (void*)(a & (~1));
17301 a_conv.is_owned = (a & 1) || (a == 0);
17302 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17303 a_conv = ChannelAnnouncement_clone(&a_conv);
17304 LDKChannelUpdate b_conv;
17305 b_conv.inner = (void*)(b & (~1));
17306 b_conv.is_owned = (b & 1) || (b == 0);
17307 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17308 b_conv = ChannelUpdate_clone(&b_conv);
17309 LDKChannelUpdate c_conv;
17310 c_conv.inner = (void*)(c & (~1));
17311 c_conv.is_owned = (c & 1) || (c == 0);
17312 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17313 c_conv = ChannelUpdate_clone(&c_conv);
17314 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17315 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
17316 return ((int64_t)ret_conv);
17319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_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 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
17325 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
17328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17329 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
17330 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17331 if (_res_constr.datalen > 0)
17332 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
17334 _res_constr.data = NULL;
17335 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17336 for (size_t h = 0; h < _res_constr.datalen; h++) {
17337 int64_t _res_conv_59 = _res_vals[h];
17338 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
17339 CHECK_ACCESS(_res_conv_59_ptr);
17340 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
17341 FREE((void*)_res_conv_59);
17342 _res_constr.data[h] = _res_conv_59_conv;
17344 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17345 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
17348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17349 LDKCVec_NodeAnnouncementZ _res_constr;
17350 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17351 if (_res_constr.datalen > 0)
17352 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
17354 _res_constr.data = NULL;
17355 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17356 for (size_t s = 0; s < _res_constr.datalen; s++) {
17357 int64_t _res_conv_18 = _res_vals[s];
17358 LDKNodeAnnouncement _res_conv_18_conv;
17359 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
17360 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
17361 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
17362 _res_constr.data[s] = _res_conv_18_conv;
17364 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17365 CVec_NodeAnnouncementZ_free(_res_constr);
17368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
17369 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17370 *ret_conv = CResult_NoneLightningErrorZ_ok();
17371 return (int64_t)ret_conv;
17374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17375 LDKLightningError e_conv;
17376 e_conv.inner = (void*)(e & (~1));
17377 e_conv.is_owned = (e & 1) || (e == 0);
17378 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17379 e_conv = LightningError_clone(&e_conv);
17380 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17381 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
17382 return (int64_t)ret_conv;
17385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17386 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
17387 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
17391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17392 if ((_res & 1) != 0) return;
17393 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17394 CHECK_ACCESS(_res_ptr);
17395 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
17397 CResult_NoneLightningErrorZ_free(_res_conv);
17400 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
17401 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17402 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
17403 return (int64_t)ret_conv;
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17406 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
17407 int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
17411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17412 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
17413 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17414 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
17415 return (int64_t)ret_conv;
17418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17419 LDKChannelUpdateInfo o_conv;
17420 o_conv.inner = (void*)(o & (~1));
17421 o_conv.is_owned = (o & 1) || (o == 0);
17422 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17423 o_conv = ChannelUpdateInfo_clone(&o_conv);
17424 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17425 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
17426 return (int64_t)ret_conv;
17429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17430 LDKDecodeError e_conv;
17431 e_conv.inner = (void*)(e & (~1));
17432 e_conv.is_owned = (e & 1) || (e == 0);
17433 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17434 e_conv = DecodeError_clone(&e_conv);
17435 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17436 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
17437 return (int64_t)ret_conv;
17440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17441 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
17442 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
17446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17447 if ((_res & 1) != 0) return;
17448 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17449 CHECK_ACCESS(_res_ptr);
17450 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
17452 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
17455 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
17456 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17457 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
17458 return (int64_t)ret_conv;
17460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17461 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
17462 int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
17466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17467 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
17468 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17469 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
17470 return (int64_t)ret_conv;
17473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17474 LDKChannelInfo o_conv;
17475 o_conv.inner = (void*)(o & (~1));
17476 o_conv.is_owned = (o & 1) || (o == 0);
17477 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17478 o_conv = ChannelInfo_clone(&o_conv);
17479 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17480 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
17481 return (int64_t)ret_conv;
17484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17485 LDKDecodeError e_conv;
17486 e_conv.inner = (void*)(e & (~1));
17487 e_conv.is_owned = (e & 1) || (e == 0);
17488 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17489 e_conv = DecodeError_clone(&e_conv);
17490 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17491 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
17492 return (int64_t)ret_conv;
17495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17496 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
17497 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
17501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17502 if ((_res & 1) != 0) return;
17503 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17504 CHECK_ACCESS(_res_ptr);
17505 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
17507 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
17510 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17511 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17512 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
17513 return (int64_t)ret_conv;
17515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17516 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
17517 int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17522 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
17523 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17524 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
17525 return (int64_t)ret_conv;
17528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17529 LDKRoutingFees o_conv;
17530 o_conv.inner = (void*)(o & (~1));
17531 o_conv.is_owned = (o & 1) || (o == 0);
17532 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17533 o_conv = RoutingFees_clone(&o_conv);
17534 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17535 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
17536 return (int64_t)ret_conv;
17539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17540 LDKDecodeError e_conv;
17541 e_conv.inner = (void*)(e & (~1));
17542 e_conv.is_owned = (e & 1) || (e == 0);
17543 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17544 e_conv = DecodeError_clone(&e_conv);
17545 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17546 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
17547 return (int64_t)ret_conv;
17550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17551 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
17552 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
17556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17557 if ((_res & 1) != 0) return;
17558 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17559 CHECK_ACCESS(_res_ptr);
17560 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
17562 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
17565 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
17566 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17567 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
17568 return (int64_t)ret_conv;
17570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17571 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
17572 int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
17576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17577 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
17578 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17579 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
17580 return (int64_t)ret_conv;
17583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17584 LDKCVec_NetAddressZ _res_constr;
17585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17586 if (_res_constr.datalen > 0)
17587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17589 _res_constr.data = NULL;
17590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17591 for (size_t m = 0; m < _res_constr.datalen; m++) {
17592 int64_t _res_conv_12 = _res_vals[m];
17593 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17594 CHECK_ACCESS(_res_conv_12_ptr);
17595 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17596 FREE((void*)_res_conv_12);
17597 _res_constr.data[m] = _res_conv_12_conv;
17599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17600 CVec_NetAddressZ_free(_res_constr);
17603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17604 LDKNodeAnnouncementInfo o_conv;
17605 o_conv.inner = (void*)(o & (~1));
17606 o_conv.is_owned = (o & 1) || (o == 0);
17607 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17608 o_conv = NodeAnnouncementInfo_clone(&o_conv);
17609 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17610 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
17611 return (int64_t)ret_conv;
17614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17615 LDKDecodeError e_conv;
17616 e_conv.inner = (void*)(e & (~1));
17617 e_conv.is_owned = (e & 1) || (e == 0);
17618 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17619 e_conv = DecodeError_clone(&e_conv);
17620 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17621 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
17622 return (int64_t)ret_conv;
17625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17626 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
17627 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
17631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17632 if ((_res & 1) != 0) return;
17633 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17634 CHECK_ACCESS(_res_ptr);
17635 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
17637 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
17640 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17641 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17642 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17643 return (int64_t)ret_conv;
17645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17646 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
17647 int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17652 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
17653 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17654 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17655 return (int64_t)ret_conv;
17658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17659 LDKCVec_u64Z _res_constr;
17660 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17661 if (_res_constr.datalen > 0)
17662 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17664 _res_constr.data = NULL;
17665 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17666 for (size_t g = 0; g < _res_constr.datalen; g++) {
17667 int64_t _res_conv_6 = _res_vals[g];
17668 _res_constr.data[g] = _res_conv_6;
17670 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17671 CVec_u64Z_free(_res_constr);
17674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17675 LDKNodeInfo o_conv;
17676 o_conv.inner = (void*)(o & (~1));
17677 o_conv.is_owned = (o & 1) || (o == 0);
17678 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17679 o_conv = NodeInfo_clone(&o_conv);
17680 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17681 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17682 return (int64_t)ret_conv;
17685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17686 LDKDecodeError e_conv;
17687 e_conv.inner = (void*)(e & (~1));
17688 e_conv.is_owned = (e & 1) || (e == 0);
17689 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17690 e_conv = DecodeError_clone(&e_conv);
17691 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17692 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17693 return (int64_t)ret_conv;
17696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17697 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
17698 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17703 if ((_res & 1) != 0) return;
17704 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17705 CHECK_ACCESS(_res_ptr);
17706 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17708 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17711 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17712 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17713 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17714 return (int64_t)ret_conv;
17716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17717 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
17718 int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17723 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
17724 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17725 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17726 return (int64_t)ret_conv;
17729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17730 LDKNetworkGraph o_conv;
17731 o_conv.inner = (void*)(o & (~1));
17732 o_conv.is_owned = (o & 1) || (o == 0);
17733 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17734 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
17735 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17736 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17737 return (int64_t)ret_conv;
17740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17741 LDKDecodeError e_conv;
17742 e_conv.inner = (void*)(e & (~1));
17743 e_conv.is_owned = (e & 1) || (e == 0);
17744 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17745 e_conv = DecodeError_clone(&e_conv);
17746 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17747 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17748 return (int64_t)ret_conv;
17751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17752 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
17753 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17758 if ((_res & 1) != 0) return;
17759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17760 CHECK_ACCESS(_res_ptr);
17761 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17763 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
17767 LDKCVec_NetAddressZ o_constr;
17768 o_constr.datalen = (*env)->GetArrayLength(env, o);
17769 if (o_constr.datalen > 0)
17770 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17772 o_constr.data = NULL;
17773 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17774 for (size_t m = 0; m < o_constr.datalen; m++) {
17775 int64_t o_conv_12 = o_vals[m];
17776 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
17777 CHECK_ACCESS(o_conv_12_ptr);
17778 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17779 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
17780 o_constr.data[m] = o_conv_12_conv;
17782 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17783 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17784 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17785 int64_t ret_ref = (uintptr_t)ret_copy;
17789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
17790 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17791 *ret_copy = COption_CVec_NetAddressZZ_none();
17792 int64_t ret_ref = (uintptr_t)ret_copy;
17796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17797 if ((_res & 1) != 0) return;
17798 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17799 CHECK_ACCESS(_res_ptr);
17800 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17802 COption_CVec_NetAddressZZ_free(_res_conv);
17805 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17806 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17807 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17808 int64_t ret_ref = (uintptr_t)ret_copy;
17811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17812 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
17813 int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17818 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
17819 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17820 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17821 int64_t ret_ref = (uintptr_t)ret_copy;
17825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17826 LDKDelayedPaymentOutputDescriptor o_conv;
17827 o_conv.inner = (void*)(o & (~1));
17828 o_conv.is_owned = (o & 1) || (o == 0);
17829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17830 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17831 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17832 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17833 return (int64_t)ret_conv;
17836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17837 LDKDecodeError e_conv;
17838 e_conv.inner = (void*)(e & (~1));
17839 e_conv.is_owned = (e & 1) || (e == 0);
17840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17841 e_conv = DecodeError_clone(&e_conv);
17842 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17843 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17844 return (int64_t)ret_conv;
17847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17848 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
17849 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17854 if ((_res & 1) != 0) return;
17855 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17856 CHECK_ACCESS(_res_ptr);
17857 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17859 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17862 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17863 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17864 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17865 return (int64_t)ret_conv;
17867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17868 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
17869 int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17874 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
17875 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17876 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17877 return (int64_t)ret_conv;
17880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17881 LDKStaticPaymentOutputDescriptor o_conv;
17882 o_conv.inner = (void*)(o & (~1));
17883 o_conv.is_owned = (o & 1) || (o == 0);
17884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17885 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17886 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17887 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17888 return (int64_t)ret_conv;
17891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17892 LDKDecodeError e_conv;
17893 e_conv.inner = (void*)(e & (~1));
17894 e_conv.is_owned = (e & 1) || (e == 0);
17895 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17896 e_conv = DecodeError_clone(&e_conv);
17897 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17898 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17899 return (int64_t)ret_conv;
17902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17903 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
17904 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17909 if ((_res & 1) != 0) return;
17910 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17911 CHECK_ACCESS(_res_ptr);
17912 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17914 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17917 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17918 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17919 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17920 return (int64_t)ret_conv;
17922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17923 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
17924 int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17929 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
17930 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17931 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17932 return (int64_t)ret_conv;
17935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17936 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17937 CHECK_ACCESS(o_ptr);
17938 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17939 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
17940 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17941 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17942 return (int64_t)ret_conv;
17945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17946 LDKDecodeError e_conv;
17947 e_conv.inner = (void*)(e & (~1));
17948 e_conv.is_owned = (e & 1) || (e == 0);
17949 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17950 e_conv = DecodeError_clone(&e_conv);
17951 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17952 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17953 return (int64_t)ret_conv;
17956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17957 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
17958 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17963 if ((_res & 1) != 0) return;
17964 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17965 CHECK_ACCESS(_res_ptr);
17966 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17968 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17971 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17972 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17973 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17974 return (int64_t)ret_conv;
17976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17977 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
17978 int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17983 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
17984 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17985 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17986 return (int64_t)ret_conv;
17989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17990 LDKCVec_PaymentPreimageZ _res_constr;
17991 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17992 if (_res_constr.datalen > 0)
17993 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
17995 _res_constr.data = NULL;
17996 for (size_t i = 0; i < _res_constr.datalen; i++) {
17997 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17998 LDKThirtyTwoBytes _res_conv_8_ref;
17999 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18000 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18001 _res_constr.data[i] = _res_conv_8_ref;
18003 CVec_PaymentPreimageZ_free(_res_constr);
18006 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
18007 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18008 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
18009 return ((int64_t)ret_conv);
18011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18012 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
18013 int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
18017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18018 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
18019 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18020 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
18021 return ((int64_t)ret_conv);
18024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
18025 LDKSignature a_ref;
18026 CHECK((*env)->GetArrayLength(env, a) == 64);
18027 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18028 LDKCVec_SignatureZ b_constr;
18029 b_constr.datalen = (*env)->GetArrayLength(env, b);
18030 if (b_constr.datalen > 0)
18031 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18033 b_constr.data = NULL;
18034 for (size_t i = 0; i < b_constr.datalen; i++) {
18035 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
18036 LDKSignature b_conv_8_ref;
18037 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
18038 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
18039 b_constr.data[i] = b_conv_8_ref;
18041 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18042 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
18043 return ((int64_t)ret_conv);
18046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18047 if ((_res & 1) != 0) return;
18048 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18049 CHECK_ACCESS(_res_ptr);
18050 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
18052 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
18055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18056 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18057 CHECK_ACCESS(o_ptr);
18058 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
18059 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
18060 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18061 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
18062 return (int64_t)ret_conv;
18065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
18066 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18067 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
18068 return (int64_t)ret_conv;
18071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18072 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
18073 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
18077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18078 if ((_res & 1) != 0) return;
18079 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18080 CHECK_ACCESS(_res_ptr);
18081 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
18083 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
18086 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
18087 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18088 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
18089 return (int64_t)ret_conv;
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18092 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
18093 int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
18097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18098 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
18099 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18100 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
18101 return (int64_t)ret_conv;
18104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18105 LDKSignature o_ref;
18106 CHECK((*env)->GetArrayLength(env, o) == 64);
18107 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
18108 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18109 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
18110 return (int64_t)ret_conv;
18113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18114 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18115 *ret_conv = CResult_SignatureNoneZ_err();
18116 return (int64_t)ret_conv;
18119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18120 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
18121 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
18125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18126 if ((_res & 1) != 0) return;
18127 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18128 CHECK_ACCESS(_res_ptr);
18129 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
18131 CResult_SignatureNoneZ_free(_res_conv);
18134 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
18135 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18136 *ret_conv = CResult_SignatureNoneZ_clone(arg);
18137 return (int64_t)ret_conv;
18139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18140 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
18141 int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
18145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18146 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
18147 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18148 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
18149 return (int64_t)ret_conv;
18152 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
18153 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18154 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
18155 return ((int64_t)ret_conv);
18157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18158 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
18159 int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
18163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18164 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
18165 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18166 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
18167 return ((int64_t)ret_conv);
18170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18171 LDKSignature a_ref;
18172 CHECK((*env)->GetArrayLength(env, a) == 64);
18173 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18174 LDKSignature b_ref;
18175 CHECK((*env)->GetArrayLength(env, b) == 64);
18176 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
18177 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18178 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
18179 return ((int64_t)ret_conv);
18182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18183 if ((_res & 1) != 0) return;
18184 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18185 CHECK_ACCESS(_res_ptr);
18186 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
18188 C2Tuple_SignatureSignatureZ_free(_res_conv);
18191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18192 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18193 CHECK_ACCESS(o_ptr);
18194 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
18195 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
18196 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18197 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
18198 return (int64_t)ret_conv;
18201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
18202 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18203 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
18204 return (int64_t)ret_conv;
18207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18208 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
18209 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
18213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18214 if ((_res & 1) != 0) return;
18215 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18216 CHECK_ACCESS(_res_ptr);
18217 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
18219 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
18222 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
18223 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18224 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
18225 return (int64_t)ret_conv;
18227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18228 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
18229 int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
18233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18234 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
18235 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18236 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
18237 return (int64_t)ret_conv;
18240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18241 LDKSecretKey o_ref;
18242 CHECK((*env)->GetArrayLength(env, o) == 32);
18243 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
18244 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18245 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
18246 return (int64_t)ret_conv;
18249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
18250 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18251 *ret_conv = CResult_SecretKeyNoneZ_err();
18252 return (int64_t)ret_conv;
18255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18256 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
18257 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
18261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18262 if ((_res & 1) != 0) return;
18263 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18264 CHECK_ACCESS(_res_ptr);
18265 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
18267 CResult_SecretKeyNoneZ_free(_res_conv);
18270 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
18271 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18272 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
18273 return (int64_t)ret_conv;
18275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18276 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
18277 int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
18281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18282 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
18283 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18284 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
18285 return (int64_t)ret_conv;
18288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18289 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18290 CHECK_ACCESS(o_ptr);
18291 LDKSign o_conv = *(LDKSign*)(o_ptr);
18292 if (o_conv.free == LDKSign_JCalls_free) {
18293 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18294 LDKSign_JCalls_cloned(&o_conv);
18296 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18297 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
18298 return (int64_t)ret_conv;
18301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18302 LDKDecodeError e_conv;
18303 e_conv.inner = (void*)(e & (~1));
18304 e_conv.is_owned = (e & 1) || (e == 0);
18305 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18306 e_conv = DecodeError_clone(&e_conv);
18307 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18308 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
18309 return (int64_t)ret_conv;
18312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18313 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
18314 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
18318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18319 if ((_res & 1) != 0) return;
18320 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18321 CHECK_ACCESS(_res_ptr);
18322 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
18324 CResult_SignDecodeErrorZ_free(_res_conv);
18327 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
18328 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18329 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
18330 return (int64_t)ret_conv;
18332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18333 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
18334 int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
18338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18339 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
18340 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18341 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
18342 return (int64_t)ret_conv;
18345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18346 LDKCVec_u5Z _res_constr;
18347 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18348 if (_res_constr.datalen > 0)
18349 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
18351 _res_constr.data = NULL;
18352 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
18353 for (size_t h = 0; h < _res_constr.datalen; h++) {
18354 int8_t _res_conv_7 = _res_vals[h];
18356 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
18358 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
18359 CVec_u5Z_free(_res_constr);
18362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18363 LDKRecoverableSignature o_ref;
18364 CHECK((*env)->GetArrayLength(env, o) == 68);
18365 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
18366 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18367 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
18368 return (int64_t)ret_conv;
18371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18372 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18373 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
18374 return (int64_t)ret_conv;
18377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18378 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
18379 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
18383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18384 if ((_res & 1) != 0) return;
18385 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18386 CHECK_ACCESS(_res_ptr);
18387 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
18389 CResult_RecoverableSignatureNoneZ_free(_res_conv);
18392 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
18393 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18394 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
18395 return (int64_t)ret_conv;
18397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18398 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
18399 int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18404 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
18405 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18406 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18407 return (int64_t)ret_conv;
18410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
18411 LDKCVec_u8Z _res_ref;
18412 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
18413 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18414 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
18415 CVec_u8Z_free(_res_ref);
18418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18419 LDKCVec_CVec_u8ZZ _res_constr;
18420 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18421 if (_res_constr.datalen > 0)
18422 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18424 _res_constr.data = NULL;
18425 for (size_t i = 0; i < _res_constr.datalen; i++) {
18426 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18427 LDKCVec_u8Z _res_conv_8_ref;
18428 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
18429 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18430 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
18431 _res_constr.data[i] = _res_conv_8_ref;
18433 CVec_CVec_u8ZZ_free(_res_constr);
18436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
18437 LDKCVec_CVec_u8ZZ o_constr;
18438 o_constr.datalen = (*env)->GetArrayLength(env, o);
18439 if (o_constr.datalen > 0)
18440 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18442 o_constr.data = NULL;
18443 for (size_t i = 0; i < o_constr.datalen; i++) {
18444 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
18445 LDKCVec_u8Z o_conv_8_ref;
18446 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
18447 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18448 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
18449 o_constr.data[i] = o_conv_8_ref;
18451 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18452 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
18453 return (int64_t)ret_conv;
18456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
18457 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18458 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
18459 return (int64_t)ret_conv;
18462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18463 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
18464 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
18468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_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_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
18474 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
18477 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
18478 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18479 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
18480 return (int64_t)ret_conv;
18482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18483 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
18484 int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
18488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18489 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
18490 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18491 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
18492 return (int64_t)ret_conv;
18495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18496 LDKInMemorySigner o_conv;
18497 o_conv.inner = (void*)(o & (~1));
18498 o_conv.is_owned = (o & 1) || (o == 0);
18499 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18500 o_conv = InMemorySigner_clone(&o_conv);
18501 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18502 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18503 return (int64_t)ret_conv;
18506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18507 LDKDecodeError e_conv;
18508 e_conv.inner = (void*)(e & (~1));
18509 e_conv.is_owned = (e & 1) || (e == 0);
18510 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18511 e_conv = DecodeError_clone(&e_conv);
18512 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18513 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18514 return (int64_t)ret_conv;
18517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18518 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
18519 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18524 if ((_res & 1) != 0) return;
18525 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18526 CHECK_ACCESS(_res_ptr);
18527 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18529 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18532 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18533 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18534 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18535 return (int64_t)ret_conv;
18537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18538 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
18539 int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18544 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
18545 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18546 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18547 return (int64_t)ret_conv;
18550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18551 LDKCVec_TxOutZ _res_constr;
18552 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18553 if (_res_constr.datalen > 0)
18554 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18556 _res_constr.data = NULL;
18557 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18558 for (size_t h = 0; h < _res_constr.datalen; h++) {
18559 int64_t _res_conv_7 = _res_vals[h];
18560 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
18561 CHECK_ACCESS(_res_conv_7_ptr);
18562 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
18563 FREE((void*)_res_conv_7);
18564 _res_constr.data[h] = _res_conv_7_conv;
18566 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18567 CVec_TxOutZ_free(_res_constr);
18570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18571 LDKTransaction o_ref;
18572 o_ref.datalen = (*env)->GetArrayLength(env, o);
18573 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18574 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
18575 o_ref.data_is_owned = true;
18576 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18577 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18578 return (int64_t)ret_conv;
18581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
18582 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18583 *ret_conv = CResult_TransactionNoneZ_err();
18584 return (int64_t)ret_conv;
18587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18588 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
18589 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18594 if ((_res & 1) != 0) return;
18595 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18596 CHECK_ACCESS(_res_ptr);
18597 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18599 CResult_TransactionNoneZ_free(_res_conv);
18602 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18603 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18604 *ret_conv = CResult_TransactionNoneZ_clone(arg);
18605 return (int64_t)ret_conv;
18607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18608 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
18609 int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18614 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
18615 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18616 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18617 return (int64_t)ret_conv;
18620 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18621 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18622 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18623 return ((int64_t)ret_conv);
18625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18626 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
18627 int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18632 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
18633 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18634 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18635 return ((int64_t)ret_conv);
18638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18639 LDKThirtyTwoBytes a_ref;
18640 CHECK((*env)->GetArrayLength(env, a) == 32);
18641 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18642 LDKChannelMonitor b_conv;
18643 b_conv.inner = (void*)(b & (~1));
18644 b_conv.is_owned = (b & 1) || (b == 0);
18645 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18646 b_conv = ChannelMonitor_clone(&b_conv);
18647 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18648 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18649 return ((int64_t)ret_conv);
18652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18653 if ((_res & 1) != 0) return;
18654 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18655 CHECK_ACCESS(_res_ptr);
18656 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18658 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18662 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
18663 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18664 if (_res_constr.datalen > 0)
18665 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18667 _res_constr.data = NULL;
18668 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18669 for (size_t j = 0; j < _res_constr.datalen; j++) {
18670 int64_t _res_conv_35 = _res_vals[j];
18671 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
18672 CHECK_ACCESS(_res_conv_35_ptr);
18673 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
18674 FREE((void*)_res_conv_35);
18675 _res_constr.data[j] = _res_conv_35_conv;
18677 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18678 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
18681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
18682 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
18683 o_constr.datalen = (*env)->GetArrayLength(env, o);
18684 if (o_constr.datalen > 0)
18685 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18687 o_constr.data = NULL;
18688 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18689 for (size_t j = 0; j < o_constr.datalen; j++) {
18690 int64_t o_conv_35 = o_vals[j];
18691 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
18692 CHECK_ACCESS(o_conv_35_ptr);
18693 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
18694 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
18695 o_constr.data[j] = o_conv_35_conv;
18697 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18698 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18699 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
18700 return (int64_t)ret_conv;
18703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18704 LDKIOError e_conv = LDKIOError_from_java(env, e);
18705 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18706 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
18707 return (int64_t)ret_conv;
18710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18711 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
18712 jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
18716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18717 if ((_res & 1) != 0) return;
18718 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18719 CHECK_ACCESS(_res_ptr);
18720 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
18722 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
18725 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
18726 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18727 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
18728 return (int64_t)ret_conv;
18730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18731 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
18732 int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
18736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18737 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
18738 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18739 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
18740 return (int64_t)ret_conv;
18743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
18744 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18745 *ret_copy = COption_u16Z_some(o);
18746 int64_t ret_ref = (uintptr_t)ret_copy;
18750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
18751 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18752 *ret_copy = COption_u16Z_none();
18753 int64_t ret_ref = (uintptr_t)ret_copy;
18757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18758 if ((_res & 1) != 0) return;
18759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18760 CHECK_ACCESS(_res_ptr);
18761 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18763 COption_u16Z_free(_res_conv);
18766 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18767 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18768 *ret_copy = COption_u16Z_clone(arg);
18769 int64_t ret_ref = (uintptr_t)ret_copy;
18772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18773 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
18774 int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18779 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
18780 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18781 *ret_copy = COption_u16Z_clone(orig_conv);
18782 int64_t ret_ref = (uintptr_t)ret_copy;
18786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
18787 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18788 *ret_conv = CResult_NoneAPIErrorZ_ok();
18789 return (int64_t)ret_conv;
18792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18793 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18794 CHECK_ACCESS(e_ptr);
18795 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18796 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18797 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18798 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18799 return (int64_t)ret_conv;
18802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18803 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
18804 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18809 if ((_res & 1) != 0) return;
18810 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18811 CHECK_ACCESS(_res_ptr);
18812 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18814 CResult_NoneAPIErrorZ_free(_res_conv);
18817 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18818 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18819 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18820 return (int64_t)ret_conv;
18822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18823 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
18824 int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18829 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
18830 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18831 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18832 return (int64_t)ret_conv;
18835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18836 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18837 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18838 if (_res_constr.datalen > 0)
18839 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18841 _res_constr.data = NULL;
18842 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18843 for (size_t w = 0; w < _res_constr.datalen; w++) {
18844 int64_t _res_conv_22 = _res_vals[w];
18845 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
18846 CHECK_ACCESS(_res_conv_22_ptr);
18847 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18848 FREE((void*)_res_conv_22);
18849 _res_constr.data[w] = _res_conv_22_conv;
18851 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18852 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18856 LDKCVec_APIErrorZ _res_constr;
18857 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18858 if (_res_constr.datalen > 0)
18859 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18861 _res_constr.data = NULL;
18862 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18863 for (size_t k = 0; k < _res_constr.datalen; k++) {
18864 int64_t _res_conv_10 = _res_vals[k];
18865 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
18866 CHECK_ACCESS(_res_conv_10_ptr);
18867 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18868 FREE((void*)_res_conv_10);
18869 _res_constr.data[k] = _res_conv_10_conv;
18871 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18872 CVec_APIErrorZ_free(_res_constr);
18875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18876 LDKThirtyTwoBytes o_ref;
18877 CHECK((*env)->GetArrayLength(env, o) == 32);
18878 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18879 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18880 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
18881 return (int64_t)ret_conv;
18884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18885 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18886 CHECK_ACCESS(e_ptr);
18887 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18888 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18889 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18890 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
18891 return (int64_t)ret_conv;
18894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18895 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
18896 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
18900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18901 if ((_res & 1) != 0) return;
18902 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18903 CHECK_ACCESS(_res_ptr);
18904 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
18906 CResult__u832APIErrorZ_free(_res_conv);
18909 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
18910 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18911 *ret_conv = CResult__u832APIErrorZ_clone(arg);
18912 return (int64_t)ret_conv;
18914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18915 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
18916 int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
18920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18921 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
18922 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18923 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
18924 return (int64_t)ret_conv;
18927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18928 LDKThirtyTwoBytes o_ref;
18929 CHECK((*env)->GetArrayLength(env, o) == 32);
18930 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18931 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18932 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
18933 return (int64_t)ret_conv;
18936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18937 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18938 CHECK_ACCESS(e_ptr);
18939 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18940 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
18941 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18942 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
18943 return (int64_t)ret_conv;
18946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18947 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
18948 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
18952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18953 if ((_res & 1) != 0) return;
18954 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18955 CHECK_ACCESS(_res_ptr);
18956 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
18958 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
18961 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
18962 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18963 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
18964 return (int64_t)ret_conv;
18966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18967 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
18968 int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
18972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18973 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
18974 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18975 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
18976 return (int64_t)ret_conv;
18979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
18980 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18981 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
18982 return (int64_t)ret_conv;
18985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18986 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18987 CHECK_ACCESS(e_ptr);
18988 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18989 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
18990 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18991 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
18992 return (int64_t)ret_conv;
18995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18996 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
18997 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
19001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19002 if ((_res & 1) != 0) return;
19003 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19004 CHECK_ACCESS(_res_ptr);
19005 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
19007 CResult_NonePaymentSendFailureZ_free(_res_conv);
19010 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
19011 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19012 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
19013 return (int64_t)ret_conv;
19015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19016 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
19017 int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
19021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19022 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
19023 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19024 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
19025 return (int64_t)ret_conv;
19028 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
19029 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19030 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
19031 return ((int64_t)ret_conv);
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19034 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
19035 int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
19039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19040 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
19041 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19042 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
19043 return ((int64_t)ret_conv);
19046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19047 LDKThirtyTwoBytes a_ref;
19048 CHECK((*env)->GetArrayLength(env, a) == 32);
19049 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19050 LDKThirtyTwoBytes b_ref;
19051 CHECK((*env)->GetArrayLength(env, b) == 32);
19052 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19053 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19054 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
19055 return ((int64_t)ret_conv);
19058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19059 if ((_res & 1) != 0) return;
19060 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19061 CHECK_ACCESS(_res_ptr);
19062 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
19064 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
19067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19068 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19069 CHECK_ACCESS(o_ptr);
19070 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
19071 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
19072 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19073 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
19074 return (int64_t)ret_conv;
19077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19078 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19079 CHECK_ACCESS(e_ptr);
19080 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19081 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19082 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19083 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
19084 return (int64_t)ret_conv;
19087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19088 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
19089 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
19093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19094 if ((_res & 1) != 0) return;
19095 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19096 CHECK_ACCESS(_res_ptr);
19097 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
19099 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
19102 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
19103 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19104 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
19105 return (int64_t)ret_conv;
19107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19108 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
19109 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
19113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19114 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
19115 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19116 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
19117 return (int64_t)ret_conv;
19120 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
19121 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19122 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
19123 return ((int64_t)ret_conv);
19125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19126 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
19127 int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
19131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19132 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
19133 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19134 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
19135 return ((int64_t)ret_conv);
19138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19139 LDKThirtyTwoBytes a_ref;
19140 CHECK((*env)->GetArrayLength(env, a) == 32);
19141 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19142 LDKThirtyTwoBytes b_ref;
19143 CHECK((*env)->GetArrayLength(env, b) == 32);
19144 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19145 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19146 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
19147 return ((int64_t)ret_conv);
19150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19151 if ((_res & 1) != 0) return;
19152 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19153 CHECK_ACCESS(_res_ptr);
19154 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
19156 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
19159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19160 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19161 CHECK_ACCESS(o_ptr);
19162 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19163 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19164 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19165 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
19166 return (int64_t)ret_conv;
19169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
19170 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19171 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
19172 return (int64_t)ret_conv;
19175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19176 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
19177 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
19181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19182 if ((_res & 1) != 0) return;
19183 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19184 CHECK_ACCESS(_res_ptr);
19185 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
19187 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
19190 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
19191 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19192 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
19193 return (int64_t)ret_conv;
19195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19196 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
19197 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
19201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19202 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
19203 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19204 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
19205 return (int64_t)ret_conv;
19208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19209 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19210 CHECK_ACCESS(o_ptr);
19211 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19212 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19213 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19214 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
19215 return (int64_t)ret_conv;
19218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19219 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19220 CHECK_ACCESS(e_ptr);
19221 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19222 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19223 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19224 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
19225 return (int64_t)ret_conv;
19228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19229 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
19230 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
19234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19235 if ((_res & 1) != 0) return;
19236 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19237 CHECK_ACCESS(_res_ptr);
19238 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
19240 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
19243 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
19244 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19245 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
19246 return (int64_t)ret_conv;
19248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19249 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
19250 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
19254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19255 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
19256 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19257 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
19258 return (int64_t)ret_conv;
19261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19262 LDKThirtyTwoBytes o_ref;
19263 CHECK((*env)->GetArrayLength(env, o) == 32);
19264 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19265 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19266 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
19267 return (int64_t)ret_conv;
19270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
19271 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19272 *ret_conv = CResult_PaymentSecretNoneZ_err();
19273 return (int64_t)ret_conv;
19276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19277 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
19278 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
19282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19283 if ((_res & 1) != 0) return;
19284 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19285 CHECK_ACCESS(_res_ptr);
19286 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
19288 CResult_PaymentSecretNoneZ_free(_res_conv);
19291 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
19292 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19293 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
19294 return (int64_t)ret_conv;
19296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19297 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
19298 int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
19302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19303 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
19304 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19305 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
19306 return (int64_t)ret_conv;
19309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19310 LDKThirtyTwoBytes o_ref;
19311 CHECK((*env)->GetArrayLength(env, o) == 32);
19312 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19313 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19314 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
19315 return (int64_t)ret_conv;
19318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19319 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19320 CHECK_ACCESS(e_ptr);
19321 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19322 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19323 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19324 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
19325 return (int64_t)ret_conv;
19328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19329 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
19330 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
19334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19335 if ((_res & 1) != 0) return;
19336 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19337 CHECK_ACCESS(_res_ptr);
19338 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
19340 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
19343 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
19344 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19345 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
19346 return (int64_t)ret_conv;
19348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19349 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
19350 int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
19354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19355 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
19356 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19357 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
19358 return (int64_t)ret_conv;
19361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19362 LDKThirtyTwoBytes o_ref;
19363 CHECK((*env)->GetArrayLength(env, o) == 32);
19364 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19365 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19366 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
19367 return (int64_t)ret_conv;
19370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19371 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19372 CHECK_ACCESS(e_ptr);
19373 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19374 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19375 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19376 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
19377 return (int64_t)ret_conv;
19380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19381 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
19382 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
19386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19387 if ((_res & 1) != 0) return;
19388 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19389 CHECK_ACCESS(_res_ptr);
19390 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
19392 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
19395 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
19396 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19397 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
19398 return (int64_t)ret_conv;
19400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19401 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
19402 int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
19406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19407 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
19408 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19409 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
19410 return (int64_t)ret_conv;
19413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19414 LDKCounterpartyForwardingInfo o_conv;
19415 o_conv.inner = (void*)(o & (~1));
19416 o_conv.is_owned = (o & 1) || (o == 0);
19417 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19418 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
19419 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19420 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
19421 return (int64_t)ret_conv;
19424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19425 LDKDecodeError e_conv;
19426 e_conv.inner = (void*)(e & (~1));
19427 e_conv.is_owned = (e & 1) || (e == 0);
19428 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19429 e_conv = DecodeError_clone(&e_conv);
19430 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19431 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
19432 return (int64_t)ret_conv;
19435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19436 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
19437 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
19441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19442 if ((_res & 1) != 0) return;
19443 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19444 CHECK_ACCESS(_res_ptr);
19445 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
19447 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
19450 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
19451 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19452 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
19453 return (int64_t)ret_conv;
19455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19456 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
19457 int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
19461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19462 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
19463 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19464 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
19465 return (int64_t)ret_conv;
19468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19469 LDKChannelCounterparty o_conv;
19470 o_conv.inner = (void*)(o & (~1));
19471 o_conv.is_owned = (o & 1) || (o == 0);
19472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19473 o_conv = ChannelCounterparty_clone(&o_conv);
19474 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19475 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
19476 return (int64_t)ret_conv;
19479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19480 LDKDecodeError e_conv;
19481 e_conv.inner = (void*)(e & (~1));
19482 e_conv.is_owned = (e & 1) || (e == 0);
19483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19484 e_conv = DecodeError_clone(&e_conv);
19485 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19486 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
19487 return (int64_t)ret_conv;
19490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19491 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
19492 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
19496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19497 if ((_res & 1) != 0) return;
19498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19499 CHECK_ACCESS(_res_ptr);
19500 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
19502 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
19505 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
19506 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19507 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
19508 return (int64_t)ret_conv;
19510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19511 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
19512 int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
19516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19517 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
19518 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19519 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
19520 return (int64_t)ret_conv;
19523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19524 LDKChannelDetails o_conv;
19525 o_conv.inner = (void*)(o & (~1));
19526 o_conv.is_owned = (o & 1) || (o == 0);
19527 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19528 o_conv = ChannelDetails_clone(&o_conv);
19529 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19530 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
19531 return (int64_t)ret_conv;
19534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19535 LDKDecodeError e_conv;
19536 e_conv.inner = (void*)(e & (~1));
19537 e_conv.is_owned = (e & 1) || (e == 0);
19538 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19539 e_conv = DecodeError_clone(&e_conv);
19540 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19541 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
19542 return (int64_t)ret_conv;
19545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19546 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
19547 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
19551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19552 if ((_res & 1) != 0) return;
19553 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19554 CHECK_ACCESS(_res_ptr);
19555 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
19557 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
19560 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
19561 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19562 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
19563 return (int64_t)ret_conv;
19565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19566 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
19567 int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
19571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19572 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
19573 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19574 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
19575 return (int64_t)ret_conv;
19578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19579 LDKPhantomRouteHints o_conv;
19580 o_conv.inner = (void*)(o & (~1));
19581 o_conv.is_owned = (o & 1) || (o == 0);
19582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19583 o_conv = PhantomRouteHints_clone(&o_conv);
19584 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19585 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
19586 return (int64_t)ret_conv;
19589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19590 LDKDecodeError e_conv;
19591 e_conv.inner = (void*)(e & (~1));
19592 e_conv.is_owned = (e & 1) || (e == 0);
19593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19594 e_conv = DecodeError_clone(&e_conv);
19595 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19596 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
19597 return (int64_t)ret_conv;
19600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19601 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
19602 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
19606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_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_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
19612 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
19615 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
19616 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19617 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
19618 return (int64_t)ret_conv;
19620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19621 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
19622 int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
19626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19627 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
19628 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19629 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
19630 return (int64_t)ret_conv;
19633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19634 LDKCVec_ChannelMonitorZ _res_constr;
19635 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19636 if (_res_constr.datalen > 0)
19637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19639 _res_constr.data = NULL;
19640 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19641 for (size_t q = 0; q < _res_constr.datalen; q++) {
19642 int64_t _res_conv_16 = _res_vals[q];
19643 LDKChannelMonitor _res_conv_16_conv;
19644 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
19645 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
19646 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19647 _res_constr.data[q] = _res_conv_16_conv;
19649 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19650 CVec_ChannelMonitorZ_free(_res_constr);
19653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19654 LDKThirtyTwoBytes a_ref;
19655 CHECK((*env)->GetArrayLength(env, a) == 32);
19656 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19657 LDKChannelManager b_conv;
19658 b_conv.inner = (void*)(b & (~1));
19659 b_conv.is_owned = (b & 1) || (b == 0);
19660 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19661 // WARNING: we need a move here but no clone is available for LDKChannelManager
19662 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
19663 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
19664 return ((int64_t)ret_conv);
19667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19668 if ((_res & 1) != 0) return;
19669 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19670 CHECK_ACCESS(_res_ptr);
19671 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
19673 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
19676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19677 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19678 CHECK_ACCESS(o_ptr);
19679 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
19680 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
19681 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19682 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
19683 return (int64_t)ret_conv;
19686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19687 LDKDecodeError e_conv;
19688 e_conv.inner = (void*)(e & (~1));
19689 e_conv.is_owned = (e & 1) || (e == 0);
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19691 e_conv = DecodeError_clone(&e_conv);
19692 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19693 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
19694 return (int64_t)ret_conv;
19697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19698 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
19699 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
19703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19704 if ((_res & 1) != 0) return;
19705 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19706 CHECK_ACCESS(_res_ptr);
19707 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
19709 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
19712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19713 LDKChannelConfig o_conv;
19714 o_conv.inner = (void*)(o & (~1));
19715 o_conv.is_owned = (o & 1) || (o == 0);
19716 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19717 o_conv = ChannelConfig_clone(&o_conv);
19718 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19719 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
19720 return (int64_t)ret_conv;
19723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19724 LDKDecodeError e_conv;
19725 e_conv.inner = (void*)(e & (~1));
19726 e_conv.is_owned = (e & 1) || (e == 0);
19727 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19728 e_conv = DecodeError_clone(&e_conv);
19729 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19730 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
19731 return (int64_t)ret_conv;
19734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19735 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
19736 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
19740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19741 if ((_res & 1) != 0) return;
19742 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19743 CHECK_ACCESS(_res_ptr);
19744 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
19746 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
19749 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
19750 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19751 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
19752 return (int64_t)ret_conv;
19754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19755 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
19756 int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
19760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19761 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
19762 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19763 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
19764 return (int64_t)ret_conv;
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19768 LDKOutPoint o_conv;
19769 o_conv.inner = (void*)(o & (~1));
19770 o_conv.is_owned = (o & 1) || (o == 0);
19771 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19772 o_conv = OutPoint_clone(&o_conv);
19773 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19774 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
19775 return (int64_t)ret_conv;
19778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19779 LDKDecodeError e_conv;
19780 e_conv.inner = (void*)(e & (~1));
19781 e_conv.is_owned = (e & 1) || (e == 0);
19782 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19783 e_conv = DecodeError_clone(&e_conv);
19784 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19785 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
19786 return (int64_t)ret_conv;
19789 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19790 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
19791 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
19795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19796 if ((_res & 1) != 0) return;
19797 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19798 CHECK_ACCESS(_res_ptr);
19799 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
19801 CResult_OutPointDecodeErrorZ_free(_res_conv);
19804 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
19805 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19806 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
19807 return (int64_t)ret_conv;
19809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19810 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
19811 int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
19815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19816 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
19817 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19818 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
19819 return (int64_t)ret_conv;
19822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19823 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19824 CHECK_ACCESS(o_ptr);
19825 LDKType o_conv = *(LDKType*)(o_ptr);
19826 if (o_conv.free == LDKType_JCalls_free) {
19827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19828 LDKType_JCalls_cloned(&o_conv);
19830 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19831 *ret_copy = COption_TypeZ_some(o_conv);
19832 int64_t ret_ref = (uintptr_t)ret_copy;
19836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
19837 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19838 *ret_copy = COption_TypeZ_none();
19839 int64_t ret_ref = (uintptr_t)ret_copy;
19843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19844 if ((_res & 1) != 0) return;
19845 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19846 CHECK_ACCESS(_res_ptr);
19847 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
19849 COption_TypeZ_free(_res_conv);
19852 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
19853 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19854 *ret_copy = COption_TypeZ_clone(arg);
19855 int64_t ret_ref = (uintptr_t)ret_copy;
19858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19859 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
19860 int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
19864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19865 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
19866 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19867 *ret_copy = COption_TypeZ_clone(orig_conv);
19868 int64_t ret_ref = (uintptr_t)ret_copy;
19872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19873 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19874 CHECK_ACCESS(o_ptr);
19875 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
19876 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
19877 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19878 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
19879 return (int64_t)ret_conv;
19882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19883 LDKDecodeError e_conv;
19884 e_conv.inner = (void*)(e & (~1));
19885 e_conv.is_owned = (e & 1) || (e == 0);
19886 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19887 e_conv = DecodeError_clone(&e_conv);
19888 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19889 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
19890 return (int64_t)ret_conv;
19893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19894 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
19895 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
19899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19900 if ((_res & 1) != 0) return;
19901 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19902 CHECK_ACCESS(_res_ptr);
19903 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
19905 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
19908 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
19909 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19910 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
19911 return (int64_t)ret_conv;
19913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19914 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
19915 int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
19919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19920 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
19921 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19922 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
19923 return (int64_t)ret_conv;
19926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19927 LDKThirtyTwoBytes o_ref;
19928 CHECK((*env)->GetArrayLength(env, o) == 32);
19929 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19930 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19931 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
19932 return (int64_t)ret_conv;
19935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19936 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19937 CHECK_ACCESS(e_ptr);
19938 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
19939 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
19940 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19941 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
19942 return (int64_t)ret_conv;
19945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19946 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
19947 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
19951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19952 if ((_res & 1) != 0) return;
19953 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19954 CHECK_ACCESS(_res_ptr);
19955 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
19957 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
19960 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
19961 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19962 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
19963 return (int64_t)ret_conv;
19965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19966 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
19967 int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
19971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19972 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
19973 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19974 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
19975 return (int64_t)ret_conv;
19978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
19979 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
19980 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19981 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19982 return (int64_t)ret_conv;
19985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19986 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19987 CHECK_ACCESS(e_ptr);
19988 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19989 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
19990 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19991 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19992 return (int64_t)ret_conv;
19995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19996 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
19997 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
20001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20002 if ((_res & 1) != 0) return;
20003 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20004 CHECK_ACCESS(_res_ptr);
20005 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
20007 CResult_SiPrefixParseErrorZ_free(_res_conv);
20010 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
20011 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20012 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
20013 return (int64_t)ret_conv;
20015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20016 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
20017 int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
20021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20022 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
20023 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20024 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
20025 return (int64_t)ret_conv;
20028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20030 o_conv.inner = (void*)(o & (~1));
20031 o_conv.is_owned = (o & 1) || (o == 0);
20032 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20033 o_conv = Invoice_clone(&o_conv);
20034 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20035 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
20036 return (int64_t)ret_conv;
20039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20040 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20041 CHECK_ACCESS(e_ptr);
20042 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
20043 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
20044 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20045 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
20046 return (int64_t)ret_conv;
20049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20050 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
20051 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
20055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20056 if ((_res & 1) != 0) return;
20057 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20058 CHECK_ACCESS(_res_ptr);
20059 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
20061 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
20064 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
20065 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20066 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
20067 return (int64_t)ret_conv;
20069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20070 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
20071 int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
20075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20076 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
20077 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20078 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
20079 return (int64_t)ret_conv;
20082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20083 LDKSignedRawInvoice o_conv;
20084 o_conv.inner = (void*)(o & (~1));
20085 o_conv.is_owned = (o & 1) || (o == 0);
20086 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20087 o_conv = SignedRawInvoice_clone(&o_conv);
20088 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20089 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
20090 return (int64_t)ret_conv;
20093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20094 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20095 CHECK_ACCESS(e_ptr);
20096 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20097 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20098 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20099 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
20100 return (int64_t)ret_conv;
20103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20104 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
20105 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
20109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20110 if ((_res & 1) != 0) return;
20111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20112 CHECK_ACCESS(_res_ptr);
20113 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
20115 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
20118 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
20119 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20120 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
20121 return (int64_t)ret_conv;
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20124 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
20125 int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
20129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20130 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
20131 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20132 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
20133 return (int64_t)ret_conv;
20136 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
20137 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20138 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
20139 return ((int64_t)ret_conv);
20141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20142 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
20143 int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
20147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20148 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
20149 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20150 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
20151 return ((int64_t)ret_conv);
20154 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) {
20155 LDKRawInvoice a_conv;
20156 a_conv.inner = (void*)(a & (~1));
20157 a_conv.is_owned = (a & 1) || (a == 0);
20158 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20159 a_conv = RawInvoice_clone(&a_conv);
20160 LDKThirtyTwoBytes b_ref;
20161 CHECK((*env)->GetArrayLength(env, b) == 32);
20162 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20163 LDKInvoiceSignature c_conv;
20164 c_conv.inner = (void*)(c & (~1));
20165 c_conv.is_owned = (c & 1) || (c == 0);
20166 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20167 c_conv = InvoiceSignature_clone(&c_conv);
20168 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20169 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
20170 return ((int64_t)ret_conv);
20173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20174 if ((_res & 1) != 0) return;
20175 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20176 CHECK_ACCESS(_res_ptr);
20177 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
20179 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
20182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20183 LDKPayeePubKey o_conv;
20184 o_conv.inner = (void*)(o & (~1));
20185 o_conv.is_owned = (o & 1) || (o == 0);
20186 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20187 o_conv = PayeePubKey_clone(&o_conv);
20188 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20189 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
20190 return (int64_t)ret_conv;
20193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20194 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20195 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20196 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
20197 return (int64_t)ret_conv;
20200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20201 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
20202 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
20206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20207 if ((_res & 1) != 0) return;
20208 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20209 CHECK_ACCESS(_res_ptr);
20210 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
20212 CResult_PayeePubKeyErrorZ_free(_res_conv);
20215 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
20216 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20217 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
20218 return (int64_t)ret_conv;
20220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20221 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
20222 int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
20226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20227 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
20228 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20229 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
20230 return (int64_t)ret_conv;
20233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20234 LDKCVec_PrivateRouteZ _res_constr;
20235 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20236 if (_res_constr.datalen > 0)
20237 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
20239 _res_constr.data = NULL;
20240 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20241 for (size_t o = 0; o < _res_constr.datalen; o++) {
20242 int64_t _res_conv_14 = _res_vals[o];
20243 LDKPrivateRoute _res_conv_14_conv;
20244 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
20245 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
20246 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
20247 _res_constr.data[o] = _res_conv_14_conv;
20249 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20250 CVec_PrivateRouteZ_free(_res_constr);
20253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20254 LDKPositiveTimestamp o_conv;
20255 o_conv.inner = (void*)(o & (~1));
20256 o_conv.is_owned = (o & 1) || (o == 0);
20257 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20258 o_conv = PositiveTimestamp_clone(&o_conv);
20259 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20260 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
20261 return (int64_t)ret_conv;
20264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20265 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20266 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20267 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
20268 return (int64_t)ret_conv;
20271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20272 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
20273 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
20277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20278 if ((_res & 1) != 0) return;
20279 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20280 CHECK_ACCESS(_res_ptr);
20281 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
20283 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
20286 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
20287 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20288 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
20289 return (int64_t)ret_conv;
20291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20292 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
20293 int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
20297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20298 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
20299 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20300 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
20301 return (int64_t)ret_conv;
20304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
20305 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20306 *ret_conv = CResult_NoneSemanticErrorZ_ok();
20307 return (int64_t)ret_conv;
20310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20311 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
20312 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20313 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
20314 return (int64_t)ret_conv;
20317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20318 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
20319 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
20323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20324 if ((_res & 1) != 0) return;
20325 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20326 CHECK_ACCESS(_res_ptr);
20327 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
20329 CResult_NoneSemanticErrorZ_free(_res_conv);
20332 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
20333 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20334 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
20335 return (int64_t)ret_conv;
20337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20338 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
20339 int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
20343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20344 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
20345 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
20346 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
20347 return (int64_t)ret_conv;
20350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20352 o_conv.inner = (void*)(o & (~1));
20353 o_conv.is_owned = (o & 1) || (o == 0);
20354 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20355 o_conv = Invoice_clone(&o_conv);
20356 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20357 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
20358 return (int64_t)ret_conv;
20361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20362 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
20363 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20364 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
20365 return (int64_t)ret_conv;
20368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20369 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
20370 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
20374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20375 if ((_res & 1) != 0) return;
20376 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20377 CHECK_ACCESS(_res_ptr);
20378 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
20380 CResult_InvoiceSemanticErrorZ_free(_res_conv);
20383 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
20384 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20385 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
20386 return (int64_t)ret_conv;
20388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20389 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
20390 int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
20394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20395 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
20396 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20397 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
20398 return (int64_t)ret_conv;
20401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20402 LDKDescription o_conv;
20403 o_conv.inner = (void*)(o & (~1));
20404 o_conv.is_owned = (o & 1) || (o == 0);
20405 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20406 o_conv = Description_clone(&o_conv);
20407 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20408 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
20409 return (int64_t)ret_conv;
20412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20413 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20414 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20415 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
20416 return (int64_t)ret_conv;
20419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20420 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
20421 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
20425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20426 if ((_res & 1) != 0) return;
20427 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20428 CHECK_ACCESS(_res_ptr);
20429 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
20431 CResult_DescriptionCreationErrorZ_free(_res_conv);
20434 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
20435 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20436 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
20437 return (int64_t)ret_conv;
20439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20440 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
20441 int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
20445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20446 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
20447 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20448 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
20449 return (int64_t)ret_conv;
20452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20453 LDKPrivateRoute o_conv;
20454 o_conv.inner = (void*)(o & (~1));
20455 o_conv.is_owned = (o & 1) || (o == 0);
20456 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20457 o_conv = PrivateRoute_clone(&o_conv);
20458 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20459 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
20460 return (int64_t)ret_conv;
20463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20464 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20465 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20466 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
20467 return (int64_t)ret_conv;
20470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20471 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
20472 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
20476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20477 if ((_res & 1) != 0) return;
20478 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20479 CHECK_ACCESS(_res_ptr);
20480 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
20482 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
20485 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
20486 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20487 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
20488 return (int64_t)ret_conv;
20490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20491 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
20492 int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
20496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20497 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
20498 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20499 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
20500 return (int64_t)ret_conv;
20503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
20504 LDKStr o_conv = java_to_owned_str(env, o);
20505 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20506 *ret_conv = CResult_StringErrorZ_ok(o_conv);
20507 return (int64_t)ret_conv;
20510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20511 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20512 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20513 *ret_conv = CResult_StringErrorZ_err(e_conv);
20514 return (int64_t)ret_conv;
20517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20518 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
20519 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
20523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20524 if ((_res & 1) != 0) return;
20525 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20526 CHECK_ACCESS(_res_ptr);
20527 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
20529 CResult_StringErrorZ_free(_res_conv);
20532 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
20533 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20534 *ret_conv = CResult_StringErrorZ_clone(arg);
20535 return (int64_t)ret_conv;
20537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20538 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
20539 int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
20543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20544 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
20545 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20546 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
20547 return (int64_t)ret_conv;
20550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20551 LDKChannelMonitorUpdate o_conv;
20552 o_conv.inner = (void*)(o & (~1));
20553 o_conv.is_owned = (o & 1) || (o == 0);
20554 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20555 o_conv = ChannelMonitorUpdate_clone(&o_conv);
20556 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20557 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
20558 return (int64_t)ret_conv;
20561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20562 LDKDecodeError e_conv;
20563 e_conv.inner = (void*)(e & (~1));
20564 e_conv.is_owned = (e & 1) || (e == 0);
20565 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20566 e_conv = DecodeError_clone(&e_conv);
20567 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20568 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
20569 return (int64_t)ret_conv;
20572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20573 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
20574 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
20578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20579 if ((_res & 1) != 0) return;
20580 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20581 CHECK_ACCESS(_res_ptr);
20582 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
20584 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
20587 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
20588 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20589 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
20590 return (int64_t)ret_conv;
20592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20593 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
20594 int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
20598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20599 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
20600 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20601 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
20602 return (int64_t)ret_conv;
20605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20606 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20607 CHECK_ACCESS(o_ptr);
20608 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
20609 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
20610 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20611 *ret_copy = COption_MonitorEventZ_some(o_conv);
20612 int64_t ret_ref = (uintptr_t)ret_copy;
20616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
20617 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20618 *ret_copy = COption_MonitorEventZ_none();
20619 int64_t ret_ref = (uintptr_t)ret_copy;
20623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20624 if ((_res & 1) != 0) return;
20625 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20626 CHECK_ACCESS(_res_ptr);
20627 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
20629 COption_MonitorEventZ_free(_res_conv);
20632 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
20633 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20634 *ret_copy = COption_MonitorEventZ_clone(arg);
20635 int64_t ret_ref = (uintptr_t)ret_copy;
20638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20639 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
20640 int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
20644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20645 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
20646 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20647 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
20648 int64_t ret_ref = (uintptr_t)ret_copy;
20652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20653 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20654 CHECK_ACCESS(o_ptr);
20655 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
20656 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
20657 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20658 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
20659 return (int64_t)ret_conv;
20662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20663 LDKDecodeError e_conv;
20664 e_conv.inner = (void*)(e & (~1));
20665 e_conv.is_owned = (e & 1) || (e == 0);
20666 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20667 e_conv = DecodeError_clone(&e_conv);
20668 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20669 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
20670 return (int64_t)ret_conv;
20673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20674 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
20675 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
20679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20680 if ((_res & 1) != 0) return;
20681 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20682 CHECK_ACCESS(_res_ptr);
20683 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
20685 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
20688 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
20689 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20690 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
20691 return (int64_t)ret_conv;
20693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20694 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
20695 int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
20699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20700 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
20701 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20702 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
20703 return (int64_t)ret_conv;
20706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20707 LDKHTLCUpdate o_conv;
20708 o_conv.inner = (void*)(o & (~1));
20709 o_conv.is_owned = (o & 1) || (o == 0);
20710 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20711 o_conv = HTLCUpdate_clone(&o_conv);
20712 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20713 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
20714 return (int64_t)ret_conv;
20717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20718 LDKDecodeError e_conv;
20719 e_conv.inner = (void*)(e & (~1));
20720 e_conv.is_owned = (e & 1) || (e == 0);
20721 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20722 e_conv = DecodeError_clone(&e_conv);
20723 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20724 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
20725 return (int64_t)ret_conv;
20728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20729 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
20730 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
20734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20735 if ((_res & 1) != 0) return;
20736 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20737 CHECK_ACCESS(_res_ptr);
20738 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
20740 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
20743 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
20744 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20745 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
20746 return (int64_t)ret_conv;
20748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20749 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
20750 int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
20754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20755 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
20756 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20757 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
20758 return (int64_t)ret_conv;
20761 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
20762 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20763 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
20764 return ((int64_t)ret_conv);
20766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20767 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
20768 int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
20772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20773 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
20774 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20775 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
20776 return ((int64_t)ret_conv);
20779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20780 LDKOutPoint a_conv;
20781 a_conv.inner = (void*)(a & (~1));
20782 a_conv.is_owned = (a & 1) || (a == 0);
20783 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20784 a_conv = OutPoint_clone(&a_conv);
20786 b_ref.datalen = (*env)->GetArrayLength(env, b);
20787 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20788 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20789 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20790 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
20791 return ((int64_t)ret_conv);
20794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20795 if ((_res & 1) != 0) return;
20796 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20797 CHECK_ACCESS(_res_ptr);
20798 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
20800 C2Tuple_OutPointScriptZ_free(_res_conv);
20803 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
20804 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20805 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
20806 return ((int64_t)ret_conv);
20808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20809 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
20810 int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
20814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20815 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
20816 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20817 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
20818 return ((int64_t)ret_conv);
20821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
20823 b_ref.datalen = (*env)->GetArrayLength(env, b);
20824 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20825 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20826 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20827 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
20828 return ((int64_t)ret_conv);
20831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20832 if ((_res & 1) != 0) return;
20833 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20834 CHECK_ACCESS(_res_ptr);
20835 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
20837 C2Tuple_u32ScriptZ_free(_res_conv);
20840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20841 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
20842 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20843 if (_res_constr.datalen > 0)
20844 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20846 _res_constr.data = NULL;
20847 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20848 for (size_t v = 0; v < _res_constr.datalen; v++) {
20849 int64_t _res_conv_21 = _res_vals[v];
20850 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
20851 CHECK_ACCESS(_res_conv_21_ptr);
20852 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
20853 FREE((void*)_res_conv_21);
20854 _res_constr.data[v] = _res_conv_21_conv;
20856 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20857 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
20860 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
20861 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20862 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
20863 return ((int64_t)ret_conv);
20865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20866 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
20867 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
20871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20872 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
20873 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20874 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
20875 return ((int64_t)ret_conv);
20878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20879 LDKThirtyTwoBytes a_ref;
20880 CHECK((*env)->GetArrayLength(env, a) == 32);
20881 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20882 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
20883 b_constr.datalen = (*env)->GetArrayLength(env, b);
20884 if (b_constr.datalen > 0)
20885 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20887 b_constr.data = NULL;
20888 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20889 for (size_t v = 0; v < b_constr.datalen; v++) {
20890 int64_t b_conv_21 = b_vals[v];
20891 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
20892 CHECK_ACCESS(b_conv_21_ptr);
20893 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
20894 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
20895 b_constr.data[v] = b_conv_21_conv;
20897 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20898 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20899 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
20900 return ((int64_t)ret_conv);
20903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20904 if ((_res & 1) != 0) return;
20905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20906 CHECK_ACCESS(_res_ptr);
20907 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
20909 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
20912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20913 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
20914 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20915 if (_res_constr.datalen > 0)
20916 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
20918 _res_constr.data = NULL;
20919 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20920 for (size_t o = 0; o < _res_constr.datalen; o++) {
20921 int64_t _res_conv_40 = _res_vals[o];
20922 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
20923 CHECK_ACCESS(_res_conv_40_ptr);
20924 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
20925 FREE((void*)_res_conv_40);
20926 _res_constr.data[o] = _res_conv_40_conv;
20928 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20929 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
20932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20933 LDKCVec_EventZ _res_constr;
20934 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20935 if (_res_constr.datalen > 0)
20936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
20938 _res_constr.data = NULL;
20939 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20940 for (size_t h = 0; h < _res_constr.datalen; h++) {
20941 int64_t _res_conv_7 = _res_vals[h];
20942 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
20943 CHECK_ACCESS(_res_conv_7_ptr);
20944 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
20945 FREE((void*)_res_conv_7);
20946 _res_constr.data[h] = _res_conv_7_conv;
20948 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20949 CVec_EventZ_free(_res_constr);
20952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20953 LDKCVec_TransactionZ _res_constr;
20954 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20955 if (_res_constr.datalen > 0)
20956 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
20958 _res_constr.data = NULL;
20959 for (size_t i = 0; i < _res_constr.datalen; i++) {
20960 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20961 LDKTransaction _res_conv_8_ref;
20962 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20963 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
20964 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20965 _res_conv_8_ref.data_is_owned = true;
20966 _res_constr.data[i] = _res_conv_8_ref;
20968 CVec_TransactionZ_free(_res_constr);
20971 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
20972 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20973 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
20974 return ((int64_t)ret_conv);
20976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20977 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
20978 int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
20982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20983 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
20984 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20985 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
20986 return ((int64_t)ret_conv);
20989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
20990 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
20991 CHECK_ACCESS(b_ptr);
20992 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
20993 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
20994 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20995 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
20996 return ((int64_t)ret_conv);
20999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21000 if ((_res & 1) != 0) return;
21001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21002 CHECK_ACCESS(_res_ptr);
21003 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21005 C2Tuple_u32TxOutZ_free(_res_conv);
21008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21009 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21010 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21011 if (_res_constr.datalen > 0)
21012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21014 _res_constr.data = NULL;
21015 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21016 for (size_t u = 0; u < _res_constr.datalen; u++) {
21017 int64_t _res_conv_20 = _res_vals[u];
21018 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
21019 CHECK_ACCESS(_res_conv_20_ptr);
21020 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21021 FREE((void*)_res_conv_20);
21022 _res_constr.data[u] = _res_conv_20_conv;
21024 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21025 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21028 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21029 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21030 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21031 return ((int64_t)ret_conv);
21033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21034 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
21035 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21040 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
21041 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21042 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21043 return ((int64_t)ret_conv);
21046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21047 LDKThirtyTwoBytes a_ref;
21048 CHECK((*env)->GetArrayLength(env, a) == 32);
21049 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21050 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21051 b_constr.datalen = (*env)->GetArrayLength(env, b);
21052 if (b_constr.datalen > 0)
21053 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21055 b_constr.data = NULL;
21056 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21057 for (size_t u = 0; u < b_constr.datalen; u++) {
21058 int64_t b_conv_20 = b_vals[u];
21059 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
21060 CHECK_ACCESS(b_conv_20_ptr);
21061 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21062 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
21063 b_constr.data[u] = b_conv_20_conv;
21065 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21066 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21067 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21068 return ((int64_t)ret_conv);
21071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21072 if ((_res & 1) != 0) return;
21073 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21074 CHECK_ACCESS(_res_ptr);
21075 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21077 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21081 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21082 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21083 if (_res_constr.datalen > 0)
21084 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
21086 _res_constr.data = NULL;
21087 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21088 for (size_t n = 0; n < _res_constr.datalen; n++) {
21089 int64_t _res_conv_39 = _res_vals[n];
21090 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
21091 CHECK_ACCESS(_res_conv_39_ptr);
21092 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
21093 FREE((void*)_res_conv_39);
21094 _res_constr.data[n] = _res_conv_39_conv;
21096 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21097 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21101 LDKCVec_BalanceZ _res_constr;
21102 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21103 if (_res_constr.datalen > 0)
21104 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21106 _res_constr.data = NULL;
21107 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21108 for (size_t j = 0; j < _res_constr.datalen; j++) {
21109 int64_t _res_conv_9 = _res_vals[j];
21110 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
21111 CHECK_ACCESS(_res_conv_9_ptr);
21112 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21113 FREE((void*)_res_conv_9);
21114 _res_constr.data[j] = _res_conv_9_conv;
21116 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21117 CVec_BalanceZ_free(_res_constr);
21120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21121 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21122 CHECK_ACCESS(o_ptr);
21123 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
21124 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
21125 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21126 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
21127 return (int64_t)ret_conv;
21130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21131 LDKDecodeError e_conv;
21132 e_conv.inner = (void*)(e & (~1));
21133 e_conv.is_owned = (e & 1) || (e == 0);
21134 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21135 e_conv = DecodeError_clone(&e_conv);
21136 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21137 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
21138 return (int64_t)ret_conv;
21141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21142 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
21143 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21148 if ((_res & 1) != 0) return;
21149 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21150 CHECK_ACCESS(_res_ptr);
21151 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
21153 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
21156 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21157 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21158 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
21159 return (int64_t)ret_conv;
21161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21162 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
21163 int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21168 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
21169 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21170 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
21171 return (int64_t)ret_conv;
21174 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21175 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21176 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21177 return ((int64_t)ret_conv);
21179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21180 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
21181 int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21186 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
21187 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21188 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21189 return ((int64_t)ret_conv);
21192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21193 LDKPublicKey a_ref;
21194 CHECK((*env)->GetArrayLength(env, a) == 33);
21195 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
21196 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21197 CHECK_ACCESS(b_ptr);
21198 LDKType b_conv = *(LDKType*)(b_ptr);
21199 if (b_conv.free == LDKType_JCalls_free) {
21200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21201 LDKType_JCalls_cloned(&b_conv);
21203 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21204 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21205 return ((int64_t)ret_conv);
21208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21209 if ((_res & 1) != 0) return;
21210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21211 CHECK_ACCESS(_res_ptr);
21212 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21214 C2Tuple_PublicKeyTypeZ_free(_res_conv);
21217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21218 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21219 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21220 if (_res_constr.datalen > 0)
21221 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21223 _res_constr.data = NULL;
21224 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21225 for (size_t z = 0; z < _res_constr.datalen; z++) {
21226 int64_t _res_conv_25 = _res_vals[z];
21227 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
21228 CHECK_ACCESS(_res_conv_25_ptr);
21229 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21230 FREE((void*)_res_conv_25);
21231 _res_constr.data[z] = _res_conv_25_conv;
21233 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21234 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21238 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21239 CHECK_ACCESS(o_ptr);
21240 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21241 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21242 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21243 *ret_copy = COption_NetAddressZ_some(o_conv);
21244 int64_t ret_ref = (uintptr_t)ret_copy;
21248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
21249 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21250 *ret_copy = COption_NetAddressZ_none();
21251 int64_t ret_ref = (uintptr_t)ret_copy;
21255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21256 if ((_res & 1) != 0) return;
21257 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21258 CHECK_ACCESS(_res_ptr);
21259 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
21261 COption_NetAddressZ_free(_res_conv);
21264 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
21265 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21266 *ret_copy = COption_NetAddressZ_clone(arg);
21267 int64_t ret_ref = (uintptr_t)ret_copy;
21270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21271 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
21272 int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
21276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21277 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
21278 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21279 *ret_copy = COption_NetAddressZ_clone(orig_conv);
21280 int64_t ret_ref = (uintptr_t)ret_copy;
21284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21286 o_ref.datalen = (*env)->GetArrayLength(env, o);
21287 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21288 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21289 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21290 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
21291 return (int64_t)ret_conv;
21294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21295 LDKPeerHandleError e_conv;
21296 e_conv.inner = (void*)(e & (~1));
21297 e_conv.is_owned = (e & 1) || (e == 0);
21298 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21299 e_conv = PeerHandleError_clone(&e_conv);
21300 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21301 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
21302 return (int64_t)ret_conv;
21305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21306 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
21307 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
21311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21312 if ((_res & 1) != 0) return;
21313 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21314 CHECK_ACCESS(_res_ptr);
21315 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
21317 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
21320 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
21321 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21322 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
21323 return (int64_t)ret_conv;
21325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21326 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
21327 int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
21331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21332 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
21333 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21334 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
21335 return (int64_t)ret_conv;
21338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
21339 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21340 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
21341 return (int64_t)ret_conv;
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21345 LDKPeerHandleError e_conv;
21346 e_conv.inner = (void*)(e & (~1));
21347 e_conv.is_owned = (e & 1) || (e == 0);
21348 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21349 e_conv = PeerHandleError_clone(&e_conv);
21350 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21351 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
21352 return (int64_t)ret_conv;
21355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21356 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
21357 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
21361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21362 if ((_res & 1) != 0) return;
21363 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21364 CHECK_ACCESS(_res_ptr);
21365 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
21367 CResult_NonePeerHandleErrorZ_free(_res_conv);
21370 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
21371 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21372 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
21373 return (int64_t)ret_conv;
21375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21376 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
21377 int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
21381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21382 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
21383 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21384 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
21385 return (int64_t)ret_conv;
21388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
21389 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21390 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
21391 return (int64_t)ret_conv;
21394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21395 LDKPeerHandleError e_conv;
21396 e_conv.inner = (void*)(e & (~1));
21397 e_conv.is_owned = (e & 1) || (e == 0);
21398 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21399 e_conv = PeerHandleError_clone(&e_conv);
21400 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21401 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
21402 return (int64_t)ret_conv;
21405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21406 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
21407 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
21411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21412 if ((_res & 1) != 0) return;
21413 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21414 CHECK_ACCESS(_res_ptr);
21415 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
21417 CResult_boolPeerHandleErrorZ_free(_res_conv);
21420 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
21421 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21422 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
21423 return (int64_t)ret_conv;
21425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21426 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
21427 int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
21431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21432 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
21433 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21434 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
21435 return (int64_t)ret_conv;
21438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
21439 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21440 *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
21441 return (int64_t)ret_conv;
21444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21445 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
21446 CHECK_ACCESS(e_ptr);
21447 LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
21448 e_conv = GraphSyncError_clone((LDKGraphSyncError*)(((uintptr_t)e) & ~1));
21449 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21450 *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
21451 return (int64_t)ret_conv;
21454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21455 LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)(o & ~1);
21456 jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
21460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21461 if ((_res & 1) != 0) return;
21462 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21463 CHECK_ACCESS(_res_ptr);
21464 LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
21466 CResult_u32GraphSyncErrorZ_free(_res_conv);
21469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21470 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21471 CHECK_ACCESS(o_ptr);
21472 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21473 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21474 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21475 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
21476 return (int64_t)ret_conv;
21479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21480 LDKDecodeError e_conv;
21481 e_conv.inner = (void*)(e & (~1));
21482 e_conv.is_owned = (e & 1) || (e == 0);
21483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21484 e_conv = DecodeError_clone(&e_conv);
21485 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21486 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
21487 return (int64_t)ret_conv;
21490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21491 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
21492 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
21496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21497 if ((_res & 1) != 0) return;
21498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21499 CHECK_ACCESS(_res_ptr);
21500 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
21502 CResult_NetAddressDecodeErrorZ_free(_res_conv);
21505 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
21506 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21507 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
21508 return (int64_t)ret_conv;
21510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21511 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
21512 int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
21516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21517 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
21518 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21519 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
21520 return (int64_t)ret_conv;
21523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21524 LDKCVec_UpdateAddHTLCZ _res_constr;
21525 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21526 if (_res_constr.datalen > 0)
21527 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21529 _res_constr.data = NULL;
21530 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21531 for (size_t p = 0; p < _res_constr.datalen; p++) {
21532 int64_t _res_conv_15 = _res_vals[p];
21533 LDKUpdateAddHTLC _res_conv_15_conv;
21534 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
21535 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
21536 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21537 _res_constr.data[p] = _res_conv_15_conv;
21539 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21540 CVec_UpdateAddHTLCZ_free(_res_constr);
21543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21544 LDKCVec_UpdateFulfillHTLCZ _res_constr;
21545 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21546 if (_res_constr.datalen > 0)
21547 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21549 _res_constr.data = NULL;
21550 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21551 for (size_t t = 0; t < _res_constr.datalen; t++) {
21552 int64_t _res_conv_19 = _res_vals[t];
21553 LDKUpdateFulfillHTLC _res_conv_19_conv;
21554 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
21555 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
21556 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21557 _res_constr.data[t] = _res_conv_19_conv;
21559 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21560 CVec_UpdateFulfillHTLCZ_free(_res_constr);
21563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21564 LDKCVec_UpdateFailHTLCZ _res_constr;
21565 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21566 if (_res_constr.datalen > 0)
21567 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21569 _res_constr.data = NULL;
21570 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21571 for (size_t q = 0; q < _res_constr.datalen; q++) {
21572 int64_t _res_conv_16 = _res_vals[q];
21573 LDKUpdateFailHTLC _res_conv_16_conv;
21574 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
21575 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
21576 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21577 _res_constr.data[q] = _res_conv_16_conv;
21579 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21580 CVec_UpdateFailHTLCZ_free(_res_constr);
21583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21584 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21586 if (_res_constr.datalen > 0)
21587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21589 _res_constr.data = NULL;
21590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21591 for (size_t z = 0; z < _res_constr.datalen; z++) {
21592 int64_t _res_conv_25 = _res_vals[z];
21593 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21594 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
21595 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
21596 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21597 _res_constr.data[z] = _res_conv_25_conv;
21599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21600 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21604 LDKAcceptChannel o_conv;
21605 o_conv.inner = (void*)(o & (~1));
21606 o_conv.is_owned = (o & 1) || (o == 0);
21607 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21608 o_conv = AcceptChannel_clone(&o_conv);
21609 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21610 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21611 return (int64_t)ret_conv;
21614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21615 LDKDecodeError e_conv;
21616 e_conv.inner = (void*)(e & (~1));
21617 e_conv.is_owned = (e & 1) || (e == 0);
21618 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21619 e_conv = DecodeError_clone(&e_conv);
21620 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21621 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21622 return (int64_t)ret_conv;
21625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21626 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
21627 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21632 if ((_res & 1) != 0) return;
21633 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21634 CHECK_ACCESS(_res_ptr);
21635 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21637 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21640 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21641 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21642 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21643 return (int64_t)ret_conv;
21645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21646 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
21647 int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21652 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
21653 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21654 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21655 return (int64_t)ret_conv;
21658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21659 LDKAnnouncementSignatures o_conv;
21660 o_conv.inner = (void*)(o & (~1));
21661 o_conv.is_owned = (o & 1) || (o == 0);
21662 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21663 o_conv = AnnouncementSignatures_clone(&o_conv);
21664 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21665 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21666 return (int64_t)ret_conv;
21669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21670 LDKDecodeError e_conv;
21671 e_conv.inner = (void*)(e & (~1));
21672 e_conv.is_owned = (e & 1) || (e == 0);
21673 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21674 e_conv = DecodeError_clone(&e_conv);
21675 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21676 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21677 return (int64_t)ret_conv;
21680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21681 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
21682 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21687 if ((_res & 1) != 0) return;
21688 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21689 CHECK_ACCESS(_res_ptr);
21690 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21692 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21695 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21696 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21697 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21698 return (int64_t)ret_conv;
21700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21701 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
21702 int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21707 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
21708 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21709 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21710 return (int64_t)ret_conv;
21713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21714 LDKChannelReestablish o_conv;
21715 o_conv.inner = (void*)(o & (~1));
21716 o_conv.is_owned = (o & 1) || (o == 0);
21717 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21718 o_conv = ChannelReestablish_clone(&o_conv);
21719 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21720 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21721 return (int64_t)ret_conv;
21724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21725 LDKDecodeError e_conv;
21726 e_conv.inner = (void*)(e & (~1));
21727 e_conv.is_owned = (e & 1) || (e == 0);
21728 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21729 e_conv = DecodeError_clone(&e_conv);
21730 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21731 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21732 return (int64_t)ret_conv;
21735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21736 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
21737 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21742 if ((_res & 1) != 0) return;
21743 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21744 CHECK_ACCESS(_res_ptr);
21745 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21747 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21750 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21751 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21752 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21753 return (int64_t)ret_conv;
21755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21756 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
21757 int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21762 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
21763 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21764 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21765 return (int64_t)ret_conv;
21768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21769 LDKClosingSigned o_conv;
21770 o_conv.inner = (void*)(o & (~1));
21771 o_conv.is_owned = (o & 1) || (o == 0);
21772 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21773 o_conv = ClosingSigned_clone(&o_conv);
21774 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21775 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21776 return (int64_t)ret_conv;
21779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21780 LDKDecodeError e_conv;
21781 e_conv.inner = (void*)(e & (~1));
21782 e_conv.is_owned = (e & 1) || (e == 0);
21783 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21784 e_conv = DecodeError_clone(&e_conv);
21785 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21786 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21787 return (int64_t)ret_conv;
21790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21791 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
21792 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21797 if ((_res & 1) != 0) return;
21798 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21799 CHECK_ACCESS(_res_ptr);
21800 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21802 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21805 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21806 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21807 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21808 return (int64_t)ret_conv;
21810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21811 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
21812 int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21817 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
21818 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21819 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21820 return (int64_t)ret_conv;
21823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21824 LDKClosingSignedFeeRange o_conv;
21825 o_conv.inner = (void*)(o & (~1));
21826 o_conv.is_owned = (o & 1) || (o == 0);
21827 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21828 o_conv = ClosingSignedFeeRange_clone(&o_conv);
21829 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21830 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21831 return (int64_t)ret_conv;
21834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21835 LDKDecodeError e_conv;
21836 e_conv.inner = (void*)(e & (~1));
21837 e_conv.is_owned = (e & 1) || (e == 0);
21838 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21839 e_conv = DecodeError_clone(&e_conv);
21840 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21841 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21842 return (int64_t)ret_conv;
21845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21846 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
21847 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21852 if ((_res & 1) != 0) return;
21853 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21854 CHECK_ACCESS(_res_ptr);
21855 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21857 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21860 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21861 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21862 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21863 return (int64_t)ret_conv;
21865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21866 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
21867 int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21872 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
21873 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21874 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21875 return (int64_t)ret_conv;
21878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21879 LDKCommitmentSigned o_conv;
21880 o_conv.inner = (void*)(o & (~1));
21881 o_conv.is_owned = (o & 1) || (o == 0);
21882 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21883 o_conv = CommitmentSigned_clone(&o_conv);
21884 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21885 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21886 return (int64_t)ret_conv;
21889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21890 LDKDecodeError e_conv;
21891 e_conv.inner = (void*)(e & (~1));
21892 e_conv.is_owned = (e & 1) || (e == 0);
21893 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21894 e_conv = DecodeError_clone(&e_conv);
21895 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21896 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21897 return (int64_t)ret_conv;
21900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21901 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
21902 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21907 if ((_res & 1) != 0) return;
21908 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21909 CHECK_ACCESS(_res_ptr);
21910 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21912 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21915 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21916 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21917 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21918 return (int64_t)ret_conv;
21920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21921 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
21922 int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21927 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
21928 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21929 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21930 return (int64_t)ret_conv;
21933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21934 LDKFundingCreated o_conv;
21935 o_conv.inner = (void*)(o & (~1));
21936 o_conv.is_owned = (o & 1) || (o == 0);
21937 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21938 o_conv = FundingCreated_clone(&o_conv);
21939 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21940 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21941 return (int64_t)ret_conv;
21944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21945 LDKDecodeError e_conv;
21946 e_conv.inner = (void*)(e & (~1));
21947 e_conv.is_owned = (e & 1) || (e == 0);
21948 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21949 e_conv = DecodeError_clone(&e_conv);
21950 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21951 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21952 return (int64_t)ret_conv;
21955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21956 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
21957 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21962 if ((_res & 1) != 0) return;
21963 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21964 CHECK_ACCESS(_res_ptr);
21965 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21967 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21970 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21971 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21972 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21973 return (int64_t)ret_conv;
21975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21976 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
21977 int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21982 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
21983 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21984 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21985 return (int64_t)ret_conv;
21988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21989 LDKFundingSigned o_conv;
21990 o_conv.inner = (void*)(o & (~1));
21991 o_conv.is_owned = (o & 1) || (o == 0);
21992 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21993 o_conv = FundingSigned_clone(&o_conv);
21994 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21995 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21996 return (int64_t)ret_conv;
21999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22000 LDKDecodeError e_conv;
22001 e_conv.inner = (void*)(e & (~1));
22002 e_conv.is_owned = (e & 1) || (e == 0);
22003 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22004 e_conv = DecodeError_clone(&e_conv);
22005 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22006 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
22007 return (int64_t)ret_conv;
22010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22011 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
22012 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
22016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22017 if ((_res & 1) != 0) return;
22018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22019 CHECK_ACCESS(_res_ptr);
22020 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
22022 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
22025 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
22026 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22027 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
22028 return (int64_t)ret_conv;
22030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22031 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
22032 int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
22036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22037 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
22038 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22039 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
22040 return (int64_t)ret_conv;
22043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22044 LDKChannelReady o_conv;
22045 o_conv.inner = (void*)(o & (~1));
22046 o_conv.is_owned = (o & 1) || (o == 0);
22047 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22048 o_conv = ChannelReady_clone(&o_conv);
22049 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22050 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
22051 return (int64_t)ret_conv;
22054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22055 LDKDecodeError e_conv;
22056 e_conv.inner = (void*)(e & (~1));
22057 e_conv.is_owned = (e & 1) || (e == 0);
22058 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22059 e_conv = DecodeError_clone(&e_conv);
22060 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22061 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
22062 return (int64_t)ret_conv;
22065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22066 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
22067 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
22071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22072 if ((_res & 1) != 0) return;
22073 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22074 CHECK_ACCESS(_res_ptr);
22075 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
22077 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
22080 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
22081 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22082 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
22083 return (int64_t)ret_conv;
22085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22086 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
22087 int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
22091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22092 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
22093 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22094 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
22095 return (int64_t)ret_conv;
22098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22100 o_conv.inner = (void*)(o & (~1));
22101 o_conv.is_owned = (o & 1) || (o == 0);
22102 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22103 o_conv = Init_clone(&o_conv);
22104 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22105 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
22106 return (int64_t)ret_conv;
22109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22110 LDKDecodeError e_conv;
22111 e_conv.inner = (void*)(e & (~1));
22112 e_conv.is_owned = (e & 1) || (e == 0);
22113 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22114 e_conv = DecodeError_clone(&e_conv);
22115 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22116 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
22117 return (int64_t)ret_conv;
22120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22121 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
22122 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
22126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22127 if ((_res & 1) != 0) return;
22128 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22129 CHECK_ACCESS(_res_ptr);
22130 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
22132 CResult_InitDecodeErrorZ_free(_res_conv);
22135 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
22136 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22137 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
22138 return (int64_t)ret_conv;
22140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22141 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
22142 int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
22146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22147 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
22148 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22149 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
22150 return (int64_t)ret_conv;
22153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22154 LDKOpenChannel o_conv;
22155 o_conv.inner = (void*)(o & (~1));
22156 o_conv.is_owned = (o & 1) || (o == 0);
22157 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22158 o_conv = OpenChannel_clone(&o_conv);
22159 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22160 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
22161 return (int64_t)ret_conv;
22164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22165 LDKDecodeError e_conv;
22166 e_conv.inner = (void*)(e & (~1));
22167 e_conv.is_owned = (e & 1) || (e == 0);
22168 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22169 e_conv = DecodeError_clone(&e_conv);
22170 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22171 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
22172 return (int64_t)ret_conv;
22175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22176 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
22177 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
22181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22182 if ((_res & 1) != 0) return;
22183 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22184 CHECK_ACCESS(_res_ptr);
22185 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
22187 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
22190 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
22191 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22192 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
22193 return (int64_t)ret_conv;
22195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22196 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
22197 int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
22201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22202 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
22203 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22204 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
22205 return (int64_t)ret_conv;
22208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22209 LDKRevokeAndACK o_conv;
22210 o_conv.inner = (void*)(o & (~1));
22211 o_conv.is_owned = (o & 1) || (o == 0);
22212 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22213 o_conv = RevokeAndACK_clone(&o_conv);
22214 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22215 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
22216 return (int64_t)ret_conv;
22219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22220 LDKDecodeError e_conv;
22221 e_conv.inner = (void*)(e & (~1));
22222 e_conv.is_owned = (e & 1) || (e == 0);
22223 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22224 e_conv = DecodeError_clone(&e_conv);
22225 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22226 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
22227 return (int64_t)ret_conv;
22230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22231 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
22232 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
22236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22237 if ((_res & 1) != 0) return;
22238 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22239 CHECK_ACCESS(_res_ptr);
22240 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
22242 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
22245 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
22246 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22247 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
22248 return (int64_t)ret_conv;
22250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22251 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
22252 int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
22256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22257 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
22258 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22259 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
22260 return (int64_t)ret_conv;
22263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22264 LDKShutdown o_conv;
22265 o_conv.inner = (void*)(o & (~1));
22266 o_conv.is_owned = (o & 1) || (o == 0);
22267 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22268 o_conv = Shutdown_clone(&o_conv);
22269 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22270 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
22271 return (int64_t)ret_conv;
22274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22275 LDKDecodeError e_conv;
22276 e_conv.inner = (void*)(e & (~1));
22277 e_conv.is_owned = (e & 1) || (e == 0);
22278 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22279 e_conv = DecodeError_clone(&e_conv);
22280 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22281 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
22282 return (int64_t)ret_conv;
22285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22286 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
22287 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
22291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22292 if ((_res & 1) != 0) return;
22293 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22294 CHECK_ACCESS(_res_ptr);
22295 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
22297 CResult_ShutdownDecodeErrorZ_free(_res_conv);
22300 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
22301 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22302 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
22303 return (int64_t)ret_conv;
22305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22306 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
22307 int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
22311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22312 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
22313 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22314 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
22315 return (int64_t)ret_conv;
22318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22319 LDKUpdateFailHTLC o_conv;
22320 o_conv.inner = (void*)(o & (~1));
22321 o_conv.is_owned = (o & 1) || (o == 0);
22322 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22323 o_conv = UpdateFailHTLC_clone(&o_conv);
22324 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22325 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
22326 return (int64_t)ret_conv;
22329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22330 LDKDecodeError e_conv;
22331 e_conv.inner = (void*)(e & (~1));
22332 e_conv.is_owned = (e & 1) || (e == 0);
22333 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22334 e_conv = DecodeError_clone(&e_conv);
22335 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22336 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
22337 return (int64_t)ret_conv;
22340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22341 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
22342 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
22346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22347 if ((_res & 1) != 0) return;
22348 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22349 CHECK_ACCESS(_res_ptr);
22350 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
22352 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
22355 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
22356 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22357 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
22358 return (int64_t)ret_conv;
22360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22361 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
22362 int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
22366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22367 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
22368 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
22369 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
22370 return (int64_t)ret_conv;
22373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22374 LDKUpdateFailMalformedHTLC o_conv;
22375 o_conv.inner = (void*)(o & (~1));
22376 o_conv.is_owned = (o & 1) || (o == 0);
22377 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22378 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
22379 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22380 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
22381 return (int64_t)ret_conv;
22384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22385 LDKDecodeError e_conv;
22386 e_conv.inner = (void*)(e & (~1));
22387 e_conv.is_owned = (e & 1) || (e == 0);
22388 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22389 e_conv = DecodeError_clone(&e_conv);
22390 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22391 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
22392 return (int64_t)ret_conv;
22395 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22396 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
22397 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
22401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22402 if ((_res & 1) != 0) return;
22403 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22404 CHECK_ACCESS(_res_ptr);
22405 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
22407 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
22410 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
22411 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22412 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
22413 return (int64_t)ret_conv;
22415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22416 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
22417 int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
22421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22422 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
22423 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22424 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
22425 return (int64_t)ret_conv;
22428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22429 LDKUpdateFee o_conv;
22430 o_conv.inner = (void*)(o & (~1));
22431 o_conv.is_owned = (o & 1) || (o == 0);
22432 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22433 o_conv = UpdateFee_clone(&o_conv);
22434 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22435 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
22436 return (int64_t)ret_conv;
22439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22440 LDKDecodeError e_conv;
22441 e_conv.inner = (void*)(e & (~1));
22442 e_conv.is_owned = (e & 1) || (e == 0);
22443 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22444 e_conv = DecodeError_clone(&e_conv);
22445 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22446 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
22447 return (int64_t)ret_conv;
22450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22451 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
22452 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
22456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22457 if ((_res & 1) != 0) return;
22458 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22459 CHECK_ACCESS(_res_ptr);
22460 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
22462 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
22465 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
22466 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22467 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
22468 return (int64_t)ret_conv;
22470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22471 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
22472 int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
22476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22477 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
22478 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22479 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
22480 return (int64_t)ret_conv;
22483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22484 LDKUpdateFulfillHTLC o_conv;
22485 o_conv.inner = (void*)(o & (~1));
22486 o_conv.is_owned = (o & 1) || (o == 0);
22487 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22488 o_conv = UpdateFulfillHTLC_clone(&o_conv);
22489 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22490 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
22491 return (int64_t)ret_conv;
22494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22495 LDKDecodeError e_conv;
22496 e_conv.inner = (void*)(e & (~1));
22497 e_conv.is_owned = (e & 1) || (e == 0);
22498 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22499 e_conv = DecodeError_clone(&e_conv);
22500 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22501 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
22502 return (int64_t)ret_conv;
22505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22506 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
22507 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
22511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22512 if ((_res & 1) != 0) return;
22513 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22514 CHECK_ACCESS(_res_ptr);
22515 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
22517 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
22520 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
22521 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22522 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
22523 return (int64_t)ret_conv;
22525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22526 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
22527 int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22532 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
22533 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22534 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22535 return (int64_t)ret_conv;
22538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22539 LDKUpdateAddHTLC o_conv;
22540 o_conv.inner = (void*)(o & (~1));
22541 o_conv.is_owned = (o & 1) || (o == 0);
22542 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22543 o_conv = UpdateAddHTLC_clone(&o_conv);
22544 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22545 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22546 return (int64_t)ret_conv;
22549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22550 LDKDecodeError e_conv;
22551 e_conv.inner = (void*)(e & (~1));
22552 e_conv.is_owned = (e & 1) || (e == 0);
22553 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22554 e_conv = DecodeError_clone(&e_conv);
22555 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22556 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22557 return (int64_t)ret_conv;
22560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22561 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
22562 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22567 if ((_res & 1) != 0) return;
22568 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22569 CHECK_ACCESS(_res_ptr);
22570 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22572 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22575 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22576 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22577 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22578 return (int64_t)ret_conv;
22580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22581 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
22582 int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22587 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
22588 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22589 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22590 return (int64_t)ret_conv;
22593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22595 o_conv.inner = (void*)(o & (~1));
22596 o_conv.is_owned = (o & 1) || (o == 0);
22597 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22598 o_conv = Ping_clone(&o_conv);
22599 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22600 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22601 return (int64_t)ret_conv;
22604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22605 LDKDecodeError e_conv;
22606 e_conv.inner = (void*)(e & (~1));
22607 e_conv.is_owned = (e & 1) || (e == 0);
22608 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22609 e_conv = DecodeError_clone(&e_conv);
22610 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22611 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22612 return (int64_t)ret_conv;
22615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22616 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
22617 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22622 if ((_res & 1) != 0) return;
22623 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22624 CHECK_ACCESS(_res_ptr);
22625 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22627 CResult_PingDecodeErrorZ_free(_res_conv);
22630 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22631 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22632 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22633 return (int64_t)ret_conv;
22635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22636 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
22637 int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22642 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
22643 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22644 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22645 return (int64_t)ret_conv;
22648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22650 o_conv.inner = (void*)(o & (~1));
22651 o_conv.is_owned = (o & 1) || (o == 0);
22652 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22653 o_conv = Pong_clone(&o_conv);
22654 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22655 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22656 return (int64_t)ret_conv;
22659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22660 LDKDecodeError e_conv;
22661 e_conv.inner = (void*)(e & (~1));
22662 e_conv.is_owned = (e & 1) || (e == 0);
22663 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22664 e_conv = DecodeError_clone(&e_conv);
22665 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22666 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22667 return (int64_t)ret_conv;
22670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22671 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
22672 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22677 if ((_res & 1) != 0) return;
22678 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22679 CHECK_ACCESS(_res_ptr);
22680 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22682 CResult_PongDecodeErrorZ_free(_res_conv);
22685 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22686 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22687 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22688 return (int64_t)ret_conv;
22690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22691 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
22692 int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22697 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
22698 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22699 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22700 return (int64_t)ret_conv;
22703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22704 LDKUnsignedChannelAnnouncement o_conv;
22705 o_conv.inner = (void*)(o & (~1));
22706 o_conv.is_owned = (o & 1) || (o == 0);
22707 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22708 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22709 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22710 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22711 return (int64_t)ret_conv;
22714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22715 LDKDecodeError e_conv;
22716 e_conv.inner = (void*)(e & (~1));
22717 e_conv.is_owned = (e & 1) || (e == 0);
22718 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22719 e_conv = DecodeError_clone(&e_conv);
22720 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22721 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22722 return (int64_t)ret_conv;
22725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22726 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
22727 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22732 if ((_res & 1) != 0) return;
22733 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22734 CHECK_ACCESS(_res_ptr);
22735 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22737 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22740 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22741 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22742 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22743 return (int64_t)ret_conv;
22745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22746 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22747 int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22752 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22753 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22754 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22755 return (int64_t)ret_conv;
22758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22759 LDKChannelAnnouncement o_conv;
22760 o_conv.inner = (void*)(o & (~1));
22761 o_conv.is_owned = (o & 1) || (o == 0);
22762 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22763 o_conv = ChannelAnnouncement_clone(&o_conv);
22764 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22765 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22766 return (int64_t)ret_conv;
22769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22770 LDKDecodeError e_conv;
22771 e_conv.inner = (void*)(e & (~1));
22772 e_conv.is_owned = (e & 1) || (e == 0);
22773 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22774 e_conv = DecodeError_clone(&e_conv);
22775 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22776 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22777 return (int64_t)ret_conv;
22780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22781 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
22782 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22787 if ((_res & 1) != 0) return;
22788 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22789 CHECK_ACCESS(_res_ptr);
22790 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22792 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22795 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22796 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22797 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22798 return (int64_t)ret_conv;
22800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22801 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22802 int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22807 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22808 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22809 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22810 return (int64_t)ret_conv;
22813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22814 LDKUnsignedChannelUpdate o_conv;
22815 o_conv.inner = (void*)(o & (~1));
22816 o_conv.is_owned = (o & 1) || (o == 0);
22817 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22818 o_conv = UnsignedChannelUpdate_clone(&o_conv);
22819 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22820 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22821 return (int64_t)ret_conv;
22824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22825 LDKDecodeError e_conv;
22826 e_conv.inner = (void*)(e & (~1));
22827 e_conv.is_owned = (e & 1) || (e == 0);
22828 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22829 e_conv = DecodeError_clone(&e_conv);
22830 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22831 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22832 return (int64_t)ret_conv;
22835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22836 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
22837 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22842 if ((_res & 1) != 0) return;
22843 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22844 CHECK_ACCESS(_res_ptr);
22845 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22847 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22850 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22851 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22852 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22853 return (int64_t)ret_conv;
22855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22856 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
22857 int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22862 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
22863 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22864 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22865 return (int64_t)ret_conv;
22868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22869 LDKChannelUpdate o_conv;
22870 o_conv.inner = (void*)(o & (~1));
22871 o_conv.is_owned = (o & 1) || (o == 0);
22872 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22873 o_conv = ChannelUpdate_clone(&o_conv);
22874 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22875 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22876 return (int64_t)ret_conv;
22879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22880 LDKDecodeError e_conv;
22881 e_conv.inner = (void*)(e & (~1));
22882 e_conv.is_owned = (e & 1) || (e == 0);
22883 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22884 e_conv = DecodeError_clone(&e_conv);
22885 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22886 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22887 return (int64_t)ret_conv;
22890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22891 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
22892 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22897 if ((_res & 1) != 0) return;
22898 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22899 CHECK_ACCESS(_res_ptr);
22900 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22902 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22905 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22906 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22907 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22908 return (int64_t)ret_conv;
22910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22911 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
22912 int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22917 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
22918 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22919 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22920 return (int64_t)ret_conv;
22923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22924 LDKErrorMessage o_conv;
22925 o_conv.inner = (void*)(o & (~1));
22926 o_conv.is_owned = (o & 1) || (o == 0);
22927 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22928 o_conv = ErrorMessage_clone(&o_conv);
22929 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22930 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22931 return (int64_t)ret_conv;
22934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22935 LDKDecodeError e_conv;
22936 e_conv.inner = (void*)(e & (~1));
22937 e_conv.is_owned = (e & 1) || (e == 0);
22938 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22939 e_conv = DecodeError_clone(&e_conv);
22940 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22941 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22942 return (int64_t)ret_conv;
22945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22946 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
22947 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22952 if ((_res & 1) != 0) return;
22953 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22954 CHECK_ACCESS(_res_ptr);
22955 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22957 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22960 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22961 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22962 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22963 return (int64_t)ret_conv;
22965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22966 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
22967 int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22972 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
22973 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22974 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22975 return (int64_t)ret_conv;
22978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22979 LDKWarningMessage o_conv;
22980 o_conv.inner = (void*)(o & (~1));
22981 o_conv.is_owned = (o & 1) || (o == 0);
22982 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22983 o_conv = WarningMessage_clone(&o_conv);
22984 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22985 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22986 return (int64_t)ret_conv;
22989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22990 LDKDecodeError e_conv;
22991 e_conv.inner = (void*)(e & (~1));
22992 e_conv.is_owned = (e & 1) || (e == 0);
22993 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22994 e_conv = DecodeError_clone(&e_conv);
22995 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22996 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22997 return (int64_t)ret_conv;
23000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23001 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
23002 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
23006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23007 if ((_res & 1) != 0) return;
23008 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23009 CHECK_ACCESS(_res_ptr);
23010 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
23012 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
23015 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
23016 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23017 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
23018 return (int64_t)ret_conv;
23020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23021 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
23022 int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23027 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
23028 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23029 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
23030 return (int64_t)ret_conv;
23033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23034 LDKUnsignedNodeAnnouncement o_conv;
23035 o_conv.inner = (void*)(o & (~1));
23036 o_conv.is_owned = (o & 1) || (o == 0);
23037 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23038 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
23039 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23040 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
23041 return (int64_t)ret_conv;
23044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23045 LDKDecodeError e_conv;
23046 e_conv.inner = (void*)(e & (~1));
23047 e_conv.is_owned = (e & 1) || (e == 0);
23048 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23049 e_conv = DecodeError_clone(&e_conv);
23050 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23051 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
23052 return (int64_t)ret_conv;
23055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23056 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
23057 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23062 if ((_res & 1) != 0) return;
23063 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23064 CHECK_ACCESS(_res_ptr);
23065 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
23067 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
23070 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23071 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23072 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
23073 return (int64_t)ret_conv;
23075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23076 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
23077 int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23082 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
23083 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23084 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
23085 return (int64_t)ret_conv;
23088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23089 LDKNodeAnnouncement o_conv;
23090 o_conv.inner = (void*)(o & (~1));
23091 o_conv.is_owned = (o & 1) || (o == 0);
23092 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23093 o_conv = NodeAnnouncement_clone(&o_conv);
23094 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23095 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
23096 return (int64_t)ret_conv;
23099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23100 LDKDecodeError e_conv;
23101 e_conv.inner = (void*)(e & (~1));
23102 e_conv.is_owned = (e & 1) || (e == 0);
23103 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23104 e_conv = DecodeError_clone(&e_conv);
23105 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23106 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
23107 return (int64_t)ret_conv;
23110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23111 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
23112 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23117 if ((_res & 1) != 0) return;
23118 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23119 CHECK_ACCESS(_res_ptr);
23120 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
23122 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
23125 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23126 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23127 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
23128 return (int64_t)ret_conv;
23130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23131 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
23132 int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23137 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
23138 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23139 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
23140 return (int64_t)ret_conv;
23143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23144 LDKQueryShortChannelIds o_conv;
23145 o_conv.inner = (void*)(o & (~1));
23146 o_conv.is_owned = (o & 1) || (o == 0);
23147 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23148 o_conv = QueryShortChannelIds_clone(&o_conv);
23149 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23150 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
23151 return (int64_t)ret_conv;
23154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23155 LDKDecodeError e_conv;
23156 e_conv.inner = (void*)(e & (~1));
23157 e_conv.is_owned = (e & 1) || (e == 0);
23158 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23159 e_conv = DecodeError_clone(&e_conv);
23160 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23161 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
23162 return (int64_t)ret_conv;
23165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23166 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
23167 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
23171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23172 if ((_res & 1) != 0) return;
23173 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23174 CHECK_ACCESS(_res_ptr);
23175 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
23177 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
23180 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
23181 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23182 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
23183 return (int64_t)ret_conv;
23185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23186 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
23187 int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
23191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23192 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
23193 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23194 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
23195 return (int64_t)ret_conv;
23198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23199 LDKReplyShortChannelIdsEnd o_conv;
23200 o_conv.inner = (void*)(o & (~1));
23201 o_conv.is_owned = (o & 1) || (o == 0);
23202 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23203 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
23204 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23205 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
23206 return (int64_t)ret_conv;
23209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23210 LDKDecodeError e_conv;
23211 e_conv.inner = (void*)(e & (~1));
23212 e_conv.is_owned = (e & 1) || (e == 0);
23213 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23214 e_conv = DecodeError_clone(&e_conv);
23215 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23216 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
23217 return (int64_t)ret_conv;
23220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23221 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
23222 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
23226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23227 if ((_res & 1) != 0) return;
23228 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23229 CHECK_ACCESS(_res_ptr);
23230 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
23232 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
23235 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
23236 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23237 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
23238 return (int64_t)ret_conv;
23240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23241 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
23242 int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
23246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23247 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
23248 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23249 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
23250 return (int64_t)ret_conv;
23253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23254 LDKQueryChannelRange o_conv;
23255 o_conv.inner = (void*)(o & (~1));
23256 o_conv.is_owned = (o & 1) || (o == 0);
23257 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23258 o_conv = QueryChannelRange_clone(&o_conv);
23259 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23260 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
23261 return (int64_t)ret_conv;
23264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23265 LDKDecodeError e_conv;
23266 e_conv.inner = (void*)(e & (~1));
23267 e_conv.is_owned = (e & 1) || (e == 0);
23268 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23269 e_conv = DecodeError_clone(&e_conv);
23270 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23271 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
23272 return (int64_t)ret_conv;
23275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23276 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
23277 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
23281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23282 if ((_res & 1) != 0) return;
23283 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23284 CHECK_ACCESS(_res_ptr);
23285 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
23287 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
23290 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
23291 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23292 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
23293 return (int64_t)ret_conv;
23295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23296 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
23297 int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
23301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23302 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
23303 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23304 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
23305 return (int64_t)ret_conv;
23308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23309 LDKReplyChannelRange o_conv;
23310 o_conv.inner = (void*)(o & (~1));
23311 o_conv.is_owned = (o & 1) || (o == 0);
23312 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23313 o_conv = ReplyChannelRange_clone(&o_conv);
23314 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23315 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
23316 return (int64_t)ret_conv;
23319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23320 LDKDecodeError e_conv;
23321 e_conv.inner = (void*)(e & (~1));
23322 e_conv.is_owned = (e & 1) || (e == 0);
23323 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23324 e_conv = DecodeError_clone(&e_conv);
23325 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23326 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
23327 return (int64_t)ret_conv;
23330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23331 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
23332 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
23336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23337 if ((_res & 1) != 0) return;
23338 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23339 CHECK_ACCESS(_res_ptr);
23340 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
23342 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
23345 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
23346 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23347 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
23348 return (int64_t)ret_conv;
23350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23351 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
23352 int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
23356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23357 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
23358 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23359 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
23360 return (int64_t)ret_conv;
23363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23364 LDKGossipTimestampFilter o_conv;
23365 o_conv.inner = (void*)(o & (~1));
23366 o_conv.is_owned = (o & 1) || (o == 0);
23367 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23368 o_conv = GossipTimestampFilter_clone(&o_conv);
23369 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23370 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
23371 return (int64_t)ret_conv;
23374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23375 LDKDecodeError e_conv;
23376 e_conv.inner = (void*)(e & (~1));
23377 e_conv.is_owned = (e & 1) || (e == 0);
23378 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23379 e_conv = DecodeError_clone(&e_conv);
23380 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23381 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
23382 return (int64_t)ret_conv;
23385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23386 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
23387 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
23391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23392 if ((_res & 1) != 0) return;
23393 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23394 CHECK_ACCESS(_res_ptr);
23395 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
23397 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
23400 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
23401 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23402 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
23403 return (int64_t)ret_conv;
23405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23406 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
23407 int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
23411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23412 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
23413 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23414 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
23415 return (int64_t)ret_conv;
23418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23419 LDKCVec_PhantomRouteHintsZ _res_constr;
23420 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23421 if (_res_constr.datalen > 0)
23422 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
23424 _res_constr.data = NULL;
23425 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23426 for (size_t t = 0; t < _res_constr.datalen; t++) {
23427 int64_t _res_conv_19 = _res_vals[t];
23428 LDKPhantomRouteHints _res_conv_19_conv;
23429 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
23430 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
23431 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23432 _res_constr.data[t] = _res_conv_19_conv;
23434 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23435 CVec_PhantomRouteHintsZ_free(_res_constr);
23438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23440 o_conv.inner = (void*)(o & (~1));
23441 o_conv.is_owned = (o & 1) || (o == 0);
23442 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23443 o_conv = Invoice_clone(&o_conv);
23444 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23445 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
23446 return (int64_t)ret_conv;
23449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23450 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
23451 CHECK_ACCESS(e_ptr);
23452 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
23453 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
23454 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23455 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
23456 return (int64_t)ret_conv;
23459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23460 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
23461 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
23465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23466 if ((_res & 1) != 0) return;
23467 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23468 CHECK_ACCESS(_res_ptr);
23469 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
23471 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
23474 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
23475 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23476 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
23477 return (int64_t)ret_conv;
23479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23480 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
23481 int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
23485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23486 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
23487 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23488 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
23489 return (int64_t)ret_conv;
23492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23493 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
23494 CHECK_ACCESS(o_ptr);
23495 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
23496 if (o_conv.free == LDKFilter_JCalls_free) {
23497 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23498 LDKFilter_JCalls_cloned(&o_conv);
23500 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23501 *ret_copy = COption_FilterZ_some(o_conv);
23502 int64_t ret_ref = (uintptr_t)ret_copy;
23506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
23507 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23508 *ret_copy = COption_FilterZ_none();
23509 int64_t ret_ref = (uintptr_t)ret_copy;
23513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23514 if ((_res & 1) != 0) return;
23515 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23516 CHECK_ACCESS(_res_ptr);
23517 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
23519 COption_FilterZ_free(_res_conv);
23522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23523 LDKLockedChannelMonitor o_conv;
23524 o_conv.inner = (void*)(o & (~1));
23525 o_conv.is_owned = (o & 1) || (o == 0);
23526 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23527 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23528 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23529 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23530 return (int64_t)ret_conv;
23533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23534 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23535 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23536 return (int64_t)ret_conv;
23539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23540 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
23541 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23546 if ((_res & 1) != 0) return;
23547 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23548 CHECK_ACCESS(_res_ptr);
23549 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23551 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23555 LDKCVec_OutPointZ _res_constr;
23556 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23557 if (_res_constr.datalen > 0)
23558 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23560 _res_constr.data = NULL;
23561 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23562 for (size_t k = 0; k < _res_constr.datalen; k++) {
23563 int64_t _res_conv_10 = _res_vals[k];
23564 LDKOutPoint _res_conv_10_conv;
23565 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
23566 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
23567 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23568 _res_constr.data[k] = _res_conv_10_conv;
23570 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23571 CVec_OutPointZ_free(_res_constr);
23574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23575 if ((this_ptr & 1) != 0) return;
23576 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23577 CHECK_ACCESS(this_ptr_ptr);
23578 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23579 FREE((void*)this_ptr);
23580 PaymentPurpose_free(this_ptr_conv);
23583 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23584 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23585 *ret_copy = PaymentPurpose_clone(arg);
23586 int64_t ret_ref = (uintptr_t)ret_copy;
23589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23590 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
23591 int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23596 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
23597 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23598 *ret_copy = PaymentPurpose_clone(orig_conv);
23599 int64_t ret_ref = (uintptr_t)ret_copy;
23603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23604 LDKThirtyTwoBytes payment_preimage_ref;
23605 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23606 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23607 LDKThirtyTwoBytes payment_secret_ref;
23608 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23609 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23610 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23611 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23612 int64_t ret_ref = (uintptr_t)ret_copy;
23616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23617 LDKThirtyTwoBytes a_ref;
23618 CHECK((*env)->GetArrayLength(env, a) == 32);
23619 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23620 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23621 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23622 int64_t ret_ref = (uintptr_t)ret_copy;
23626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
23627 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
23628 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
23629 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23630 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23631 CVec_u8Z_free(ret_var);
23635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23636 LDKu8slice ser_ref;
23637 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23638 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23639 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
23640 *ret_conv = PaymentPurpose_read(ser_ref);
23641 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23642 return (int64_t)ret_conv;
23645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23646 if ((this_ptr & 1) != 0) return;
23647 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23648 CHECK_ACCESS(this_ptr_ptr);
23649 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23650 FREE((void*)this_ptr);
23651 ClosureReason_free(this_ptr_conv);
23654 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23655 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23656 *ret_copy = ClosureReason_clone(arg);
23657 int64_t ret_ref = (uintptr_t)ret_copy;
23660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23661 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
23662 int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23667 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
23668 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23669 *ret_copy = ClosureReason_clone(orig_conv);
23670 int64_t ret_ref = (uintptr_t)ret_copy;
23674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23675 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23676 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23677 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23678 int64_t ret_ref = (uintptr_t)ret_copy;
23682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23683 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23684 *ret_copy = ClosureReason_holder_force_closed();
23685 int64_t ret_ref = (uintptr_t)ret_copy;
23689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23690 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23691 *ret_copy = ClosureReason_cooperative_closure();
23692 int64_t ret_ref = (uintptr_t)ret_copy;
23696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23697 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23698 *ret_copy = ClosureReason_commitment_tx_confirmed();
23699 int64_t ret_ref = (uintptr_t)ret_copy;
23703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23704 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23705 *ret_copy = ClosureReason_funding_timed_out();
23706 int64_t ret_ref = (uintptr_t)ret_copy;
23710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23711 LDKStr err_conv = java_to_owned_str(env, err);
23712 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23713 *ret_copy = ClosureReason_processing_error(err_conv);
23714 int64_t ret_ref = (uintptr_t)ret_copy;
23718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23719 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23720 *ret_copy = ClosureReason_disconnected_peer();
23721 int64_t ret_ref = (uintptr_t)ret_copy;
23725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23726 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23727 *ret_copy = ClosureReason_outdated_channel_manager();
23728 int64_t ret_ref = (uintptr_t)ret_copy;
23732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23733 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
23734 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23735 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23736 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23737 CVec_u8Z_free(ret_var);
23741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23742 LDKu8slice ser_ref;
23743 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23744 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23745 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23746 *ret_conv = ClosureReason_read(ser_ref);
23747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23748 return (int64_t)ret_conv;
23751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23752 if ((this_ptr & 1) != 0) return;
23753 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23754 CHECK_ACCESS(this_ptr_ptr);
23755 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23756 FREE((void*)this_ptr);
23757 Event_free(this_ptr_conv);
23760 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23761 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23762 *ret_copy = Event_clone(arg);
23763 int64_t ret_ref = (uintptr_t)ret_copy;
23766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23767 LDKEvent* arg_conv = (LDKEvent*)arg;
23768 int64_t ret_conv = Event_clone_ptr(arg_conv);
23772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23773 LDKEvent* orig_conv = (LDKEvent*)orig;
23774 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23775 *ret_copy = Event_clone(orig_conv);
23776 int64_t ret_ref = (uintptr_t)ret_copy;
23780 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) {
23781 LDKThirtyTwoBytes temporary_channel_id_ref;
23782 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23783 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23784 LDKPublicKey counterparty_node_id_ref;
23785 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23786 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23787 LDKCVec_u8Z output_script_ref;
23788 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23789 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23790 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23791 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23792 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23793 int64_t ret_ref = (uintptr_t)ret_copy;
23797 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) {
23798 LDKThirtyTwoBytes payment_hash_ref;
23799 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23800 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23801 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
23802 CHECK_ACCESS(purpose_ptr);
23803 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23804 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
23805 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23806 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
23807 int64_t ret_ref = (uintptr_t)ret_copy;
23811 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) {
23812 LDKThirtyTwoBytes payment_hash_ref;
23813 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23814 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23815 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
23816 CHECK_ACCESS(purpose_ptr);
23817 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23818 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
23819 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23820 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
23821 int64_t ret_ref = (uintptr_t)ret_copy;
23825 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) {
23826 LDKThirtyTwoBytes payment_id_ref;
23827 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23828 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23829 LDKThirtyTwoBytes payment_preimage_ref;
23830 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23831 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23832 LDKThirtyTwoBytes payment_hash_ref;
23833 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23834 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23835 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
23836 CHECK_ACCESS(fee_paid_msat_ptr);
23837 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23838 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
23839 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23840 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23841 int64_t ret_ref = (uintptr_t)ret_copy;
23845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23846 LDKThirtyTwoBytes payment_id_ref;
23847 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23848 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23849 LDKThirtyTwoBytes payment_hash_ref;
23850 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23851 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23852 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23853 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23854 int64_t ret_ref = (uintptr_t)ret_copy;
23858 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) {
23859 LDKThirtyTwoBytes payment_id_ref;
23860 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23861 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23862 LDKThirtyTwoBytes payment_hash_ref;
23863 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23864 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23865 LDKCVec_RouteHopZ path_constr;
23866 path_constr.datalen = (*env)->GetArrayLength(env, path);
23867 if (path_constr.datalen > 0)
23868 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23870 path_constr.data = NULL;
23871 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23872 for (size_t k = 0; k < path_constr.datalen; k++) {
23873 int64_t path_conv_10 = path_vals[k];
23874 LDKRouteHop path_conv_10_conv;
23875 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23876 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23877 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23878 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23879 path_constr.data[k] = path_conv_10_conv;
23881 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23882 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23883 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23884 int64_t ret_ref = (uintptr_t)ret_copy;
23888 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) {
23889 LDKThirtyTwoBytes payment_id_ref;
23890 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23891 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23892 LDKThirtyTwoBytes payment_hash_ref;
23893 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23894 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23895 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
23896 CHECK_ACCESS(network_update_ptr);
23897 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23898 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
23899 LDKCVec_RouteHopZ path_constr;
23900 path_constr.datalen = (*env)->GetArrayLength(env, path);
23901 if (path_constr.datalen > 0)
23902 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23904 path_constr.data = NULL;
23905 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23906 for (size_t k = 0; k < path_constr.datalen; k++) {
23907 int64_t path_conv_10 = path_vals[k];
23908 LDKRouteHop path_conv_10_conv;
23909 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23910 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23911 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23912 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23913 path_constr.data[k] = path_conv_10_conv;
23915 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23916 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
23917 CHECK_ACCESS(short_channel_id_ptr);
23918 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23919 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
23920 LDKRouteParameters retry_conv;
23921 retry_conv.inner = (void*)(retry & (~1));
23922 retry_conv.is_owned = (retry & 1) || (retry == 0);
23923 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23924 retry_conv = RouteParameters_clone(&retry_conv);
23925 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23926 *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);
23927 int64_t ret_ref = (uintptr_t)ret_copy;
23931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23932 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23933 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23934 int64_t ret_ref = (uintptr_t)ret_copy;
23938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23939 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23940 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23941 if (outputs_constr.datalen > 0)
23942 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23944 outputs_constr.data = NULL;
23945 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23946 for (size_t b = 0; b < outputs_constr.datalen; b++) {
23947 int64_t outputs_conv_27 = outputs_vals[b];
23948 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
23949 CHECK_ACCESS(outputs_conv_27_ptr);
23950 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23951 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
23952 outputs_constr.data[b] = outputs_conv_27_conv;
23954 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23955 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23956 *ret_copy = Event_spendable_outputs(outputs_constr);
23957 int64_t ret_ref = (uintptr_t)ret_copy;
23961 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) {
23962 LDKThirtyTwoBytes prev_channel_id_ref;
23963 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23964 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23965 LDKThirtyTwoBytes next_channel_id_ref;
23966 CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
23967 (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
23968 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
23969 CHECK_ACCESS(fee_earned_msat_ptr);
23970 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23971 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
23972 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23973 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
23974 int64_t ret_ref = (uintptr_t)ret_copy;
23978 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) {
23979 LDKThirtyTwoBytes channel_id_ref;
23980 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23981 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23982 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
23983 CHECK_ACCESS(reason_ptr);
23984 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23985 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
23986 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23987 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23988 int64_t ret_ref = (uintptr_t)ret_copy;
23992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23993 LDKThirtyTwoBytes channel_id_ref;
23994 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23995 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23996 LDKTransaction transaction_ref;
23997 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23998 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23999 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
24000 transaction_ref.data_is_owned = true;
24001 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24002 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
24003 int64_t ret_ref = (uintptr_t)ret_copy;
24007 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) {
24008 LDKThirtyTwoBytes temporary_channel_id_ref;
24009 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24010 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24011 LDKPublicKey counterparty_node_id_ref;
24012 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24013 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24014 LDKChannelTypeFeatures channel_type_conv;
24015 channel_type_conv.inner = (void*)(channel_type & (~1));
24016 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
24017 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
24018 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
24019 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24020 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
24021 int64_t ret_ref = (uintptr_t)ret_copy;
24025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
24026 LDKEvent* obj_conv = (LDKEvent*)obj;
24027 LDKCVec_u8Z ret_var = Event_write(obj_conv);
24028 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24029 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24030 CVec_u8Z_free(ret_var);
24034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24035 LDKu8slice ser_ref;
24036 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24037 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24038 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
24039 *ret_conv = Event_read(ser_ref);
24040 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24041 return (int64_t)ret_conv;
24044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24045 if ((this_ptr & 1) != 0) return;
24046 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24047 CHECK_ACCESS(this_ptr_ptr);
24048 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
24049 FREE((void*)this_ptr);
24050 MessageSendEvent_free(this_ptr_conv);
24053 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
24054 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24055 *ret_copy = MessageSendEvent_clone(arg);
24056 int64_t ret_ref = (uintptr_t)ret_copy;
24059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24060 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
24061 int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
24065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24066 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
24067 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24068 *ret_copy = MessageSendEvent_clone(orig_conv);
24069 int64_t ret_ref = (uintptr_t)ret_copy;
24073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24074 LDKPublicKey node_id_ref;
24075 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24076 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24077 LDKAcceptChannel msg_conv;
24078 msg_conv.inner = (void*)(msg & (~1));
24079 msg_conv.is_owned = (msg & 1) || (msg == 0);
24080 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24081 msg_conv = AcceptChannel_clone(&msg_conv);
24082 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24083 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
24084 int64_t ret_ref = (uintptr_t)ret_copy;
24088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24089 LDKPublicKey node_id_ref;
24090 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24091 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24092 LDKOpenChannel msg_conv;
24093 msg_conv.inner = (void*)(msg & (~1));
24094 msg_conv.is_owned = (msg & 1) || (msg == 0);
24095 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24096 msg_conv = OpenChannel_clone(&msg_conv);
24097 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24098 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
24099 int64_t ret_ref = (uintptr_t)ret_copy;
24103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24104 LDKPublicKey node_id_ref;
24105 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24106 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24107 LDKFundingCreated msg_conv;
24108 msg_conv.inner = (void*)(msg & (~1));
24109 msg_conv.is_owned = (msg & 1) || (msg == 0);
24110 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24111 msg_conv = FundingCreated_clone(&msg_conv);
24112 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24113 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
24114 int64_t ret_ref = (uintptr_t)ret_copy;
24118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24119 LDKPublicKey node_id_ref;
24120 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24121 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24122 LDKFundingSigned msg_conv;
24123 msg_conv.inner = (void*)(msg & (~1));
24124 msg_conv.is_owned = (msg & 1) || (msg == 0);
24125 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24126 msg_conv = FundingSigned_clone(&msg_conv);
24127 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24128 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
24129 int64_t ret_ref = (uintptr_t)ret_copy;
24133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24134 LDKPublicKey node_id_ref;
24135 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24136 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24137 LDKChannelReady msg_conv;
24138 msg_conv.inner = (void*)(msg & (~1));
24139 msg_conv.is_owned = (msg & 1) || (msg == 0);
24140 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24141 msg_conv = ChannelReady_clone(&msg_conv);
24142 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24143 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
24144 int64_t ret_ref = (uintptr_t)ret_copy;
24148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24149 LDKPublicKey node_id_ref;
24150 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24151 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24152 LDKAnnouncementSignatures msg_conv;
24153 msg_conv.inner = (void*)(msg & (~1));
24154 msg_conv.is_owned = (msg & 1) || (msg == 0);
24155 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24156 msg_conv = AnnouncementSignatures_clone(&msg_conv);
24157 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24158 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
24159 int64_t ret_ref = (uintptr_t)ret_copy;
24163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
24164 LDKPublicKey node_id_ref;
24165 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24166 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24167 LDKCommitmentUpdate updates_conv;
24168 updates_conv.inner = (void*)(updates & (~1));
24169 updates_conv.is_owned = (updates & 1) || (updates == 0);
24170 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24171 updates_conv = CommitmentUpdate_clone(&updates_conv);
24172 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24173 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
24174 int64_t ret_ref = (uintptr_t)ret_copy;
24178 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) {
24179 LDKPublicKey node_id_ref;
24180 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24181 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24182 LDKRevokeAndACK msg_conv;
24183 msg_conv.inner = (void*)(msg & (~1));
24184 msg_conv.is_owned = (msg & 1) || (msg == 0);
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24186 msg_conv = RevokeAndACK_clone(&msg_conv);
24187 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24188 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
24189 int64_t ret_ref = (uintptr_t)ret_copy;
24193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24194 LDKPublicKey node_id_ref;
24195 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24196 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24197 LDKClosingSigned msg_conv;
24198 msg_conv.inner = (void*)(msg & (~1));
24199 msg_conv.is_owned = (msg & 1) || (msg == 0);
24200 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24201 msg_conv = ClosingSigned_clone(&msg_conv);
24202 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24203 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
24204 int64_t ret_ref = (uintptr_t)ret_copy;
24208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24209 LDKPublicKey node_id_ref;
24210 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24211 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24212 LDKShutdown msg_conv;
24213 msg_conv.inner = (void*)(msg & (~1));
24214 msg_conv.is_owned = (msg & 1) || (msg == 0);
24215 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24216 msg_conv = Shutdown_clone(&msg_conv);
24217 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24218 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
24219 int64_t ret_ref = (uintptr_t)ret_copy;
24223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24224 LDKPublicKey node_id_ref;
24225 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24226 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24227 LDKChannelReestablish msg_conv;
24228 msg_conv.inner = (void*)(msg & (~1));
24229 msg_conv.is_owned = (msg & 1) || (msg == 0);
24230 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24231 msg_conv = ChannelReestablish_clone(&msg_conv);
24232 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24233 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
24234 int64_t ret_ref = (uintptr_t)ret_copy;
24238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
24239 LDKChannelAnnouncement msg_conv;
24240 msg_conv.inner = (void*)(msg & (~1));
24241 msg_conv.is_owned = (msg & 1) || (msg == 0);
24242 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24243 msg_conv = ChannelAnnouncement_clone(&msg_conv);
24244 LDKChannelUpdate update_msg_conv;
24245 update_msg_conv.inner = (void*)(update_msg & (~1));
24246 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
24247 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
24248 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
24249 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24250 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
24251 int64_t ret_ref = (uintptr_t)ret_copy;
24255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
24256 LDKNodeAnnouncement msg_conv;
24257 msg_conv.inner = (void*)(msg & (~1));
24258 msg_conv.is_owned = (msg & 1) || (msg == 0);
24259 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24260 msg_conv = NodeAnnouncement_clone(&msg_conv);
24261 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24262 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
24263 int64_t ret_ref = (uintptr_t)ret_copy;
24267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
24268 LDKChannelUpdate msg_conv;
24269 msg_conv.inner = (void*)(msg & (~1));
24270 msg_conv.is_owned = (msg & 1) || (msg == 0);
24271 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24272 msg_conv = ChannelUpdate_clone(&msg_conv);
24273 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24274 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
24275 int64_t ret_ref = (uintptr_t)ret_copy;
24279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24280 LDKPublicKey node_id_ref;
24281 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24282 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24283 LDKChannelUpdate msg_conv;
24284 msg_conv.inner = (void*)(msg & (~1));
24285 msg_conv.is_owned = (msg & 1) || (msg == 0);
24286 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24287 msg_conv = ChannelUpdate_clone(&msg_conv);
24288 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24289 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
24290 int64_t ret_ref = (uintptr_t)ret_copy;
24294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
24295 LDKPublicKey node_id_ref;
24296 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24297 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24298 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
24299 CHECK_ACCESS(action_ptr);
24300 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
24301 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
24302 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24303 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
24304 int64_t ret_ref = (uintptr_t)ret_copy;
24308 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) {
24309 LDKPublicKey node_id_ref;
24310 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24311 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24312 LDKQueryChannelRange msg_conv;
24313 msg_conv.inner = (void*)(msg & (~1));
24314 msg_conv.is_owned = (msg & 1) || (msg == 0);
24315 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24316 msg_conv = QueryChannelRange_clone(&msg_conv);
24317 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24318 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
24319 int64_t ret_ref = (uintptr_t)ret_copy;
24323 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) {
24324 LDKPublicKey node_id_ref;
24325 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24326 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24327 LDKQueryShortChannelIds msg_conv;
24328 msg_conv.inner = (void*)(msg & (~1));
24329 msg_conv.is_owned = (msg & 1) || (msg == 0);
24330 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24331 msg_conv = QueryShortChannelIds_clone(&msg_conv);
24332 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24333 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
24334 int64_t ret_ref = (uintptr_t)ret_copy;
24338 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) {
24339 LDKPublicKey node_id_ref;
24340 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24341 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24342 LDKReplyChannelRange msg_conv;
24343 msg_conv.inner = (void*)(msg & (~1));
24344 msg_conv.is_owned = (msg & 1) || (msg == 0);
24345 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24346 msg_conv = ReplyChannelRange_clone(&msg_conv);
24347 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24348 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
24349 int64_t ret_ref = (uintptr_t)ret_copy;
24353 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) {
24354 LDKPublicKey node_id_ref;
24355 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24356 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24357 LDKGossipTimestampFilter msg_conv;
24358 msg_conv.inner = (void*)(msg & (~1));
24359 msg_conv.is_owned = (msg & 1) || (msg == 0);
24360 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24361 msg_conv = GossipTimestampFilter_clone(&msg_conv);
24362 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24363 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
24364 int64_t ret_ref = (uintptr_t)ret_copy;
24368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24369 if ((this_ptr & 1) != 0) return;
24370 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24371 CHECK_ACCESS(this_ptr_ptr);
24372 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
24373 FREE((void*)this_ptr);
24374 MessageSendEventsProvider_free(this_ptr_conv);
24377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24378 if ((this_ptr & 1) != 0) return;
24379 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24380 CHECK_ACCESS(this_ptr_ptr);
24381 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
24382 FREE((void*)this_ptr);
24383 EventsProvider_free(this_ptr_conv);
24386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24387 if ((this_ptr & 1) != 0) return;
24388 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24389 CHECK_ACCESS(this_ptr_ptr);
24390 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
24391 FREE((void*)this_ptr);
24392 EventHandler_free(this_ptr_conv);
24395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24396 if ((this_ptr & 1) != 0) return;
24397 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24398 CHECK_ACCESS(this_ptr_ptr);
24399 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
24400 FREE((void*)this_ptr);
24401 APIError_free(this_ptr_conv);
24404 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
24405 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24406 *ret_copy = APIError_clone(arg);
24407 int64_t ret_ref = (uintptr_t)ret_copy;
24410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24411 LDKAPIError* arg_conv = (LDKAPIError*)arg;
24412 int64_t ret_conv = APIError_clone_ptr(arg_conv);
24416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24417 LDKAPIError* orig_conv = (LDKAPIError*)orig;
24418 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24419 *ret_copy = APIError_clone(orig_conv);
24420 int64_t ret_ref = (uintptr_t)ret_copy;
24424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
24425 LDKStr err_conv = java_to_owned_str(env, err);
24426 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24427 *ret_copy = APIError_apimisuse_error(err_conv);
24428 int64_t ret_ref = (uintptr_t)ret_copy;
24432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
24433 LDKStr err_conv = java_to_owned_str(env, err);
24434 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24435 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
24436 int64_t ret_ref = (uintptr_t)ret_copy;
24440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
24441 LDKStr err_conv = java_to_owned_str(env, err);
24442 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24443 *ret_copy = APIError_route_error(err_conv);
24444 int64_t ret_ref = (uintptr_t)ret_copy;
24448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
24449 LDKStr err_conv = java_to_owned_str(env, err);
24450 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24451 *ret_copy = APIError_channel_unavailable(err_conv);
24452 int64_t ret_ref = (uintptr_t)ret_copy;
24456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
24457 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24458 *ret_copy = APIError_monitor_update_failed();
24459 int64_t ret_ref = (uintptr_t)ret_copy;
24463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
24464 LDKShutdownScript script_conv;
24465 script_conv.inner = (void*)(script & (~1));
24466 script_conv.is_owned = (script & 1) || (script == 0);
24467 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
24468 script_conv = ShutdownScript_clone(&script_conv);
24469 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24470 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
24471 int64_t ret_ref = (uintptr_t)ret_copy;
24475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24476 LDKBigSize this_obj_conv;
24477 this_obj_conv.inner = (void*)(this_obj & (~1));
24478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24480 BigSize_free(this_obj_conv);
24483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
24484 LDKBigSize this_ptr_conv;
24485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24486 this_ptr_conv.is_owned = false;
24487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24488 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
24492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24493 LDKBigSize this_ptr_conv;
24494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24495 this_ptr_conv.is_owned = false;
24496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24497 BigSize_set_a(&this_ptr_conv, val);
24500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
24501 LDKBigSize ret_var = BigSize_new(a_arg);
24502 int64_t ret_ref = 0;
24503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24506 ret_ref = (uintptr_t)ret_var.inner;
24507 if (ret_var.is_owned) {
24513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
24514 LDKu8slice msg_ref;
24515 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24516 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24517 unsigned char sk_arr[32];
24518 CHECK((*env)->GetArrayLength(env, sk) == 32);
24519 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
24520 unsigned char (*sk_ref)[32] = &sk_arr;
24521 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
24522 *ret_conv = sign(msg_ref, sk_ref);
24523 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24524 return (int64_t)ret_conv;
24527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
24528 LDKu8slice msg_ref;
24529 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24530 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24531 LDKStr sig_conv = java_to_owned_str(env, sig);
24532 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24533 *ret_conv = recover_pk(msg_ref, sig_conv);
24534 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24535 return (int64_t)ret_conv;
24538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
24539 LDKu8slice msg_ref;
24540 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24541 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24542 LDKStr sig_conv = java_to_owned_str(env, sig);
24543 LDKPublicKey pk_ref;
24544 CHECK((*env)->GetArrayLength(env, pk) == 33);
24545 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24546 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24547 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24552 LDKu8slice hrp_bytes_ref;
24553 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24554 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24555 LDKCVec_u5Z data_without_signature_constr;
24556 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24557 if (data_without_signature_constr.datalen > 0)
24558 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24560 data_without_signature_constr.data = NULL;
24561 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24562 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24563 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24565 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24567 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24568 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24569 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24570 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24571 CVec_u8Z_free(ret_var);
24572 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24577 if ((this_ptr & 1) != 0) return;
24578 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24579 CHECK_ACCESS(this_ptr_ptr);
24580 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
24581 FREE((void*)this_ptr);
24582 Persister_free(this_ptr_conv);
24585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24586 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
24587 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24591 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24592 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24596 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24597 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24601 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24602 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24607 jclass ret_conv = LDKLevel_to_java(env, Level_info());
24611 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24612 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24616 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24617 jclass ret_conv = LDKLevel_to_java(env, Level_error());
24621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24622 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
24623 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
24624 jboolean ret_conv = Level_eq(a_conv, b_conv);
24628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24629 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
24630 int64_t ret_conv = Level_hash(o_conv);
24634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24635 jclass ret_conv = LDKLevel_to_java(env, Level_max());
24639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24640 LDKRecord this_obj_conv;
24641 this_obj_conv.inner = (void*)(this_obj & (~1));
24642 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24644 Record_free(this_obj_conv);
24647 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24648 LDKRecord this_ptr_conv;
24649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24650 this_ptr_conv.is_owned = false;
24651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24652 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24657 LDKRecord this_ptr_conv;
24658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24659 this_ptr_conv.is_owned = false;
24660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24661 LDKLevel val_conv = LDKLevel_from_java(env, val);
24662 Record_set_level(&this_ptr_conv, val_conv);
24665 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24666 LDKRecord this_ptr_conv;
24667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24668 this_ptr_conv.is_owned = false;
24669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24670 LDKStr ret_str = Record_get_args(&this_ptr_conv);
24671 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24677 LDKRecord this_ptr_conv;
24678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24679 this_ptr_conv.is_owned = false;
24680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24681 LDKStr val_conv = java_to_owned_str(env, val);
24682 Record_set_args(&this_ptr_conv, val_conv);
24685 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24686 LDKRecord this_ptr_conv;
24687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24688 this_ptr_conv.is_owned = false;
24689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24690 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24691 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24697 LDKRecord this_ptr_conv;
24698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24699 this_ptr_conv.is_owned = false;
24700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24701 LDKStr val_conv = java_to_owned_str(env, val);
24702 Record_set_module_path(&this_ptr_conv, val_conv);
24705 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24706 LDKRecord this_ptr_conv;
24707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24708 this_ptr_conv.is_owned = false;
24709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24710 LDKStr ret_str = Record_get_file(&this_ptr_conv);
24711 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24717 LDKRecord this_ptr_conv;
24718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24719 this_ptr_conv.is_owned = false;
24720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24721 LDKStr val_conv = java_to_owned_str(env, val);
24722 Record_set_file(&this_ptr_conv, val_conv);
24725 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24726 LDKRecord this_ptr_conv;
24727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24728 this_ptr_conv.is_owned = false;
24729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24730 int32_t ret_conv = Record_get_line(&this_ptr_conv);
24734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24735 LDKRecord this_ptr_conv;
24736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24737 this_ptr_conv.is_owned = false;
24738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24739 Record_set_line(&this_ptr_conv, val);
24742 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24743 LDKRecord ret_var = Record_clone(arg);
24744 int64_t ret_ref = 0;
24745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24748 ret_ref = (uintptr_t)ret_var.inner;
24749 if (ret_var.is_owned) {
24754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24755 LDKRecord arg_conv;
24756 arg_conv.inner = (void*)(arg & (~1));
24757 arg_conv.is_owned = false;
24758 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24759 int64_t ret_conv = Record_clone_ptr(&arg_conv);
24763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24764 LDKRecord orig_conv;
24765 orig_conv.inner = (void*)(orig & (~1));
24766 orig_conv.is_owned = false;
24767 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24768 LDKRecord ret_var = Record_clone(&orig_conv);
24769 int64_t ret_ref = 0;
24770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24773 ret_ref = (uintptr_t)ret_var.inner;
24774 if (ret_var.is_owned) {
24780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24781 if ((this_ptr & 1) != 0) return;
24782 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24783 CHECK_ACCESS(this_ptr_ptr);
24784 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24785 FREE((void*)this_ptr);
24786 Logger_free(this_ptr_conv);
24789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24790 LDKChannelHandshakeConfig this_obj_conv;
24791 this_obj_conv.inner = (void*)(this_obj & (~1));
24792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24794 ChannelHandshakeConfig_free(this_obj_conv);
24797 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24798 LDKChannelHandshakeConfig this_ptr_conv;
24799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24800 this_ptr_conv.is_owned = false;
24801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24802 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24807 LDKChannelHandshakeConfig this_ptr_conv;
24808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24809 this_ptr_conv.is_owned = false;
24810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24811 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24814 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24815 LDKChannelHandshakeConfig this_ptr_conv;
24816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24817 this_ptr_conv.is_owned = false;
24818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24819 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24823 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) {
24824 LDKChannelHandshakeConfig this_ptr_conv;
24825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24826 this_ptr_conv.is_owned = false;
24827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24828 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24832 LDKChannelHandshakeConfig this_ptr_conv;
24833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24834 this_ptr_conv.is_owned = false;
24835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24836 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24840 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) {
24841 LDKChannelHandshakeConfig this_ptr_conv;
24842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24843 this_ptr_conv.is_owned = false;
24844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24845 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24848 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) {
24849 LDKChannelHandshakeConfig this_ptr_conv;
24850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24851 this_ptr_conv.is_owned = false;
24852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24853 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
24857 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) {
24858 LDKChannelHandshakeConfig this_ptr_conv;
24859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24860 this_ptr_conv.is_owned = false;
24861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24862 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
24865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24866 LDKChannelHandshakeConfig this_ptr_conv;
24867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24868 this_ptr_conv.is_owned = false;
24869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24870 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24875 LDKChannelHandshakeConfig this_ptr_conv;
24876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24877 this_ptr_conv.is_owned = false;
24878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24879 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24882 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) {
24883 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);
24884 int64_t ret_ref = 0;
24885 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24886 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24888 ret_ref = (uintptr_t)ret_var.inner;
24889 if (ret_var.is_owned) {
24895 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24896 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24897 int64_t ret_ref = 0;
24898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24901 ret_ref = (uintptr_t)ret_var.inner;
24902 if (ret_var.is_owned) {
24907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24908 LDKChannelHandshakeConfig arg_conv;
24909 arg_conv.inner = (void*)(arg & (~1));
24910 arg_conv.is_owned = false;
24911 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24912 int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24917 LDKChannelHandshakeConfig orig_conv;
24918 orig_conv.inner = (void*)(orig & (~1));
24919 orig_conv.is_owned = false;
24920 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24921 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
24922 int64_t ret_ref = 0;
24923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24926 ret_ref = (uintptr_t)ret_var.inner;
24927 if (ret_var.is_owned) {
24933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24934 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24935 int64_t ret_ref = 0;
24936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24939 ret_ref = (uintptr_t)ret_var.inner;
24940 if (ret_var.is_owned) {
24946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24947 LDKChannelHandshakeLimits this_obj_conv;
24948 this_obj_conv.inner = (void*)(this_obj & (~1));
24949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24951 ChannelHandshakeLimits_free(this_obj_conv);
24954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24955 LDKChannelHandshakeLimits this_ptr_conv;
24956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24957 this_ptr_conv.is_owned = false;
24958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24959 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24964 LDKChannelHandshakeLimits this_ptr_conv;
24965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24966 this_ptr_conv.is_owned = false;
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24968 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24972 LDKChannelHandshakeLimits this_ptr_conv;
24973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24974 this_ptr_conv.is_owned = false;
24975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24976 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
24980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24981 LDKChannelHandshakeLimits this_ptr_conv;
24982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24983 this_ptr_conv.is_owned = false;
24984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24985 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
24988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24989 LDKChannelHandshakeLimits 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 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24997 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) {
24998 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
25005 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) {
25006 LDKChannelHandshakeLimits this_ptr_conv;
25007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25008 this_ptr_conv.is_owned = false;
25009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25010 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
25014 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) {
25015 LDKChannelHandshakeLimits this_ptr_conv;
25016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25017 this_ptr_conv.is_owned = false;
25018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25019 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25023 LDKChannelHandshakeLimits this_ptr_conv;
25024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25025 this_ptr_conv.is_owned = false;
25026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25027 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
25031 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) {
25032 LDKChannelHandshakeLimits this_ptr_conv;
25033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25034 this_ptr_conv.is_owned = false;
25035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25036 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
25039 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25040 LDKChannelHandshakeLimits this_ptr_conv;
25041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25042 this_ptr_conv.is_owned = false;
25043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25044 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
25048 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) {
25049 LDKChannelHandshakeLimits this_ptr_conv;
25050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25051 this_ptr_conv.is_owned = false;
25052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25053 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
25056 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
25057 LDKChannelHandshakeLimits this_ptr_conv;
25058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25059 this_ptr_conv.is_owned = false;
25060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25061 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
25065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25066 LDKChannelHandshakeLimits this_ptr_conv;
25067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25068 this_ptr_conv.is_owned = false;
25069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25070 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
25073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
25074 LDKChannelHandshakeLimits this_ptr_conv;
25075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25076 this_ptr_conv.is_owned = false;
25077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25078 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
25082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25083 LDKChannelHandshakeLimits this_ptr_conv;
25084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25085 this_ptr_conv.is_owned = false;
25086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25087 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
25090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
25091 LDKChannelHandshakeLimits this_ptr_conv;
25092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25093 this_ptr_conv.is_owned = false;
25094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25095 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
25099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25100 LDKChannelHandshakeLimits this_ptr_conv;
25101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25102 this_ptr_conv.is_owned = false;
25103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25104 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
25107 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25108 LDKChannelHandshakeLimits this_ptr_conv;
25109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25110 this_ptr_conv.is_owned = false;
25111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25112 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
25116 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) {
25117 LDKChannelHandshakeLimits this_ptr_conv;
25118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25119 this_ptr_conv.is_owned = false;
25120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25121 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
25124 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) {
25125 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);
25126 int64_t ret_ref = 0;
25127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25130 ret_ref = (uintptr_t)ret_var.inner;
25131 if (ret_var.is_owned) {
25137 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
25138 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
25139 int64_t ret_ref = 0;
25140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25143 ret_ref = (uintptr_t)ret_var.inner;
25144 if (ret_var.is_owned) {
25149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25150 LDKChannelHandshakeLimits arg_conv;
25151 arg_conv.inner = (void*)(arg & (~1));
25152 arg_conv.is_owned = false;
25153 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25154 int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
25158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25159 LDKChannelHandshakeLimits orig_conv;
25160 orig_conv.inner = (void*)(orig & (~1));
25161 orig_conv.is_owned = false;
25162 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25163 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
25164 int64_t ret_ref = 0;
25165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25168 ret_ref = (uintptr_t)ret_var.inner;
25169 if (ret_var.is_owned) {
25175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
25176 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
25177 int64_t ret_ref = 0;
25178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25181 ret_ref = (uintptr_t)ret_var.inner;
25182 if (ret_var.is_owned) {
25188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25189 LDKChannelConfig this_obj_conv;
25190 this_obj_conv.inner = (void*)(this_obj & (~1));
25191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25193 ChannelConfig_free(this_obj_conv);
25196 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25197 LDKChannelConfig this_ptr_conv;
25198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25199 this_ptr_conv.is_owned = false;
25200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25201 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
25205 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) {
25206 LDKChannelConfig this_ptr_conv;
25207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25208 this_ptr_conv.is_owned = false;
25209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25210 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
25213 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25214 LDKChannelConfig this_ptr_conv;
25215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25216 this_ptr_conv.is_owned = false;
25217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25218 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
25222 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) {
25223 LDKChannelConfig this_ptr_conv;
25224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25225 this_ptr_conv.is_owned = false;
25226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25227 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
25230 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25231 LDKChannelConfig this_ptr_conv;
25232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25233 this_ptr_conv.is_owned = false;
25234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25235 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
25239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25240 LDKChannelConfig this_ptr_conv;
25241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25242 this_ptr_conv.is_owned = false;
25243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25244 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
25247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
25248 LDKChannelConfig this_ptr_conv;
25249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25250 this_ptr_conv.is_owned = false;
25251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25252 jboolean ret_conv = ChannelConfig_get_announced_channel(&this_ptr_conv);
25256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25257 LDKChannelConfig this_ptr_conv;
25258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25259 this_ptr_conv.is_owned = false;
25260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25261 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
25264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25265 LDKChannelConfig this_ptr_conv;
25266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25267 this_ptr_conv.is_owned = false;
25268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25269 jboolean ret_conv = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
25273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25274 LDKChannelConfig this_ptr_conv;
25275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25276 this_ptr_conv.is_owned = false;
25277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25278 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
25281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25282 LDKChannelConfig this_ptr_conv;
25283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25284 this_ptr_conv.is_owned = false;
25285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25286 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
25290 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) {
25291 LDKChannelConfig this_ptr_conv;
25292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25293 this_ptr_conv.is_owned = false;
25294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25295 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
25298 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) {
25299 LDKChannelConfig this_ptr_conv;
25300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25301 this_ptr_conv.is_owned = false;
25302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25303 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
25307 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) {
25308 LDKChannelConfig this_ptr_conv;
25309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25310 this_ptr_conv.is_owned = false;
25311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25312 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
25315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
25316 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
25317 int64_t ret_ref = 0;
25318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25321 ret_ref = (uintptr_t)ret_var.inner;
25322 if (ret_var.is_owned) {
25328 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
25329 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
25330 int64_t ret_ref = 0;
25331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25334 ret_ref = (uintptr_t)ret_var.inner;
25335 if (ret_var.is_owned) {
25340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25341 LDKChannelConfig arg_conv;
25342 arg_conv.inner = (void*)(arg & (~1));
25343 arg_conv.is_owned = false;
25344 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25345 int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
25349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25350 LDKChannelConfig orig_conv;
25351 orig_conv.inner = (void*)(orig & (~1));
25352 orig_conv.is_owned = false;
25353 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25354 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
25355 int64_t ret_ref = 0;
25356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25359 ret_ref = (uintptr_t)ret_var.inner;
25360 if (ret_var.is_owned) {
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
25367 LDKChannelConfig ret_var = ChannelConfig_default();
25368 int64_t ret_ref = 0;
25369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25372 ret_ref = (uintptr_t)ret_var.inner;
25373 if (ret_var.is_owned) {
25379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
25380 LDKChannelConfig obj_conv;
25381 obj_conv.inner = (void*)(obj & (~1));
25382 obj_conv.is_owned = false;
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25384 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
25385 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25386 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25387 CVec_u8Z_free(ret_var);
25391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25392 LDKu8slice ser_ref;
25393 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25394 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25395 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25396 *ret_conv = ChannelConfig_read(ser_ref);
25397 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25398 return (int64_t)ret_conv;
25401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25402 LDKUserConfig this_obj_conv;
25403 this_obj_conv.inner = (void*)(this_obj & (~1));
25404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25406 UserConfig_free(this_obj_conv);
25409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25410 LDKUserConfig this_ptr_conv;
25411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25412 this_ptr_conv.is_owned = false;
25413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25414 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
25415 int64_t ret_ref = 0;
25416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25419 ret_ref = (uintptr_t)ret_var.inner;
25420 if (ret_var.is_owned) {
25426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25427 LDKUserConfig this_ptr_conv;
25428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25429 this_ptr_conv.is_owned = false;
25430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25431 LDKChannelHandshakeConfig val_conv;
25432 val_conv.inner = (void*)(val & (~1));
25433 val_conv.is_owned = (val & 1) || (val == 0);
25434 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25435 val_conv = ChannelHandshakeConfig_clone(&val_conv);
25436 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
25439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
25440 LDKUserConfig this_ptr_conv;
25441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25442 this_ptr_conv.is_owned = false;
25443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25444 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
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) {
25456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25457 LDKUserConfig this_ptr_conv;
25458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25459 this_ptr_conv.is_owned = false;
25460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25461 LDKChannelHandshakeLimits val_conv;
25462 val_conv.inner = (void*)(val & (~1));
25463 val_conv.is_owned = (val & 1) || (val == 0);
25464 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25465 val_conv = ChannelHandshakeLimits_clone(&val_conv);
25466 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
25469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
25470 LDKUserConfig this_ptr_conv;
25471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25472 this_ptr_conv.is_owned = false;
25473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25474 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
25475 int64_t ret_ref = 0;
25476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25479 ret_ref = (uintptr_t)ret_var.inner;
25480 if (ret_var.is_owned) {
25486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25487 LDKUserConfig this_ptr_conv;
25488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25489 this_ptr_conv.is_owned = false;
25490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25491 LDKChannelConfig val_conv;
25492 val_conv.inner = (void*)(val & (~1));
25493 val_conv.is_owned = (val & 1) || (val == 0);
25494 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25495 val_conv = ChannelConfig_clone(&val_conv);
25496 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
25499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25500 LDKUserConfig this_ptr_conv;
25501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25502 this_ptr_conv.is_owned = false;
25503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25504 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
25508 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) {
25509 LDKUserConfig this_ptr_conv;
25510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25511 this_ptr_conv.is_owned = false;
25512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25513 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
25516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25517 LDKUserConfig this_ptr_conv;
25518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25519 this_ptr_conv.is_owned = false;
25520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25521 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
25525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25526 LDKUserConfig this_ptr_conv;
25527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25528 this_ptr_conv.is_owned = false;
25529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25530 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
25533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25534 LDKUserConfig this_ptr_conv;
25535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25536 this_ptr_conv.is_owned = false;
25537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25538 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
25542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25543 LDKUserConfig this_ptr_conv;
25544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25545 this_ptr_conv.is_owned = false;
25546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25547 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
25550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
25551 LDKChannelHandshakeConfig own_channel_config_arg_conv;
25552 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
25553 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
25554 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
25555 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
25556 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
25557 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
25558 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
25559 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
25560 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
25561 LDKChannelConfig channel_options_arg_conv;
25562 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
25563 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
25564 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
25565 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
25566 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
25567 int64_t ret_ref = 0;
25568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25571 ret_ref = (uintptr_t)ret_var.inner;
25572 if (ret_var.is_owned) {
25578 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
25579 LDKUserConfig ret_var = UserConfig_clone(arg);
25580 int64_t ret_ref = 0;
25581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25584 ret_ref = (uintptr_t)ret_var.inner;
25585 if (ret_var.is_owned) {
25590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25591 LDKUserConfig arg_conv;
25592 arg_conv.inner = (void*)(arg & (~1));
25593 arg_conv.is_owned = false;
25594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25595 int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
25599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25600 LDKUserConfig orig_conv;
25601 orig_conv.inner = (void*)(orig & (~1));
25602 orig_conv.is_owned = false;
25603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25604 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25605 int64_t ret_ref = 0;
25606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25609 ret_ref = (uintptr_t)ret_var.inner;
25610 if (ret_var.is_owned) {
25616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25617 LDKUserConfig ret_var = UserConfig_default();
25618 int64_t ret_ref = 0;
25619 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25620 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25622 ret_ref = (uintptr_t)ret_var.inner;
25623 if (ret_var.is_owned) {
25629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25630 LDKBestBlock this_obj_conv;
25631 this_obj_conv.inner = (void*)(this_obj & (~1));
25632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25634 BestBlock_free(this_obj_conv);
25637 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25638 LDKBestBlock ret_var = BestBlock_clone(arg);
25639 int64_t ret_ref = 0;
25640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25643 ret_ref = (uintptr_t)ret_var.inner;
25644 if (ret_var.is_owned) {
25649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25650 LDKBestBlock arg_conv;
25651 arg_conv.inner = (void*)(arg & (~1));
25652 arg_conv.is_owned = false;
25653 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25654 int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25659 LDKBestBlock orig_conv;
25660 orig_conv.inner = (void*)(orig & (~1));
25661 orig_conv.is_owned = false;
25662 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25663 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25664 int64_t ret_ref = 0;
25665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25668 ret_ref = (uintptr_t)ret_var.inner;
25669 if (ret_var.is_owned) {
25675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25676 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25677 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25678 int64_t ret_ref = 0;
25679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25682 ret_ref = (uintptr_t)ret_var.inner;
25683 if (ret_var.is_owned) {
25689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25690 LDKThirtyTwoBytes block_hash_ref;
25691 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25692 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25693 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25694 int64_t ret_ref = 0;
25695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25698 ret_ref = (uintptr_t)ret_var.inner;
25699 if (ret_var.is_owned) {
25705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25706 LDKBestBlock this_arg_conv;
25707 this_arg_conv.inner = (void*)(this_arg & (~1));
25708 this_arg_conv.is_owned = false;
25709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25710 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25715 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25716 LDKBestBlock this_arg_conv;
25717 this_arg_conv.inner = (void*)(this_arg & (~1));
25718 this_arg_conv.is_owned = false;
25719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25720 int32_t ret_conv = BestBlock_height(&this_arg_conv);
25724 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25725 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
25726 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25730 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25731 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25736 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25741 if ((this_ptr & 1) != 0) return;
25742 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25743 CHECK_ACCESS(this_ptr_ptr);
25744 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25745 FREE((void*)this_ptr);
25746 Access_free(this_ptr_conv);
25749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25750 if ((this_ptr & 1) != 0) return;
25751 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25752 CHECK_ACCESS(this_ptr_ptr);
25753 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25754 FREE((void*)this_ptr);
25755 Listen_free(this_ptr_conv);
25758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25759 if ((this_ptr & 1) != 0) return;
25760 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25761 CHECK_ACCESS(this_ptr_ptr);
25762 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25763 FREE((void*)this_ptr);
25764 Confirm_free(this_ptr_conv);
25767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25768 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
25769 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25773 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25774 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25779 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25784 if ((this_ptr & 1) != 0) return;
25785 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25786 CHECK_ACCESS(this_ptr_ptr);
25787 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25788 FREE((void*)this_ptr);
25789 Watch_free(this_ptr_conv);
25792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25793 if ((this_ptr & 1) != 0) return;
25794 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25795 CHECK_ACCESS(this_ptr_ptr);
25796 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25797 FREE((void*)this_ptr);
25798 Filter_free(this_ptr_conv);
25801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25802 LDKWatchedOutput this_obj_conv;
25803 this_obj_conv.inner = (void*)(this_obj & (~1));
25804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25806 WatchedOutput_free(this_obj_conv);
25809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25810 LDKWatchedOutput this_ptr_conv;
25811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25812 this_ptr_conv.is_owned = false;
25813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25814 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25815 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25820 LDKWatchedOutput this_ptr_conv;
25821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25822 this_ptr_conv.is_owned = false;
25823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25824 LDKThirtyTwoBytes val_ref;
25825 CHECK((*env)->GetArrayLength(env, val) == 32);
25826 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25827 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25831 LDKWatchedOutput this_ptr_conv;
25832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25833 this_ptr_conv.is_owned = false;
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25835 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25836 int64_t ret_ref = 0;
25837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25840 ret_ref = (uintptr_t)ret_var.inner;
25841 if (ret_var.is_owned) {
25847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25848 LDKWatchedOutput this_ptr_conv;
25849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25850 this_ptr_conv.is_owned = false;
25851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25852 LDKOutPoint val_conv;
25853 val_conv.inner = (void*)(val & (~1));
25854 val_conv.is_owned = (val & 1) || (val == 0);
25855 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25856 val_conv = OutPoint_clone(&val_conv);
25857 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25861 LDKWatchedOutput this_ptr_conv;
25862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25863 this_ptr_conv.is_owned = false;
25864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25865 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25866 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25867 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25872 LDKWatchedOutput this_ptr_conv;
25873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25874 this_ptr_conv.is_owned = false;
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25876 LDKCVec_u8Z val_ref;
25877 val_ref.datalen = (*env)->GetArrayLength(env, val);
25878 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25879 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25880 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25883 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) {
25884 LDKThirtyTwoBytes block_hash_arg_ref;
25885 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25886 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25887 LDKOutPoint outpoint_arg_conv;
25888 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
25889 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
25890 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25891 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25892 LDKCVec_u8Z script_pubkey_arg_ref;
25893 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25894 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25895 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25896 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25897 int64_t ret_ref = 0;
25898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25901 ret_ref = (uintptr_t)ret_var.inner;
25902 if (ret_var.is_owned) {
25908 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25909 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25910 int64_t ret_ref = 0;
25911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25914 ret_ref = (uintptr_t)ret_var.inner;
25915 if (ret_var.is_owned) {
25920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25921 LDKWatchedOutput arg_conv;
25922 arg_conv.inner = (void*)(arg & (~1));
25923 arg_conv.is_owned = false;
25924 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25925 int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
25929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25930 LDKWatchedOutput orig_conv;
25931 orig_conv.inner = (void*)(orig & (~1));
25932 orig_conv.is_owned = false;
25933 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25934 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25935 int64_t ret_ref = 0;
25936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25939 ret_ref = (uintptr_t)ret_var.inner;
25940 if (ret_var.is_owned) {
25946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25947 LDKWatchedOutput o_conv;
25948 o_conv.inner = (void*)(o & (~1));
25949 o_conv.is_owned = false;
25950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25951 int64_t ret_conv = WatchedOutput_hash(&o_conv);
25955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25956 if ((this_ptr & 1) != 0) return;
25957 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25958 CHECK_ACCESS(this_ptr_ptr);
25959 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25960 FREE((void*)this_ptr);
25961 BroadcasterInterface_free(this_ptr_conv);
25964 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25965 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
25966 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25970 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25971 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25975 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25976 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25981 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25986 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
25987 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
25988 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
25992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25993 if ((this_ptr & 1) != 0) return;
25994 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25995 CHECK_ACCESS(this_ptr_ptr);
25996 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25997 FREE((void*)this_ptr);
25998 FeeEstimator_free(this_ptr_conv);
26001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26002 LDKMonitorUpdateId this_obj_conv;
26003 this_obj_conv.inner = (void*)(this_obj & (~1));
26004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26006 MonitorUpdateId_free(this_obj_conv);
26009 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
26010 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
26011 int64_t ret_ref = 0;
26012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26015 ret_ref = (uintptr_t)ret_var.inner;
26016 if (ret_var.is_owned) {
26021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26022 LDKMonitorUpdateId arg_conv;
26023 arg_conv.inner = (void*)(arg & (~1));
26024 arg_conv.is_owned = false;
26025 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26026 int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
26030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26031 LDKMonitorUpdateId orig_conv;
26032 orig_conv.inner = (void*)(orig & (~1));
26033 orig_conv.is_owned = false;
26034 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26035 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
26036 int64_t ret_ref = 0;
26037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26040 ret_ref = (uintptr_t)ret_var.inner;
26041 if (ret_var.is_owned) {
26047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
26048 LDKMonitorUpdateId o_conv;
26049 o_conv.inner = (void*)(o & (~1));
26050 o_conv.is_owned = false;
26051 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26052 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
26056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26057 LDKMonitorUpdateId a_conv;
26058 a_conv.inner = (void*)(a & (~1));
26059 a_conv.is_owned = false;
26060 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26061 LDKMonitorUpdateId b_conv;
26062 b_conv.inner = (void*)(b & (~1));
26063 b_conv.is_owned = false;
26064 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26065 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
26069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26070 if ((this_ptr & 1) != 0) return;
26071 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26072 CHECK_ACCESS(this_ptr_ptr);
26073 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
26074 FREE((void*)this_ptr);
26075 Persist_free(this_ptr_conv);
26078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26079 LDKLockedChannelMonitor this_obj_conv;
26080 this_obj_conv.inner = (void*)(this_obj & (~1));
26081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26083 LockedChannelMonitor_free(this_obj_conv);
26086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26087 LDKChainMonitor this_obj_conv;
26088 this_obj_conv.inner = (void*)(this_obj & (~1));
26089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26091 ChainMonitor_free(this_obj_conv);
26094 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) {
26095 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
26096 CHECK_ACCESS(chain_source_ptr);
26097 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
26098 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
26099 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
26100 // Manually implement clone for Java trait instances
26101 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
26102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26103 LDKFilter_JCalls_cloned(&chain_source_conv.some);
26106 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26107 CHECK_ACCESS(broadcaster_ptr);
26108 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26109 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26111 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26113 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26114 CHECK_ACCESS(logger_ptr);
26115 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26116 if (logger_conv.free == LDKLogger_JCalls_free) {
26117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26118 LDKLogger_JCalls_cloned(&logger_conv);
26120 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
26121 CHECK_ACCESS(feeest_ptr);
26122 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
26123 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
26124 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26125 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
26127 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
26128 CHECK_ACCESS(persister_ptr);
26129 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
26130 if (persister_conv.free == LDKPersist_JCalls_free) {
26131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26132 LDKPersist_JCalls_cloned(&persister_conv);
26134 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
26135 int64_t ret_ref = 0;
26136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26139 ret_ref = (uintptr_t)ret_var.inner;
26140 if (ret_var.is_owned) {
26146 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) {
26147 LDKChainMonitor this_arg_conv;
26148 this_arg_conv.inner = (void*)(this_arg & (~1));
26149 this_arg_conv.is_owned = false;
26150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26151 LDKCVec_ChannelDetailsZ ignored_channels_constr;
26152 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
26153 if (ignored_channels_constr.datalen > 0)
26154 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26156 ignored_channels_constr.data = NULL;
26157 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
26158 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
26159 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
26160 LDKChannelDetails ignored_channels_conv_16_conv;
26161 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
26162 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
26163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
26164 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
26165 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
26167 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
26168 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
26169 int64_tArray ret_arr = NULL;
26170 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26171 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26172 for (size_t j = 0; j < ret_var.datalen; j++) {
26173 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26174 *ret_conv_9_copy = ret_var.data[j];
26175 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
26176 ret_arr_ptr[j] = ret_conv_9_ref;
26178 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26179 FREE(ret_var.data);
26183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
26184 LDKChainMonitor this_arg_conv;
26185 this_arg_conv.inner = (void*)(this_arg & (~1));
26186 this_arg_conv.is_owned = false;
26187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26188 LDKOutPoint funding_txo_conv;
26189 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26190 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26191 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26192 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26193 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26194 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
26195 return (int64_t)ret_conv;
26198 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
26199 LDKChainMonitor this_arg_conv;
26200 this_arg_conv.inner = (void*)(this_arg & (~1));
26201 this_arg_conv.is_owned = false;
26202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26203 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
26204 int64_tArray ret_arr = NULL;
26205 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26206 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26207 for (size_t k = 0; k < ret_var.datalen; k++) {
26208 LDKOutPoint ret_conv_10_var = ret_var.data[k];
26209 int64_t ret_conv_10_ref = 0;
26210 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26211 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
26213 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
26214 if (ret_conv_10_var.is_owned) {
26215 ret_conv_10_ref |= 1;
26217 ret_arr_ptr[k] = ret_conv_10_ref;
26219 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26220 FREE(ret_var.data);
26224 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) {
26225 LDKChainMonitor this_arg_conv;
26226 this_arg_conv.inner = (void*)(this_arg & (~1));
26227 this_arg_conv.is_owned = false;
26228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26229 LDKOutPoint funding_txo_conv;
26230 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26231 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26232 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26233 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26234 LDKMonitorUpdateId completed_update_id_conv;
26235 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
26236 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
26237 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
26238 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
26239 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26240 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
26241 return (int64_t)ret_conv;
26244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
26245 LDKChainMonitor this_arg_conv;
26246 this_arg_conv.inner = (void*)(this_arg & (~1));
26247 this_arg_conv.is_owned = false;
26248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26249 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26250 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
26251 return (int64_t)ret_ret;
26254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
26255 LDKChainMonitor this_arg_conv;
26256 this_arg_conv.inner = (void*)(this_arg & (~1));
26257 this_arg_conv.is_owned = false;
26258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26259 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26260 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
26261 return (int64_t)ret_ret;
26264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26265 LDKChainMonitor this_arg_conv;
26266 this_arg_conv.inner = (void*)(this_arg & (~1));
26267 this_arg_conv.is_owned = false;
26268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26269 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
26270 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
26271 return (int64_t)ret_ret;
26274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26275 LDKChainMonitor this_arg_conv;
26276 this_arg_conv.inner = (void*)(this_arg & (~1));
26277 this_arg_conv.is_owned = false;
26278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26279 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26280 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
26281 return (int64_t)ret_ret;
26284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26285 LDKChannelMonitorUpdate this_obj_conv;
26286 this_obj_conv.inner = (void*)(this_obj & (~1));
26287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26289 ChannelMonitorUpdate_free(this_obj_conv);
26292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26293 LDKChannelMonitorUpdate this_ptr_conv;
26294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26295 this_ptr_conv.is_owned = false;
26296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26297 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
26301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26302 LDKChannelMonitorUpdate this_ptr_conv;
26303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26304 this_ptr_conv.is_owned = false;
26305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26306 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
26309 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
26310 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
26311 int64_t ret_ref = 0;
26312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26315 ret_ref = (uintptr_t)ret_var.inner;
26316 if (ret_var.is_owned) {
26321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26322 LDKChannelMonitorUpdate arg_conv;
26323 arg_conv.inner = (void*)(arg & (~1));
26324 arg_conv.is_owned = false;
26325 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26326 int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
26330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26331 LDKChannelMonitorUpdate orig_conv;
26332 orig_conv.inner = (void*)(orig & (~1));
26333 orig_conv.is_owned = false;
26334 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26335 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
26336 int64_t ret_ref = 0;
26337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26340 ret_ref = (uintptr_t)ret_var.inner;
26341 if (ret_var.is_owned) {
26347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26348 LDKChannelMonitorUpdate obj_conv;
26349 obj_conv.inner = (void*)(obj & (~1));
26350 obj_conv.is_owned = false;
26351 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26352 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
26353 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26354 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26355 CVec_u8Z_free(ret_var);
26359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26360 LDKu8slice ser_ref;
26361 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26362 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26363 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26364 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
26365 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26366 return (int64_t)ret_conv;
26369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26370 if ((this_ptr & 1) != 0) return;
26371 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26372 CHECK_ACCESS(this_ptr_ptr);
26373 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
26374 FREE((void*)this_ptr);
26375 MonitorEvent_free(this_ptr_conv);
26378 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
26379 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26380 *ret_copy = MonitorEvent_clone(arg);
26381 int64_t ret_ref = (uintptr_t)ret_copy;
26384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26385 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
26386 int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
26390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26391 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
26392 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26393 *ret_copy = MonitorEvent_clone(orig_conv);
26394 int64_t ret_ref = (uintptr_t)ret_copy;
26398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
26399 LDKHTLCUpdate a_conv;
26400 a_conv.inner = (void*)(a & (~1));
26401 a_conv.is_owned = (a & 1) || (a == 0);
26402 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26403 a_conv = HTLCUpdate_clone(&a_conv);
26404 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26405 *ret_copy = MonitorEvent_htlcevent(a_conv);
26406 int64_t ret_ref = (uintptr_t)ret_copy;
26410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
26411 LDKOutPoint a_conv;
26412 a_conv.inner = (void*)(a & (~1));
26413 a_conv.is_owned = (a & 1) || (a == 0);
26414 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26415 a_conv = OutPoint_clone(&a_conv);
26416 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26417 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
26418 int64_t ret_ref = (uintptr_t)ret_copy;
26422 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) {
26423 LDKOutPoint funding_txo_conv;
26424 funding_txo_conv.inner = (void*)(funding_txo & (~1));
26425 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
26426 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26427 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26428 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26429 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
26430 int64_t ret_ref = (uintptr_t)ret_copy;
26434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
26435 LDKOutPoint a_conv;
26436 a_conv.inner = (void*)(a & (~1));
26437 a_conv.is_owned = (a & 1) || (a == 0);
26438 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26439 a_conv = OutPoint_clone(&a_conv);
26440 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26441 *ret_copy = MonitorEvent_update_failed(a_conv);
26442 int64_t ret_ref = (uintptr_t)ret_copy;
26446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
26447 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
26448 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
26449 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26450 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26451 CVec_u8Z_free(ret_var);
26455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26456 LDKu8slice ser_ref;
26457 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26458 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26459 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26460 *ret_conv = MonitorEvent_read(ser_ref);
26461 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26462 return (int64_t)ret_conv;
26465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26466 LDKHTLCUpdate this_obj_conv;
26467 this_obj_conv.inner = (void*)(this_obj & (~1));
26468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26470 HTLCUpdate_free(this_obj_conv);
26473 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
26474 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
26475 int64_t ret_ref = 0;
26476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26479 ret_ref = (uintptr_t)ret_var.inner;
26480 if (ret_var.is_owned) {
26485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26486 LDKHTLCUpdate arg_conv;
26487 arg_conv.inner = (void*)(arg & (~1));
26488 arg_conv.is_owned = false;
26489 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26490 int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
26494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26495 LDKHTLCUpdate orig_conv;
26496 orig_conv.inner = (void*)(orig & (~1));
26497 orig_conv.is_owned = false;
26498 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26499 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
26500 int64_t ret_ref = 0;
26501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26504 ret_ref = (uintptr_t)ret_var.inner;
26505 if (ret_var.is_owned) {
26511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26512 LDKHTLCUpdate obj_conv;
26513 obj_conv.inner = (void*)(obj & (~1));
26514 obj_conv.is_owned = false;
26515 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26516 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
26517 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26518 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26519 CVec_u8Z_free(ret_var);
26523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26524 LDKu8slice ser_ref;
26525 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26526 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26527 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26528 *ret_conv = HTLCUpdate_read(ser_ref);
26529 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26530 return (int64_t)ret_conv;
26533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26534 if ((this_ptr & 1) != 0) return;
26535 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26536 CHECK_ACCESS(this_ptr_ptr);
26537 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
26538 FREE((void*)this_ptr);
26539 Balance_free(this_ptr_conv);
26542 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
26543 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26544 *ret_copy = Balance_clone(arg);
26545 int64_t ret_ref = (uintptr_t)ret_copy;
26548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26549 LDKBalance* arg_conv = (LDKBalance*)arg;
26550 int64_t ret_conv = Balance_clone_ptr(arg_conv);
26554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26555 LDKBalance* orig_conv = (LDKBalance*)orig;
26556 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26557 *ret_copy = Balance_clone(orig_conv);
26558 int64_t ret_ref = (uintptr_t)ret_copy;
26562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
26563 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26564 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
26565 int64_t ret_ref = (uintptr_t)ret_copy;
26569 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) {
26570 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26571 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
26572 int64_t ret_ref = (uintptr_t)ret_copy;
26576 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) {
26577 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26578 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
26579 int64_t ret_ref = (uintptr_t)ret_copy;
26583 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) {
26584 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26585 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
26586 int64_t ret_ref = (uintptr_t)ret_copy;
26590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26591 LDKBalance* a_conv = (LDKBalance*)a;
26592 LDKBalance* b_conv = (LDKBalance*)b;
26593 jboolean ret_conv = Balance_eq(a_conv, b_conv);
26597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26598 LDKChannelMonitor this_obj_conv;
26599 this_obj_conv.inner = (void*)(this_obj & (~1));
26600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26602 ChannelMonitor_free(this_obj_conv);
26605 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26606 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26607 int64_t ret_ref = 0;
26608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26611 ret_ref = (uintptr_t)ret_var.inner;
26612 if (ret_var.is_owned) {
26617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26618 LDKChannelMonitor arg_conv;
26619 arg_conv.inner = (void*)(arg & (~1));
26620 arg_conv.is_owned = false;
26621 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26622 int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26627 LDKChannelMonitor orig_conv;
26628 orig_conv.inner = (void*)(orig & (~1));
26629 orig_conv.is_owned = false;
26630 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26631 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26632 int64_t ret_ref = 0;
26633 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26634 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26636 ret_ref = (uintptr_t)ret_var.inner;
26637 if (ret_var.is_owned) {
26643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26644 LDKChannelMonitor obj_conv;
26645 obj_conv.inner = (void*)(obj & (~1));
26646 obj_conv.is_owned = false;
26647 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26648 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26649 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26650 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26651 CVec_u8Z_free(ret_var);
26655 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) {
26656 LDKChannelMonitor this_arg_conv;
26657 this_arg_conv.inner = (void*)(this_arg & (~1));
26658 this_arg_conv.is_owned = false;
26659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26660 LDKChannelMonitorUpdate updates_conv;
26661 updates_conv.inner = (void*)(updates & (~1));
26662 updates_conv.is_owned = false;
26663 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26664 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26665 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
26666 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26667 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26668 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
26669 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
26670 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26671 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26672 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26673 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26674 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26675 return (int64_t)ret_conv;
26678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26679 LDKChannelMonitor this_arg_conv;
26680 this_arg_conv.inner = (void*)(this_arg & (~1));
26681 this_arg_conv.is_owned = false;
26682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26683 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26688 LDKChannelMonitor this_arg_conv;
26689 this_arg_conv.inner = (void*)(this_arg & (~1));
26690 this_arg_conv.is_owned = false;
26691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26692 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26693 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26694 return ((int64_t)ret_conv);
26697 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26698 LDKChannelMonitor this_arg_conv;
26699 this_arg_conv.inner = (void*)(this_arg & (~1));
26700 this_arg_conv.is_owned = false;
26701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26702 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26703 int64_tArray ret_arr = NULL;
26704 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26705 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26706 for (size_t o = 0; o < ret_var.datalen; o++) {
26707 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26708 *ret_conv_40_conv = ret_var.data[o];
26709 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
26711 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26712 FREE(ret_var.data);
26716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26717 LDKChannelMonitor this_arg_conv;
26718 this_arg_conv.inner = (void*)(this_arg & (~1));
26719 this_arg_conv.is_owned = false;
26720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26721 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
26722 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
26723 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26724 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26727 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26728 LDKChannelMonitor this_arg_conv;
26729 this_arg_conv.inner = (void*)(this_arg & (~1));
26730 this_arg_conv.is_owned = false;
26731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26732 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26733 int64_tArray ret_arr = NULL;
26734 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26735 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26736 for (size_t o = 0; o < ret_var.datalen; o++) {
26737 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26738 *ret_conv_14_copy = ret_var.data[o];
26739 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
26740 ret_arr_ptr[o] = ret_conv_14_ref;
26742 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26743 FREE(ret_var.data);
26747 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26748 LDKChannelMonitor this_arg_conv;
26749 this_arg_conv.inner = (void*)(this_arg & (~1));
26750 this_arg_conv.is_owned = false;
26751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26752 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26753 int64_tArray ret_arr = NULL;
26754 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26755 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26756 for (size_t h = 0; h < ret_var.datalen; h++) {
26757 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26758 *ret_conv_7_copy = ret_var.data[h];
26759 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
26760 ret_arr_ptr[h] = ret_conv_7_ref;
26762 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26763 FREE(ret_var.data);
26767 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) {
26768 LDKChannelMonitor this_arg_conv;
26769 this_arg_conv.inner = (void*)(this_arg & (~1));
26770 this_arg_conv.is_owned = false;
26771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26772 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26773 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26774 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26775 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26776 jobjectArray ret_arr = NULL;
26777 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26779 for (size_t i = 0; i < ret_var.datalen; i++) {
26780 LDKTransaction ret_conv_8_var = ret_var.data[i];
26781 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26782 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26783 Transaction_free(ret_conv_8_var);
26784 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26787 FREE(ret_var.data);
26791 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) {
26792 LDKChannelMonitor this_arg_conv;
26793 this_arg_conv.inner = (void*)(this_arg & (~1));
26794 this_arg_conv.is_owned = false;
26795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26796 unsigned char header_arr[80];
26797 CHECK((*env)->GetArrayLength(env, header) == 80);
26798 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26799 unsigned char (*header_ref)[80] = &header_arr;
26800 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26801 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26802 if (txdata_constr.datalen > 0)
26803 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26805 txdata_constr.data = NULL;
26806 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26807 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26808 int64_t txdata_conv_28 = txdata_vals[c];
26809 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26810 CHECK_ACCESS(txdata_conv_28_ptr);
26811 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26812 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26813 txdata_constr.data[c] = txdata_conv_28_conv;
26815 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26816 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26817 CHECK_ACCESS(broadcaster_ptr);
26818 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26819 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26820 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26821 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26823 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26824 CHECK_ACCESS(fee_estimator_ptr);
26825 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26826 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26828 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26830 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26831 CHECK_ACCESS(logger_ptr);
26832 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26833 if (logger_conv.free == LDKLogger_JCalls_free) {
26834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26835 LDKLogger_JCalls_cloned(&logger_conv);
26837 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);
26838 int64_tArray ret_arr = NULL;
26839 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26840 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26841 for (size_t n = 0; n < ret_var.datalen; n++) {
26842 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26843 *ret_conv_39_conv = ret_var.data[n];
26844 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26846 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26847 FREE(ret_var.data);
26851 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) {
26852 LDKChannelMonitor this_arg_conv;
26853 this_arg_conv.inner = (void*)(this_arg & (~1));
26854 this_arg_conv.is_owned = false;
26855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26856 unsigned char header_arr[80];
26857 CHECK((*env)->GetArrayLength(env, header) == 80);
26858 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26859 unsigned char (*header_ref)[80] = &header_arr;
26860 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26861 CHECK_ACCESS(broadcaster_ptr);
26862 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26863 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26865 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26867 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26868 CHECK_ACCESS(fee_estimator_ptr);
26869 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26870 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26871 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26872 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26874 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26875 CHECK_ACCESS(logger_ptr);
26876 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26877 if (logger_conv.free == LDKLogger_JCalls_free) {
26878 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26879 LDKLogger_JCalls_cloned(&logger_conv);
26881 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26884 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) {
26885 LDKChannelMonitor this_arg_conv;
26886 this_arg_conv.inner = (void*)(this_arg & (~1));
26887 this_arg_conv.is_owned = false;
26888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26889 unsigned char header_arr[80];
26890 CHECK((*env)->GetArrayLength(env, header) == 80);
26891 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26892 unsigned char (*header_ref)[80] = &header_arr;
26893 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26894 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26895 if (txdata_constr.datalen > 0)
26896 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26898 txdata_constr.data = NULL;
26899 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26900 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26901 int64_t txdata_conv_28 = txdata_vals[c];
26902 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26903 CHECK_ACCESS(txdata_conv_28_ptr);
26904 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26905 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26906 txdata_constr.data[c] = txdata_conv_28_conv;
26908 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26909 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26910 CHECK_ACCESS(broadcaster_ptr);
26911 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26912 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26913 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26914 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26916 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26917 CHECK_ACCESS(fee_estimator_ptr);
26918 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26919 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26920 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26921 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26923 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26924 CHECK_ACCESS(logger_ptr);
26925 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26926 if (logger_conv.free == LDKLogger_JCalls_free) {
26927 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26928 LDKLogger_JCalls_cloned(&logger_conv);
26930 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);
26931 int64_tArray ret_arr = NULL;
26932 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26933 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26934 for (size_t n = 0; n < ret_var.datalen; n++) {
26935 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26936 *ret_conv_39_conv = ret_var.data[n];
26937 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26939 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26940 FREE(ret_var.data);
26944 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) {
26945 LDKChannelMonitor this_arg_conv;
26946 this_arg_conv.inner = (void*)(this_arg & (~1));
26947 this_arg_conv.is_owned = false;
26948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26949 unsigned char txid_arr[32];
26950 CHECK((*env)->GetArrayLength(env, txid) == 32);
26951 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26952 unsigned char (*txid_ref)[32] = &txid_arr;
26953 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26954 CHECK_ACCESS(broadcaster_ptr);
26955 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26956 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26957 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26958 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26960 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26961 CHECK_ACCESS(fee_estimator_ptr);
26962 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26963 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26964 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26965 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26967 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26968 CHECK_ACCESS(logger_ptr);
26969 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26970 if (logger_conv.free == LDKLogger_JCalls_free) {
26971 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26972 LDKLogger_JCalls_cloned(&logger_conv);
26974 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26977 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) {
26978 LDKChannelMonitor this_arg_conv;
26979 this_arg_conv.inner = (void*)(this_arg & (~1));
26980 this_arg_conv.is_owned = false;
26981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26982 unsigned char header_arr[80];
26983 CHECK((*env)->GetArrayLength(env, header) == 80);
26984 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26985 unsigned char (*header_ref)[80] = &header_arr;
26986 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26987 CHECK_ACCESS(broadcaster_ptr);
26988 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26989 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26990 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26991 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26993 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26994 CHECK_ACCESS(fee_estimator_ptr);
26995 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26996 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26997 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26998 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27000 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27001 CHECK_ACCESS(logger_ptr);
27002 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27003 if (logger_conv.free == LDKLogger_JCalls_free) {
27004 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27005 LDKLogger_JCalls_cloned(&logger_conv);
27007 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27008 int64_tArray ret_arr = NULL;
27009 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27010 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27011 for (size_t n = 0; n < ret_var.datalen; n++) {
27012 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27013 *ret_conv_39_conv = ret_var.data[n];
27014 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27016 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27017 FREE(ret_var.data);
27021 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
27022 LDKChannelMonitor this_arg_conv;
27023 this_arg_conv.inner = (void*)(this_arg & (~1));
27024 this_arg_conv.is_owned = false;
27025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27026 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
27027 jobjectArray ret_arr = NULL;
27028 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27030 for (size_t i = 0; i < ret_var.datalen; i++) {
27031 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
27032 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
27033 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27036 FREE(ret_var.data);
27040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
27041 LDKChannelMonitor this_arg_conv;
27042 this_arg_conv.inner = (void*)(this_arg & (~1));
27043 this_arg_conv.is_owned = false;
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27045 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
27046 int64_t ret_ref = 0;
27047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27050 ret_ref = (uintptr_t)ret_var.inner;
27051 if (ret_var.is_owned) {
27057 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
27058 LDKChannelMonitor this_arg_conv;
27059 this_arg_conv.inner = (void*)(this_arg & (~1));
27060 this_arg_conv.is_owned = false;
27061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27062 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
27063 int64_tArray ret_arr = NULL;
27064 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27065 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27066 for (size_t j = 0; j < ret_var.datalen; j++) {
27067 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27068 *ret_conv_9_copy = ret_var.data[j];
27069 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
27070 ret_arr_ptr[j] = ret_conv_9_ref;
27072 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27073 FREE(ret_var.data);
27077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
27078 LDKu8slice ser_ref;
27079 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27080 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27081 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
27082 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
27083 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
27084 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
27085 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
27086 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27087 return (int64_t)ret_conv;
27090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27091 LDKOutPoint this_obj_conv;
27092 this_obj_conv.inner = (void*)(this_obj & (~1));
27093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27095 OutPoint_free(this_obj_conv);
27098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
27099 LDKOutPoint this_ptr_conv;
27100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27101 this_ptr_conv.is_owned = false;
27102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27103 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
27108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27109 LDKOutPoint this_ptr_conv;
27110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27111 this_ptr_conv.is_owned = false;
27112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27113 LDKThirtyTwoBytes val_ref;
27114 CHECK((*env)->GetArrayLength(env, val) == 32);
27115 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27116 OutPoint_set_txid(&this_ptr_conv, val_ref);
27119 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
27120 LDKOutPoint this_ptr_conv;
27121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27122 this_ptr_conv.is_owned = false;
27123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27124 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
27128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27129 LDKOutPoint this_ptr_conv;
27130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27131 this_ptr_conv.is_owned = false;
27132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27133 OutPoint_set_index(&this_ptr_conv, val);
27136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
27137 LDKThirtyTwoBytes txid_arg_ref;
27138 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
27139 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
27140 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
27141 int64_t ret_ref = 0;
27142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27145 ret_ref = (uintptr_t)ret_var.inner;
27146 if (ret_var.is_owned) {
27152 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
27153 LDKOutPoint ret_var = OutPoint_clone(arg);
27154 int64_t ret_ref = 0;
27155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27158 ret_ref = (uintptr_t)ret_var.inner;
27159 if (ret_var.is_owned) {
27164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27165 LDKOutPoint arg_conv;
27166 arg_conv.inner = (void*)(arg & (~1));
27167 arg_conv.is_owned = false;
27168 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27169 int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
27173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27174 LDKOutPoint orig_conv;
27175 orig_conv.inner = (void*)(orig & (~1));
27176 orig_conv.is_owned = false;
27177 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27178 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
27179 int64_t ret_ref = 0;
27180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27183 ret_ref = (uintptr_t)ret_var.inner;
27184 if (ret_var.is_owned) {
27190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27191 LDKOutPoint a_conv;
27192 a_conv.inner = (void*)(a & (~1));
27193 a_conv.is_owned = false;
27194 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27195 LDKOutPoint b_conv;
27196 b_conv.inner = (void*)(b & (~1));
27197 b_conv.is_owned = false;
27198 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27199 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
27203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
27204 LDKOutPoint o_conv;
27205 o_conv.inner = (void*)(o & (~1));
27206 o_conv.is_owned = false;
27207 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27208 int64_t ret_conv = OutPoint_hash(&o_conv);
27212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27213 LDKOutPoint this_arg_conv;
27214 this_arg_conv.inner = (void*)(this_arg & (~1));
27215 this_arg_conv.is_owned = false;
27216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
27222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
27223 LDKOutPoint obj_conv;
27224 obj_conv.inner = (void*)(obj & (~1));
27225 obj_conv.is_owned = false;
27226 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27227 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
27228 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27229 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27230 CVec_u8Z_free(ret_var);
27234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27235 LDKu8slice ser_ref;
27236 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27237 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27238 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27239 *ret_conv = OutPoint_read(ser_ref);
27240 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27241 return (int64_t)ret_conv;
27244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27245 LDKDelayedPaymentOutputDescriptor this_obj_conv;
27246 this_obj_conv.inner = (void*)(this_obj & (~1));
27247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27249 DelayedPaymentOutputDescriptor_free(this_obj_conv);
27252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27253 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27255 this_ptr_conv.is_owned = false;
27256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27257 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27258 int64_t ret_ref = 0;
27259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27262 ret_ref = (uintptr_t)ret_var.inner;
27263 if (ret_var.is_owned) {
27269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27270 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27272 this_ptr_conv.is_owned = false;
27273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27274 LDKOutPoint val_conv;
27275 val_conv.inner = (void*)(val & (~1));
27276 val_conv.is_owned = (val & 1) || (val == 0);
27277 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27278 val_conv = OutPoint_clone(&val_conv);
27279 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27283 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27285 this_ptr_conv.is_owned = false;
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27287 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
27292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27293 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27295 this_ptr_conv.is_owned = false;
27296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27297 LDKPublicKey val_ref;
27298 CHECK((*env)->GetArrayLength(env, val) == 33);
27299 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27300 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
27303 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27304 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27306 this_ptr_conv.is_owned = false;
27307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27308 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
27312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27313 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27315 this_ptr_conv.is_owned = false;
27316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27317 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
27320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27321 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27323 this_ptr_conv.is_owned = false;
27324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27325 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27326 CHECK_ACCESS(val_ptr);
27327 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27328 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
27329 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27333 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27335 this_ptr_conv.is_owned = false;
27336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27337 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27338 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
27342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27343 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27345 this_ptr_conv.is_owned = false;
27346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27347 LDKPublicKey val_ref;
27348 CHECK((*env)->GetArrayLength(env, val) == 33);
27349 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27350 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
27353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27354 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27356 this_ptr_conv.is_owned = false;
27357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27358 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27364 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27366 this_ptr_conv.is_owned = false;
27367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27368 LDKThirtyTwoBytes val_ref;
27369 CHECK((*env)->GetArrayLength(env, val) == 32);
27370 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27371 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27375 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27377 this_ptr_conv.is_owned = false;
27378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27379 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27384 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27386 this_ptr_conv.is_owned = false;
27387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27388 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27391 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) {
27392 LDKOutPoint outpoint_arg_conv;
27393 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
27394 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
27395 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27396 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27397 LDKPublicKey per_commitment_point_arg_ref;
27398 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
27399 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
27400 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
27401 CHECK_ACCESS(output_arg_ptr);
27402 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27403 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
27404 LDKPublicKey revocation_pubkey_arg_ref;
27405 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
27406 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
27407 LDKThirtyTwoBytes channel_keys_id_arg_ref;
27408 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27409 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27410 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);
27411 int64_t ret_ref = 0;
27412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27415 ret_ref = (uintptr_t)ret_var.inner;
27416 if (ret_var.is_owned) {
27422 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
27423 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
27424 int64_t ret_ref = 0;
27425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27428 ret_ref = (uintptr_t)ret_var.inner;
27429 if (ret_var.is_owned) {
27434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27435 LDKDelayedPaymentOutputDescriptor arg_conv;
27436 arg_conv.inner = (void*)(arg & (~1));
27437 arg_conv.is_owned = false;
27438 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27439 int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
27443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27444 LDKDelayedPaymentOutputDescriptor orig_conv;
27445 orig_conv.inner = (void*)(orig & (~1));
27446 orig_conv.is_owned = false;
27447 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27448 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
27449 int64_t ret_ref = 0;
27450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27453 ret_ref = (uintptr_t)ret_var.inner;
27454 if (ret_var.is_owned) {
27460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27461 LDKDelayedPaymentOutputDescriptor obj_conv;
27462 obj_conv.inner = (void*)(obj & (~1));
27463 obj_conv.is_owned = false;
27464 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27465 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
27466 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27467 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27468 CVec_u8Z_free(ret_var);
27472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27473 LDKu8slice ser_ref;
27474 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27475 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27476 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
27477 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
27478 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27479 return (int64_t)ret_conv;
27482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27483 LDKStaticPaymentOutputDescriptor this_obj_conv;
27484 this_obj_conv.inner = (void*)(this_obj & (~1));
27485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27487 StaticPaymentOutputDescriptor_free(this_obj_conv);
27490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27491 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27493 this_ptr_conv.is_owned = false;
27494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27495 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27496 int64_t ret_ref = 0;
27497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27500 ret_ref = (uintptr_t)ret_var.inner;
27501 if (ret_var.is_owned) {
27507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27508 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27510 this_ptr_conv.is_owned = false;
27511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27512 LDKOutPoint val_conv;
27513 val_conv.inner = (void*)(val & (~1));
27514 val_conv.is_owned = (val & 1) || (val == 0);
27515 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27516 val_conv = OutPoint_clone(&val_conv);
27517 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27521 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27523 this_ptr_conv.is_owned = false;
27524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27525 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27526 CHECK_ACCESS(val_ptr);
27527 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27528 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
27529 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27533 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27535 this_ptr_conv.is_owned = false;
27536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27537 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27543 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27545 this_ptr_conv.is_owned = false;
27546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27547 LDKThirtyTwoBytes val_ref;
27548 CHECK((*env)->GetArrayLength(env, val) == 32);
27549 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27550 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27554 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27556 this_ptr_conv.is_owned = false;
27557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27558 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27563 LDKStaticPaymentOutputDescriptor this_ptr_conv;
27564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27565 this_ptr_conv.is_owned = false;
27566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27567 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27570 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) {
27571 LDKOutPoint outpoint_arg_conv;
27572 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
27573 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
27574 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27575 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27576 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
27577 CHECK_ACCESS(output_arg_ptr);
27578 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27579 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
27580 LDKThirtyTwoBytes channel_keys_id_arg_ref;
27581 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27582 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27583 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
27584 int64_t ret_ref = 0;
27585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27588 ret_ref = (uintptr_t)ret_var.inner;
27589 if (ret_var.is_owned) {
27595 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
27596 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
27597 int64_t ret_ref = 0;
27598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27601 ret_ref = (uintptr_t)ret_var.inner;
27602 if (ret_var.is_owned) {
27607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27608 LDKStaticPaymentOutputDescriptor arg_conv;
27609 arg_conv.inner = (void*)(arg & (~1));
27610 arg_conv.is_owned = false;
27611 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27612 int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27617 LDKStaticPaymentOutputDescriptor orig_conv;
27618 orig_conv.inner = (void*)(orig & (~1));
27619 orig_conv.is_owned = false;
27620 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27621 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27622 int64_t ret_ref = 0;
27623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27626 ret_ref = (uintptr_t)ret_var.inner;
27627 if (ret_var.is_owned) {
27633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27634 LDKStaticPaymentOutputDescriptor obj_conv;
27635 obj_conv.inner = (void*)(obj & (~1));
27636 obj_conv.is_owned = false;
27637 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27638 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27639 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27640 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27641 CVec_u8Z_free(ret_var);
27645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27646 LDKu8slice ser_ref;
27647 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27648 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27649 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27650 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27651 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27652 return (int64_t)ret_conv;
27655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27656 if ((this_ptr & 1) != 0) return;
27657 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27658 CHECK_ACCESS(this_ptr_ptr);
27659 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27660 FREE((void*)this_ptr);
27661 SpendableOutputDescriptor_free(this_ptr_conv);
27664 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27665 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27666 *ret_copy = SpendableOutputDescriptor_clone(arg);
27667 int64_t ret_ref = (uintptr_t)ret_copy;
27670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27671 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
27672 int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27677 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
27678 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27679 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27680 int64_t ret_ref = (uintptr_t)ret_copy;
27684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27685 LDKOutPoint outpoint_conv;
27686 outpoint_conv.inner = (void*)(outpoint & (~1));
27687 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
27688 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27689 outpoint_conv = OutPoint_clone(&outpoint_conv);
27690 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
27691 CHECK_ACCESS(output_ptr);
27692 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27693 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
27694 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27695 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27696 int64_t ret_ref = (uintptr_t)ret_copy;
27700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27701 LDKDelayedPaymentOutputDescriptor a_conv;
27702 a_conv.inner = (void*)(a & (~1));
27703 a_conv.is_owned = (a & 1) || (a == 0);
27704 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27705 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27706 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27707 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27708 int64_t ret_ref = (uintptr_t)ret_copy;
27712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27713 LDKStaticPaymentOutputDescriptor a_conv;
27714 a_conv.inner = (void*)(a & (~1));
27715 a_conv.is_owned = (a & 1) || (a == 0);
27716 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27717 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27718 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27719 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27720 int64_t ret_ref = (uintptr_t)ret_copy;
27724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27725 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
27726 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27727 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27728 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27729 CVec_u8Z_free(ret_var);
27733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27734 LDKu8slice ser_ref;
27735 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27736 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27737 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27738 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27739 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27740 return (int64_t)ret_conv;
27743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27744 if ((this_ptr & 1) != 0) return;
27745 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27746 CHECK_ACCESS(this_ptr_ptr);
27747 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27748 FREE((void*)this_ptr);
27749 BaseSign_free(this_ptr_conv);
27752 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27753 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27754 *ret_ret = Sign_clone(arg);
27755 return (int64_t)ret_ret;
27757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27758 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
27759 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
27760 LDKSign* arg_conv = (LDKSign*)arg_ptr;
27761 int64_t ret_conv = Sign_clone_ptr(arg_conv);
27765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27766 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
27767 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
27768 LDKSign* orig_conv = (LDKSign*)orig_ptr;
27769 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27770 *ret_ret = Sign_clone(orig_conv);
27771 return (int64_t)ret_ret;
27774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27775 if ((this_ptr & 1) != 0) return;
27776 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27777 CHECK_ACCESS(this_ptr_ptr);
27778 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27779 FREE((void*)this_ptr);
27780 Sign_free(this_ptr_conv);
27783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27784 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
27785 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27789 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27790 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27795 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27800 if ((this_ptr & 1) != 0) return;
27801 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27802 CHECK_ACCESS(this_ptr_ptr);
27803 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27804 FREE((void*)this_ptr);
27805 KeysInterface_free(this_ptr_conv);
27808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27809 LDKInMemorySigner this_obj_conv;
27810 this_obj_conv.inner = (void*)(this_obj & (~1));
27811 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27813 InMemorySigner_free(this_obj_conv);
27816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27817 LDKInMemorySigner this_ptr_conv;
27818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27819 this_ptr_conv.is_owned = false;
27820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27821 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27827 LDKInMemorySigner this_ptr_conv;
27828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27829 this_ptr_conv.is_owned = false;
27830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27831 LDKSecretKey val_ref;
27832 CHECK((*env)->GetArrayLength(env, val) == 32);
27833 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27834 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27838 LDKInMemorySigner this_ptr_conv;
27839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27840 this_ptr_conv.is_owned = false;
27841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27842 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27843 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27848 LDKInMemorySigner this_ptr_conv;
27849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27850 this_ptr_conv.is_owned = false;
27851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27852 LDKSecretKey val_ref;
27853 CHECK((*env)->GetArrayLength(env, val) == 32);
27854 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27855 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27859 LDKInMemorySigner this_ptr_conv;
27860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27861 this_ptr_conv.is_owned = false;
27862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27863 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27864 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27869 LDKInMemorySigner this_ptr_conv;
27870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27871 this_ptr_conv.is_owned = false;
27872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27873 LDKSecretKey val_ref;
27874 CHECK((*env)->GetArrayLength(env, val) == 32);
27875 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27876 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27880 LDKInMemorySigner this_ptr_conv;
27881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27882 this_ptr_conv.is_owned = false;
27883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27884 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27885 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27889 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) {
27890 LDKInMemorySigner this_ptr_conv;
27891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27892 this_ptr_conv.is_owned = false;
27893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27894 LDKSecretKey val_ref;
27895 CHECK((*env)->GetArrayLength(env, val) == 32);
27896 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27897 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27901 LDKInMemorySigner this_ptr_conv;
27902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27903 this_ptr_conv.is_owned = false;
27904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27905 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27906 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27911 LDKInMemorySigner this_ptr_conv;
27912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27913 this_ptr_conv.is_owned = false;
27914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27915 LDKSecretKey val_ref;
27916 CHECK((*env)->GetArrayLength(env, val) == 32);
27917 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27918 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27922 LDKInMemorySigner this_ptr_conv;
27923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27924 this_ptr_conv.is_owned = false;
27925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27926 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27927 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27932 LDKInMemorySigner this_ptr_conv;
27933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27934 this_ptr_conv.is_owned = false;
27935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27936 LDKThirtyTwoBytes val_ref;
27937 CHECK((*env)->GetArrayLength(env, val) == 32);
27938 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27939 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27942 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27943 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27944 int64_t ret_ref = 0;
27945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27948 ret_ref = (uintptr_t)ret_var.inner;
27949 if (ret_var.is_owned) {
27954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27955 LDKInMemorySigner arg_conv;
27956 arg_conv.inner = (void*)(arg & (~1));
27957 arg_conv.is_owned = false;
27958 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27959 int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
27963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27964 LDKInMemorySigner orig_conv;
27965 orig_conv.inner = (void*)(orig & (~1));
27966 orig_conv.is_owned = false;
27967 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27968 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27969 int64_t ret_ref = 0;
27970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27973 ret_ref = (uintptr_t)ret_var.inner;
27974 if (ret_var.is_owned) {
27980 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) {
27981 LDKSecretKey node_secret_ref;
27982 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27983 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27984 LDKSecretKey funding_key_ref;
27985 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27986 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27987 LDKSecretKey revocation_base_key_ref;
27988 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27989 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27990 LDKSecretKey payment_key_ref;
27991 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27992 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27993 LDKSecretKey delayed_payment_base_key_ref;
27994 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27995 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27996 LDKSecretKey htlc_base_key_ref;
27997 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27998 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27999 LDKThirtyTwoBytes commitment_seed_ref;
28000 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
28001 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
28002 LDKThirtyTwoBytes channel_keys_id_ref;
28003 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
28004 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
28005 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);
28006 int64_t ret_ref = 0;
28007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28010 ret_ref = (uintptr_t)ret_var.inner;
28011 if (ret_var.is_owned) {
28017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28018 LDKInMemorySigner this_arg_conv;
28019 this_arg_conv.inner = (void*)(this_arg & (~1));
28020 this_arg_conv.is_owned = false;
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28022 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
28023 int64_t ret_ref = 0;
28024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28027 ret_ref = (uintptr_t)ret_var.inner;
28028 if (ret_var.is_owned) {
28034 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28035 LDKInMemorySigner this_arg_conv;
28036 this_arg_conv.inner = (void*)(this_arg & (~1));
28037 this_arg_conv.is_owned = false;
28038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28039 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
28043 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28044 LDKInMemorySigner this_arg_conv;
28045 this_arg_conv.inner = (void*)(this_arg & (~1));
28046 this_arg_conv.is_owned = false;
28047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28048 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
28052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
28053 LDKInMemorySigner this_arg_conv;
28054 this_arg_conv.inner = (void*)(this_arg & (~1));
28055 this_arg_conv.is_owned = false;
28056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28057 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
28061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
28062 LDKInMemorySigner this_arg_conv;
28063 this_arg_conv.inner = (void*)(this_arg & (~1));
28064 this_arg_conv.is_owned = false;
28065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28066 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
28067 int64_t ret_ref = 0;
28068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28071 ret_ref = (uintptr_t)ret_var.inner;
28072 if (ret_var.is_owned) {
28078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
28079 LDKInMemorySigner this_arg_conv;
28080 this_arg_conv.inner = (void*)(this_arg & (~1));
28081 this_arg_conv.is_owned = false;
28082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28083 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
28084 int64_t ret_ref = 0;
28085 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28086 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28088 ret_ref = (uintptr_t)ret_var.inner;
28089 if (ret_var.is_owned) {
28095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
28096 LDKInMemorySigner this_arg_conv;
28097 this_arg_conv.inner = (void*)(this_arg & (~1));
28098 this_arg_conv.is_owned = false;
28099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28100 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
28104 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) {
28105 LDKInMemorySigner this_arg_conv;
28106 this_arg_conv.inner = (void*)(this_arg & (~1));
28107 this_arg_conv.is_owned = false;
28108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28109 LDKTransaction spend_tx_ref;
28110 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
28111 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
28112 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
28113 spend_tx_ref.data_is_owned = true;
28114 LDKStaticPaymentOutputDescriptor descriptor_conv;
28115 descriptor_conv.inner = (void*)(descriptor & (~1));
28116 descriptor_conv.is_owned = false;
28117 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
28118 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
28119 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
28120 return (int64_t)ret_conv;
28123 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) {
28124 LDKInMemorySigner this_arg_conv;
28125 this_arg_conv.inner = (void*)(this_arg & (~1));
28126 this_arg_conv.is_owned = false;
28127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28128 LDKTransaction spend_tx_ref;
28129 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
28130 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
28131 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
28132 spend_tx_ref.data_is_owned = true;
28133 LDKDelayedPaymentOutputDescriptor descriptor_conv;
28134 descriptor_conv.inner = (void*)(descriptor & (~1));
28135 descriptor_conv.is_owned = false;
28136 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
28137 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
28138 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
28139 return (int64_t)ret_conv;
28142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
28143 LDKInMemorySigner this_arg_conv;
28144 this_arg_conv.inner = (void*)(this_arg & (~1));
28145 this_arg_conv.is_owned = false;
28146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28147 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
28148 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
28149 return (int64_t)ret_ret;
28152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
28153 LDKInMemorySigner this_arg_conv;
28154 this_arg_conv.inner = (void*)(this_arg & (~1));
28155 this_arg_conv.is_owned = false;
28156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28157 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28158 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
28159 return (int64_t)ret_ret;
28162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
28163 LDKInMemorySigner obj_conv;
28164 obj_conv.inner = (void*)(obj & (~1));
28165 obj_conv.is_owned = false;
28166 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28167 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
28168 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28169 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28170 CVec_u8Z_free(ret_var);
28174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
28175 LDKu8slice ser_ref;
28176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28178 LDKSecretKey arg_ref;
28179 CHECK((*env)->GetArrayLength(env, arg) == 32);
28180 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
28181 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
28182 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
28183 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28184 return (int64_t)ret_conv;
28187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28188 LDKKeysManager this_obj_conv;
28189 this_obj_conv.inner = (void*)(this_obj & (~1));
28190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28192 KeysManager_free(this_obj_conv);
28195 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) {
28196 unsigned char seed_arr[32];
28197 CHECK((*env)->GetArrayLength(env, seed) == 32);
28198 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28199 unsigned char (*seed_ref)[32] = &seed_arr;
28200 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
28201 int64_t ret_ref = 0;
28202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28205 ret_ref = (uintptr_t)ret_var.inner;
28206 if (ret_var.is_owned) {
28212 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) {
28213 LDKKeysManager this_arg_conv;
28214 this_arg_conv.inner = (void*)(this_arg & (~1));
28215 this_arg_conv.is_owned = false;
28216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28217 unsigned char params_arr[32];
28218 CHECK((*env)->GetArrayLength(env, params) == 32);
28219 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28220 unsigned char (*params_ref)[32] = ¶ms_arr;
28221 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28222 int64_t ret_ref = 0;
28223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28226 ret_ref = (uintptr_t)ret_var.inner;
28227 if (ret_var.is_owned) {
28233 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) {
28234 LDKKeysManager this_arg_conv;
28235 this_arg_conv.inner = (void*)(this_arg & (~1));
28236 this_arg_conv.is_owned = false;
28237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28238 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28239 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28240 if (descriptors_constr.datalen > 0)
28241 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28243 descriptors_constr.data = NULL;
28244 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28245 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28246 int64_t descriptors_conv_27 = descriptors_vals[b];
28247 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
28248 CHECK_ACCESS(descriptors_conv_27_ptr);
28249 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28250 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
28251 descriptors_constr.data[b] = descriptors_conv_27_conv;
28253 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28254 LDKCVec_TxOutZ outputs_constr;
28255 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28256 if (outputs_constr.datalen > 0)
28257 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28259 outputs_constr.data = NULL;
28260 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28261 for (size_t h = 0; h < outputs_constr.datalen; h++) {
28262 int64_t outputs_conv_7 = outputs_vals[h];
28263 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
28264 CHECK_ACCESS(outputs_conv_7_ptr);
28265 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28266 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
28267 outputs_constr.data[h] = outputs_conv_7_conv;
28269 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28270 LDKCVec_u8Z change_destination_script_ref;
28271 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28272 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28273 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28274 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28275 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28276 return (int64_t)ret_conv;
28279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28280 LDKKeysManager this_arg_conv;
28281 this_arg_conv.inner = (void*)(this_arg & (~1));
28282 this_arg_conv.is_owned = false;
28283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28284 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28285 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
28286 return (int64_t)ret_ret;
28289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28290 LDKPhantomKeysManager this_obj_conv;
28291 this_obj_conv.inner = (void*)(this_obj & (~1));
28292 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28294 PhantomKeysManager_free(this_obj_conv);
28297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28298 LDKPhantomKeysManager this_arg_conv;
28299 this_arg_conv.inner = (void*)(this_arg & (~1));
28300 this_arg_conv.is_owned = false;
28301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28302 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28303 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
28304 return (int64_t)ret_ret;
28307 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) {
28308 unsigned char seed_arr[32];
28309 CHECK((*env)->GetArrayLength(env, seed) == 32);
28310 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28311 unsigned char (*seed_ref)[32] = &seed_arr;
28312 unsigned char cross_node_seed_arr[32];
28313 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
28314 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
28315 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
28316 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
28317 int64_t ret_ref = 0;
28318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28321 ret_ref = (uintptr_t)ret_var.inner;
28322 if (ret_var.is_owned) {
28328 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) {
28329 LDKPhantomKeysManager this_arg_conv;
28330 this_arg_conv.inner = (void*)(this_arg & (~1));
28331 this_arg_conv.is_owned = false;
28332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28333 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28334 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28335 if (descriptors_constr.datalen > 0)
28336 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28338 descriptors_constr.data = NULL;
28339 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28340 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28341 int64_t descriptors_conv_27 = descriptors_vals[b];
28342 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
28343 CHECK_ACCESS(descriptors_conv_27_ptr);
28344 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28345 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
28346 descriptors_constr.data[b] = descriptors_conv_27_conv;
28348 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28349 LDKCVec_TxOutZ outputs_constr;
28350 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28351 if (outputs_constr.datalen > 0)
28352 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28354 outputs_constr.data = NULL;
28355 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28356 for (size_t h = 0; h < outputs_constr.datalen; h++) {
28357 int64_t outputs_conv_7 = outputs_vals[h];
28358 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
28359 CHECK_ACCESS(outputs_conv_7_ptr);
28360 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28361 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
28362 outputs_constr.data[h] = outputs_conv_7_conv;
28364 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28365 LDKCVec_u8Z change_destination_script_ref;
28366 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28367 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28368 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28369 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28370 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28371 return (int64_t)ret_conv;
28374 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) {
28375 LDKPhantomKeysManager this_arg_conv;
28376 this_arg_conv.inner = (void*)(this_arg & (~1));
28377 this_arg_conv.is_owned = false;
28378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28379 unsigned char params_arr[32];
28380 CHECK((*env)->GetArrayLength(env, params) == 32);
28381 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28382 unsigned char (*params_ref)[32] = ¶ms_arr;
28383 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28384 int64_t ret_ref = 0;
28385 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28386 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28388 ret_ref = (uintptr_t)ret_var.inner;
28389 if (ret_var.is_owned) {
28395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28396 LDKChannelManager this_obj_conv;
28397 this_obj_conv.inner = (void*)(this_obj & (~1));
28398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28400 ChannelManager_free(this_obj_conv);
28403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28404 LDKChainParameters this_obj_conv;
28405 this_obj_conv.inner = (void*)(this_obj & (~1));
28406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28408 ChainParameters_free(this_obj_conv);
28411 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
28412 LDKChainParameters this_ptr_conv;
28413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28414 this_ptr_conv.is_owned = false;
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28416 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
28420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
28421 LDKChainParameters this_ptr_conv;
28422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28423 this_ptr_conv.is_owned = false;
28424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28425 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
28426 ChainParameters_set_network(&this_ptr_conv, val_conv);
28429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
28430 LDKChainParameters this_ptr_conv;
28431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28432 this_ptr_conv.is_owned = false;
28433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28434 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
28435 int64_t ret_ref = 0;
28436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28439 ret_ref = (uintptr_t)ret_var.inner;
28440 if (ret_var.is_owned) {
28446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28447 LDKChainParameters this_ptr_conv;
28448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28449 this_ptr_conv.is_owned = false;
28450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28451 LDKBestBlock val_conv;
28452 val_conv.inner = (void*)(val & (~1));
28453 val_conv.is_owned = (val & 1) || (val == 0);
28454 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28455 val_conv = BestBlock_clone(&val_conv);
28456 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
28459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
28460 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
28461 LDKBestBlock best_block_arg_conv;
28462 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
28463 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
28464 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
28465 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
28466 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
28467 int64_t ret_ref = 0;
28468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28471 ret_ref = (uintptr_t)ret_var.inner;
28472 if (ret_var.is_owned) {
28478 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
28479 LDKChainParameters ret_var = ChainParameters_clone(arg);
28480 int64_t ret_ref = 0;
28481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28484 ret_ref = (uintptr_t)ret_var.inner;
28485 if (ret_var.is_owned) {
28490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28491 LDKChainParameters arg_conv;
28492 arg_conv.inner = (void*)(arg & (~1));
28493 arg_conv.is_owned = false;
28494 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28495 int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
28499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28500 LDKChainParameters orig_conv;
28501 orig_conv.inner = (void*)(orig & (~1));
28502 orig_conv.is_owned = false;
28503 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28504 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
28505 int64_t ret_ref = 0;
28506 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28507 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28509 ret_ref = (uintptr_t)ret_var.inner;
28510 if (ret_var.is_owned) {
28516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28517 LDKCounterpartyForwardingInfo this_obj_conv;
28518 this_obj_conv.inner = (void*)(this_obj & (~1));
28519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28521 CounterpartyForwardingInfo_free(this_obj_conv);
28524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28525 LDKCounterpartyForwardingInfo this_ptr_conv;
28526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28527 this_ptr_conv.is_owned = false;
28528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28529 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
28533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28534 LDKCounterpartyForwardingInfo this_ptr_conv;
28535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28536 this_ptr_conv.is_owned = false;
28537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28538 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
28541 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28542 LDKCounterpartyForwardingInfo this_ptr_conv;
28543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28544 this_ptr_conv.is_owned = false;
28545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28546 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
28550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28551 LDKCounterpartyForwardingInfo this_ptr_conv;
28552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28553 this_ptr_conv.is_owned = false;
28554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28555 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
28558 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28559 LDKCounterpartyForwardingInfo this_ptr_conv;
28560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28561 this_ptr_conv.is_owned = false;
28562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28563 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
28567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28568 LDKCounterpartyForwardingInfo this_ptr_conv;
28569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28570 this_ptr_conv.is_owned = false;
28571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28572 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28575 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) {
28576 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
28577 int64_t ret_ref = 0;
28578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28581 ret_ref = (uintptr_t)ret_var.inner;
28582 if (ret_var.is_owned) {
28588 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
28589 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
28590 int64_t ret_ref = 0;
28591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28594 ret_ref = (uintptr_t)ret_var.inner;
28595 if (ret_var.is_owned) {
28600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28601 LDKCounterpartyForwardingInfo arg_conv;
28602 arg_conv.inner = (void*)(arg & (~1));
28603 arg_conv.is_owned = false;
28604 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28605 int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28610 LDKCounterpartyForwardingInfo orig_conv;
28611 orig_conv.inner = (void*)(orig & (~1));
28612 orig_conv.is_owned = false;
28613 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28614 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28615 int64_t ret_ref = 0;
28616 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28617 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28619 ret_ref = (uintptr_t)ret_var.inner;
28620 if (ret_var.is_owned) {
28626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28627 LDKChannelCounterparty this_obj_conv;
28628 this_obj_conv.inner = (void*)(this_obj & (~1));
28629 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28631 ChannelCounterparty_free(this_obj_conv);
28634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28635 LDKChannelCounterparty this_ptr_conv;
28636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28637 this_ptr_conv.is_owned = false;
28638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28639 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28645 LDKChannelCounterparty this_ptr_conv;
28646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28647 this_ptr_conv.is_owned = false;
28648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28649 LDKPublicKey val_ref;
28650 CHECK((*env)->GetArrayLength(env, val) == 33);
28651 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28652 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28656 LDKChannelCounterparty this_ptr_conv;
28657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28658 this_ptr_conv.is_owned = false;
28659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28660 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28661 int64_t ret_ref = 0;
28662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28665 ret_ref = (uintptr_t)ret_var.inner;
28666 if (ret_var.is_owned) {
28672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28673 LDKChannelCounterparty this_ptr_conv;
28674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28675 this_ptr_conv.is_owned = false;
28676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28677 LDKInitFeatures val_conv;
28678 val_conv.inner = (void*)(val & (~1));
28679 val_conv.is_owned = (val & 1) || (val == 0);
28680 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28681 val_conv = InitFeatures_clone(&val_conv);
28682 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28686 LDKChannelCounterparty this_ptr_conv;
28687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28688 this_ptr_conv.is_owned = false;
28689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28690 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28695 LDKChannelCounterparty this_ptr_conv;
28696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28697 this_ptr_conv.is_owned = false;
28698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28699 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28703 LDKChannelCounterparty this_ptr_conv;
28704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28705 this_ptr_conv.is_owned = false;
28706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28707 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28708 int64_t ret_ref = 0;
28709 if ((uintptr_t)ret_var.inner > 4096) {
28710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28713 ret_ref = (uintptr_t)ret_var.inner;
28714 if (ret_var.is_owned) {
28721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28722 LDKChannelCounterparty this_ptr_conv;
28723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28724 this_ptr_conv.is_owned = false;
28725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28726 LDKCounterpartyForwardingInfo val_conv;
28727 val_conv.inner = (void*)(val & (~1));
28728 val_conv.is_owned = (val & 1) || (val == 0);
28729 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28730 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28731 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28735 LDKChannelCounterparty this_ptr_conv;
28736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28737 this_ptr_conv.is_owned = false;
28738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28739 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28740 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
28741 int64_t ret_ref = (uintptr_t)ret_copy;
28745 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) {
28746 LDKChannelCounterparty this_ptr_conv;
28747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28748 this_ptr_conv.is_owned = false;
28749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28750 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28751 CHECK_ACCESS(val_ptr);
28752 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28753 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28754 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28758 LDKChannelCounterparty this_ptr_conv;
28759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28760 this_ptr_conv.is_owned = false;
28761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28762 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28763 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
28764 int64_t ret_ref = (uintptr_t)ret_copy;
28768 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) {
28769 LDKChannelCounterparty this_ptr_conv;
28770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28771 this_ptr_conv.is_owned = false;
28772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28773 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28774 CHECK_ACCESS(val_ptr);
28775 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28776 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28777 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28780 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) {
28781 LDKPublicKey node_id_arg_ref;
28782 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28783 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28784 LDKInitFeatures features_arg_conv;
28785 features_arg_conv.inner = (void*)(features_arg & (~1));
28786 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28787 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28788 features_arg_conv = InitFeatures_clone(&features_arg_conv);
28789 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28790 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
28791 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
28792 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28793 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28794 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
28795 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
28796 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
28797 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
28798 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
28799 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
28800 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
28801 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
28802 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);
28803 int64_t ret_ref = 0;
28804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28807 ret_ref = (uintptr_t)ret_var.inner;
28808 if (ret_var.is_owned) {
28814 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28815 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28816 int64_t ret_ref = 0;
28817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28820 ret_ref = (uintptr_t)ret_var.inner;
28821 if (ret_var.is_owned) {
28826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28827 LDKChannelCounterparty arg_conv;
28828 arg_conv.inner = (void*)(arg & (~1));
28829 arg_conv.is_owned = false;
28830 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28831 int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
28835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28836 LDKChannelCounterparty orig_conv;
28837 orig_conv.inner = (void*)(orig & (~1));
28838 orig_conv.is_owned = false;
28839 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28840 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28841 int64_t ret_ref = 0;
28842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28845 ret_ref = (uintptr_t)ret_var.inner;
28846 if (ret_var.is_owned) {
28852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28853 LDKChannelDetails this_obj_conv;
28854 this_obj_conv.inner = (void*)(this_obj & (~1));
28855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28857 ChannelDetails_free(this_obj_conv);
28860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28861 LDKChannelDetails this_ptr_conv;
28862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28863 this_ptr_conv.is_owned = false;
28864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28865 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28871 LDKChannelDetails this_ptr_conv;
28872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28873 this_ptr_conv.is_owned = false;
28874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28875 LDKThirtyTwoBytes val_ref;
28876 CHECK((*env)->GetArrayLength(env, val) == 32);
28877 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28878 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28882 LDKChannelDetails this_ptr_conv;
28883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28884 this_ptr_conv.is_owned = false;
28885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28886 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_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_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28899 LDKChannelDetails this_ptr_conv;
28900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28901 this_ptr_conv.is_owned = false;
28902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28903 LDKChannelCounterparty val_conv;
28904 val_conv.inner = (void*)(val & (~1));
28905 val_conv.is_owned = (val & 1) || (val == 0);
28906 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28907 val_conv = ChannelCounterparty_clone(&val_conv);
28908 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28912 LDKChannelDetails this_ptr_conv;
28913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28914 this_ptr_conv.is_owned = false;
28915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28916 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28917 int64_t ret_ref = 0;
28918 if ((uintptr_t)ret_var.inner > 4096) {
28919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28922 ret_ref = (uintptr_t)ret_var.inner;
28923 if (ret_var.is_owned) {
28930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28931 LDKChannelDetails this_ptr_conv;
28932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28933 this_ptr_conv.is_owned = false;
28934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28935 LDKOutPoint val_conv;
28936 val_conv.inner = (void*)(val & (~1));
28937 val_conv.is_owned = (val & 1) || (val == 0);
28938 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28939 val_conv = OutPoint_clone(&val_conv);
28940 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28944 LDKChannelDetails this_ptr_conv;
28945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28946 this_ptr_conv.is_owned = false;
28947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28948 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28949 int64_t ret_ref = 0;
28950 if ((uintptr_t)ret_var.inner > 4096) {
28951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28954 ret_ref = (uintptr_t)ret_var.inner;
28955 if (ret_var.is_owned) {
28962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28963 LDKChannelDetails this_ptr_conv;
28964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28965 this_ptr_conv.is_owned = false;
28966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28967 LDKChannelTypeFeatures val_conv;
28968 val_conv.inner = (void*)(val & (~1));
28969 val_conv.is_owned = (val & 1) || (val == 0);
28970 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28971 val_conv = ChannelTypeFeatures_clone(&val_conv);
28972 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28976 LDKChannelDetails this_ptr_conv;
28977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28978 this_ptr_conv.is_owned = false;
28979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28980 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28981 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28982 int64_t ret_ref = (uintptr_t)ret_copy;
28986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28987 LDKChannelDetails this_ptr_conv;
28988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28989 this_ptr_conv.is_owned = false;
28990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28991 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28992 CHECK_ACCESS(val_ptr);
28993 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28994 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28995 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28999 LDKChannelDetails this_ptr_conv;
29000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29001 this_ptr_conv.is_owned = false;
29002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29003 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29004 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
29005 int64_t ret_ref = (uintptr_t)ret_copy;
29009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29010 LDKChannelDetails this_ptr_conv;
29011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29012 this_ptr_conv.is_owned = false;
29013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29014 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29015 CHECK_ACCESS(val_ptr);
29016 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29017 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29018 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
29021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29022 LDKChannelDetails this_ptr_conv;
29023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29024 this_ptr_conv.is_owned = false;
29025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29026 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29027 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
29028 int64_t ret_ref = (uintptr_t)ret_copy;
29032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29033 LDKChannelDetails this_ptr_conv;
29034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29035 this_ptr_conv.is_owned = false;
29036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29037 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29038 CHECK_ACCESS(val_ptr);
29039 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29040 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29041 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
29044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29045 LDKChannelDetails this_ptr_conv;
29046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29047 this_ptr_conv.is_owned = false;
29048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29049 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
29053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29054 LDKChannelDetails this_ptr_conv;
29055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29056 this_ptr_conv.is_owned = false;
29057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29058 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
29061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
29062 LDKChannelDetails this_ptr_conv;
29063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29064 this_ptr_conv.is_owned = false;
29065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29066 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29067 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
29068 int64_t ret_ref = (uintptr_t)ret_copy;
29072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29073 LDKChannelDetails this_ptr_conv;
29074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29075 this_ptr_conv.is_owned = false;
29076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29077 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29078 CHECK_ACCESS(val_ptr);
29079 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29080 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29081 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
29084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29085 LDKChannelDetails this_ptr_conv;
29086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29087 this_ptr_conv.is_owned = false;
29088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29089 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
29093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29094 LDKChannelDetails this_ptr_conv;
29095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29096 this_ptr_conv.is_owned = false;
29097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29098 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
29101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29102 LDKChannelDetails this_ptr_conv;
29103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29104 this_ptr_conv.is_owned = false;
29105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29106 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
29110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29111 LDKChannelDetails this_ptr_conv;
29112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29113 this_ptr_conv.is_owned = false;
29114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29115 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
29118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29119 LDKChannelDetails this_ptr_conv;
29120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29121 this_ptr_conv.is_owned = false;
29122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29123 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
29127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29128 LDKChannelDetails this_ptr_conv;
29129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29130 this_ptr_conv.is_owned = false;
29131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29132 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
29135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29136 LDKChannelDetails this_ptr_conv;
29137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29138 this_ptr_conv.is_owned = false;
29139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29140 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
29144 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) {
29145 LDKChannelDetails this_ptr_conv;
29146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29147 this_ptr_conv.is_owned = false;
29148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29149 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
29152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29153 LDKChannelDetails this_ptr_conv;
29154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29155 this_ptr_conv.is_owned = false;
29156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29157 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
29161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29162 LDKChannelDetails this_ptr_conv;
29163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29164 this_ptr_conv.is_owned = false;
29165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29166 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
29169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
29170 LDKChannelDetails this_ptr_conv;
29171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29172 this_ptr_conv.is_owned = false;
29173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29174 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29175 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
29176 int64_t ret_ref = (uintptr_t)ret_copy;
29180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29181 LDKChannelDetails this_ptr_conv;
29182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29183 this_ptr_conv.is_owned = false;
29184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29185 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29186 CHECK_ACCESS(val_ptr);
29187 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29188 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
29189 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
29192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
29193 LDKChannelDetails this_ptr_conv;
29194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29195 this_ptr_conv.is_owned = false;
29196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29197 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
29198 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
29199 int64_t ret_ref = (uintptr_t)ret_copy;
29203 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) {
29204 LDKChannelDetails this_ptr_conv;
29205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29206 this_ptr_conv.is_owned = false;
29207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29208 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29209 CHECK_ACCESS(val_ptr);
29210 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
29211 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
29212 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
29215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(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 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
29224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29225 LDKChannelDetails this_ptr_conv;
29226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29227 this_ptr_conv.is_owned = false;
29228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29229 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
29232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
29233 LDKChannelDetails this_ptr_conv;
29234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29235 this_ptr_conv.is_owned = false;
29236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29237 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
29241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29242 LDKChannelDetails this_ptr_conv;
29243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29244 this_ptr_conv.is_owned = false;
29245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29246 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
29249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
29250 LDKChannelDetails this_ptr_conv;
29251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29252 this_ptr_conv.is_owned = false;
29253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29254 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
29258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean 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 ChannelDetails_set_is_usable(&this_ptr_conv, val);
29266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
29267 LDKChannelDetails this_ptr_conv;
29268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29269 this_ptr_conv.is_owned = false;
29270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29271 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
29275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29276 LDKChannelDetails this_ptr_conv;
29277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29278 this_ptr_conv.is_owned = false;
29279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29280 ChannelDetails_set_is_public(&this_ptr_conv, val);
29283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29284 LDKChannelDetails this_ptr_conv;
29285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29286 this_ptr_conv.is_owned = false;
29287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29288 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29289 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
29290 int64_t ret_ref = (uintptr_t)ret_copy;
29294 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) {
29295 LDKChannelDetails this_ptr_conv;
29296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29297 this_ptr_conv.is_owned = false;
29298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29299 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29300 CHECK_ACCESS(val_ptr);
29301 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29302 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29303 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29307 LDKChannelDetails this_ptr_conv;
29308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29309 this_ptr_conv.is_owned = false;
29310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29311 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29312 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
29313 int64_t ret_ref = (uintptr_t)ret_copy;
29317 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) {
29318 LDKChannelDetails this_ptr_conv;
29319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29320 this_ptr_conv.is_owned = false;
29321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29322 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29323 CHECK_ACCESS(val_ptr);
29324 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29325 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29326 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29329 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) {
29330 LDKThirtyTwoBytes channel_id_arg_ref;
29331 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29332 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29333 LDKChannelCounterparty counterparty_arg_conv;
29334 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
29335 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
29336 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
29337 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
29338 LDKOutPoint funding_txo_arg_conv;
29339 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
29340 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
29341 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
29342 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
29343 LDKChannelTypeFeatures channel_type_arg_conv;
29344 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
29345 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
29346 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
29347 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
29348 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
29349 CHECK_ACCESS(short_channel_id_arg_ptr);
29350 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
29351 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
29352 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
29353 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
29354 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
29355 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
29356 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
29357 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
29358 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
29359 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
29360 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
29361 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
29362 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
29363 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
29364 CHECK_ACCESS(confirmations_required_arg_ptr);
29365 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
29366 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
29367 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
29368 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
29369 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
29370 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
29371 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
29372 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
29373 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
29374 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
29375 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
29376 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
29377 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
29378 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
29379 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);
29380 int64_t ret_ref = 0;
29381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29384 ret_ref = (uintptr_t)ret_var.inner;
29385 if (ret_var.is_owned) {
29391 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
29392 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
29393 int64_t ret_ref = 0;
29394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29397 ret_ref = (uintptr_t)ret_var.inner;
29398 if (ret_var.is_owned) {
29403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29404 LDKChannelDetails arg_conv;
29405 arg_conv.inner = (void*)(arg & (~1));
29406 arg_conv.is_owned = false;
29407 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29408 int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
29412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29413 LDKChannelDetails orig_conv;
29414 orig_conv.inner = (void*)(orig & (~1));
29415 orig_conv.is_owned = false;
29416 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29417 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
29418 int64_t ret_ref = 0;
29419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29422 ret_ref = (uintptr_t)ret_var.inner;
29423 if (ret_var.is_owned) {
29429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29430 LDKChannelDetails this_arg_conv;
29431 this_arg_conv.inner = (void*)(this_arg & (~1));
29432 this_arg_conv.is_owned = false;
29433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29434 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29435 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
29436 int64_t ret_ref = (uintptr_t)ret_copy;
29440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29441 LDKChannelDetails this_arg_conv;
29442 this_arg_conv.inner = (void*)(this_arg & (~1));
29443 this_arg_conv.is_owned = false;
29444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29445 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29446 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
29447 int64_t ret_ref = (uintptr_t)ret_copy;
29451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29452 if ((this_ptr & 1) != 0) return;
29453 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
29454 CHECK_ACCESS(this_ptr_ptr);
29455 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
29456 FREE((void*)this_ptr);
29457 PaymentSendFailure_free(this_ptr_conv);
29460 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
29461 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29462 *ret_copy = PaymentSendFailure_clone(arg);
29463 int64_t ret_ref = (uintptr_t)ret_copy;
29466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29467 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
29468 int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
29472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29473 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
29474 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29475 *ret_copy = PaymentSendFailure_clone(orig_conv);
29476 int64_t ret_ref = (uintptr_t)ret_copy;
29480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
29481 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
29482 CHECK_ACCESS(a_ptr);
29483 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
29484 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
29485 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29486 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
29487 int64_t ret_ref = (uintptr_t)ret_copy;
29491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
29492 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
29493 a_constr.datalen = (*env)->GetArrayLength(env, a);
29494 if (a_constr.datalen > 0)
29495 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29497 a_constr.data = NULL;
29498 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29499 for (size_t w = 0; w < a_constr.datalen; w++) {
29500 int64_t a_conv_22 = a_vals[w];
29501 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
29502 CHECK_ACCESS(a_conv_22_ptr);
29503 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
29504 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
29505 a_constr.data[w] = a_conv_22_conv;
29507 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29508 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29509 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
29510 int64_t ret_ref = (uintptr_t)ret_copy;
29514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
29515 LDKCVec_APIErrorZ a_constr;
29516 a_constr.datalen = (*env)->GetArrayLength(env, a);
29517 if (a_constr.datalen > 0)
29518 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
29520 a_constr.data = NULL;
29521 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29522 for (size_t k = 0; k < a_constr.datalen; k++) {
29523 int64_t a_conv_10 = a_vals[k];
29524 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
29525 CHECK_ACCESS(a_conv_10_ptr);
29526 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
29527 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
29528 a_constr.data[k] = a_conv_10_conv;
29530 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29531 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29532 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
29533 int64_t ret_ref = (uintptr_t)ret_copy;
29537 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) {
29538 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
29539 results_constr.datalen = (*env)->GetArrayLength(env, results);
29540 if (results_constr.datalen > 0)
29541 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29543 results_constr.data = NULL;
29544 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
29545 for (size_t w = 0; w < results_constr.datalen; w++) {
29546 int64_t results_conv_22 = results_vals[w];
29547 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
29548 CHECK_ACCESS(results_conv_22_ptr);
29549 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
29550 results_constr.data[w] = results_conv_22_conv;
29552 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
29553 LDKRouteParameters failed_paths_retry_conv;
29554 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
29555 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
29556 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
29557 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
29558 LDKThirtyTwoBytes payment_id_ref;
29559 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29560 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29561 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29562 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
29563 int64_t ret_ref = (uintptr_t)ret_copy;
29567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29568 LDKPhantomRouteHints this_obj_conv;
29569 this_obj_conv.inner = (void*)(this_obj & (~1));
29570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29572 PhantomRouteHints_free(this_obj_conv);
29575 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
29576 LDKPhantomRouteHints this_ptr_conv;
29577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29578 this_ptr_conv.is_owned = false;
29579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29580 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
29581 int64_tArray ret_arr = NULL;
29582 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29583 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29584 for (size_t q = 0; q < ret_var.datalen; q++) {
29585 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29586 int64_t ret_conv_16_ref = 0;
29587 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29588 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29590 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29591 if (ret_conv_16_var.is_owned) {
29592 ret_conv_16_ref |= 1;
29594 ret_arr_ptr[q] = ret_conv_16_ref;
29596 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29597 FREE(ret_var.data);
29601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29602 LDKPhantomRouteHints 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 LDKCVec_ChannelDetailsZ val_constr;
29607 val_constr.datalen = (*env)->GetArrayLength(env, val);
29608 if (val_constr.datalen > 0)
29609 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29611 val_constr.data = NULL;
29612 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29613 for (size_t q = 0; q < val_constr.datalen; q++) {
29614 int64_t val_conv_16 = val_vals[q];
29615 LDKChannelDetails val_conv_16_conv;
29616 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
29617 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
29618 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
29619 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
29620 val_constr.data[q] = val_conv_16_conv;
29622 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29623 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
29626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
29627 LDKPhantomRouteHints this_ptr_conv;
29628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29629 this_ptr_conv.is_owned = false;
29630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29631 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
29635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29636 LDKPhantomRouteHints this_ptr_conv;
29637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29638 this_ptr_conv.is_owned = false;
29639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29640 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
29643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29644 LDKPhantomRouteHints this_ptr_conv;
29645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29646 this_ptr_conv.is_owned = false;
29647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29648 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29649 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
29653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29654 LDKPhantomRouteHints this_ptr_conv;
29655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29656 this_ptr_conv.is_owned = false;
29657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29658 LDKPublicKey val_ref;
29659 CHECK((*env)->GetArrayLength(env, val) == 33);
29660 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29661 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
29664 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) {
29665 LDKCVec_ChannelDetailsZ channels_arg_constr;
29666 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29667 if (channels_arg_constr.datalen > 0)
29668 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29670 channels_arg_constr.data = NULL;
29671 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29672 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
29673 int64_t channels_arg_conv_16 = channels_arg_vals[q];
29674 LDKChannelDetails channels_arg_conv_16_conv;
29675 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
29676 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
29677 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
29678 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
29679 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
29681 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29682 LDKPublicKey real_node_pubkey_arg_ref;
29683 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
29684 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
29685 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
29686 int64_t ret_ref = 0;
29687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29690 ret_ref = (uintptr_t)ret_var.inner;
29691 if (ret_var.is_owned) {
29697 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
29698 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
29699 int64_t ret_ref = 0;
29700 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29701 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29703 ret_ref = (uintptr_t)ret_var.inner;
29704 if (ret_var.is_owned) {
29709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29710 LDKPhantomRouteHints arg_conv;
29711 arg_conv.inner = (void*)(arg & (~1));
29712 arg_conv.is_owned = false;
29713 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29714 int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
29718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29719 LDKPhantomRouteHints orig_conv;
29720 orig_conv.inner = (void*)(orig & (~1));
29721 orig_conv.is_owned = false;
29722 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29723 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
29724 int64_t ret_ref = 0;
29725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29728 ret_ref = (uintptr_t)ret_var.inner;
29729 if (ret_var.is_owned) {
29735 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) {
29736 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
29737 CHECK_ACCESS(fee_est_ptr);
29738 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
29739 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
29740 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29741 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
29743 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
29744 CHECK_ACCESS(chain_monitor_ptr);
29745 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29746 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29747 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29748 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29750 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
29751 CHECK_ACCESS(tx_broadcaster_ptr);
29752 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29753 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29754 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29755 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29757 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
29758 CHECK_ACCESS(logger_ptr);
29759 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29760 if (logger_conv.free == LDKLogger_JCalls_free) {
29761 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29762 LDKLogger_JCalls_cloned(&logger_conv);
29764 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
29765 CHECK_ACCESS(keys_manager_ptr);
29766 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29767 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29768 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29769 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29771 LDKUserConfig config_conv;
29772 config_conv.inner = (void*)(config & (~1));
29773 config_conv.is_owned = (config & 1) || (config == 0);
29774 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29775 config_conv = UserConfig_clone(&config_conv);
29776 LDKChainParameters params_conv;
29777 params_conv.inner = (void*)(params & (~1));
29778 params_conv.is_owned = (params & 1) || (params == 0);
29779 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
29780 params_conv = ChainParameters_clone(¶ms_conv);
29781 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
29782 int64_t ret_ref = 0;
29783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29786 ret_ref = (uintptr_t)ret_var.inner;
29787 if (ret_var.is_owned) {
29793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
29794 LDKChannelManager this_arg_conv;
29795 this_arg_conv.inner = (void*)(this_arg & (~1));
29796 this_arg_conv.is_owned = false;
29797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29798 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
29799 int64_t ret_ref = 0;
29800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29803 ret_ref = (uintptr_t)ret_var.inner;
29804 if (ret_var.is_owned) {
29810 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) {
29811 LDKChannelManager this_arg_conv;
29812 this_arg_conv.inner = (void*)(this_arg & (~1));
29813 this_arg_conv.is_owned = false;
29814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29815 LDKPublicKey their_network_key_ref;
29816 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
29817 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
29818 LDKUserConfig override_config_conv;
29819 override_config_conv.inner = (void*)(override_config & (~1));
29820 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
29821 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
29822 override_config_conv = UserConfig_clone(&override_config_conv);
29823 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
29824 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
29825 return (int64_t)ret_conv;
29828 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29829 LDKChannelManager this_arg_conv;
29830 this_arg_conv.inner = (void*)(this_arg & (~1));
29831 this_arg_conv.is_owned = false;
29832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29833 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29834 int64_tArray ret_arr = NULL;
29835 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29836 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29837 for (size_t q = 0; q < ret_var.datalen; q++) {
29838 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29839 int64_t ret_conv_16_ref = 0;
29840 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29841 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29843 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29844 if (ret_conv_16_var.is_owned) {
29845 ret_conv_16_ref |= 1;
29847 ret_arr_ptr[q] = ret_conv_16_ref;
29849 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29850 FREE(ret_var.data);
29854 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29855 LDKChannelManager this_arg_conv;
29856 this_arg_conv.inner = (void*)(this_arg & (~1));
29857 this_arg_conv.is_owned = false;
29858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29859 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29860 int64_tArray ret_arr = NULL;
29861 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29862 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29863 for (size_t q = 0; q < ret_var.datalen; q++) {
29864 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29865 int64_t ret_conv_16_ref = 0;
29866 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29867 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29869 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29870 if (ret_conv_16_var.is_owned) {
29871 ret_conv_16_ref |= 1;
29873 ret_arr_ptr[q] = ret_conv_16_ref;
29875 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29876 FREE(ret_var.data);
29880 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) {
29881 LDKChannelManager this_arg_conv;
29882 this_arg_conv.inner = (void*)(this_arg & (~1));
29883 this_arg_conv.is_owned = false;
29884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29885 unsigned char channel_id_arr[32];
29886 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29887 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29888 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29889 LDKPublicKey counterparty_node_id_ref;
29890 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29891 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29892 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29893 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29894 return (int64_t)ret_conv;
29897 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) {
29898 LDKChannelManager this_arg_conv;
29899 this_arg_conv.inner = (void*)(this_arg & (~1));
29900 this_arg_conv.is_owned = false;
29901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29902 unsigned char channel_id_arr[32];
29903 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29904 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29905 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29906 LDKPublicKey counterparty_node_id_ref;
29907 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29908 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29909 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29910 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29911 return (int64_t)ret_conv;
29914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
29915 LDKChannelManager this_arg_conv;
29916 this_arg_conv.inner = (void*)(this_arg & (~1));
29917 this_arg_conv.is_owned = false;
29918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29919 unsigned char channel_id_arr[32];
29920 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29921 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29922 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29923 LDKPublicKey counterparty_node_id_ref;
29924 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29925 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29926 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29927 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29928 return (int64_t)ret_conv;
29931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29932 LDKChannelManager this_arg_conv;
29933 this_arg_conv.inner = (void*)(this_arg & (~1));
29934 this_arg_conv.is_owned = false;
29935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29936 ChannelManager_force_close_all_channels(&this_arg_conv);
29939 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) {
29940 LDKChannelManager this_arg_conv;
29941 this_arg_conv.inner = (void*)(this_arg & (~1));
29942 this_arg_conv.is_owned = false;
29943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29944 LDKRoute route_conv;
29945 route_conv.inner = (void*)(route & (~1));
29946 route_conv.is_owned = false;
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29948 LDKThirtyTwoBytes payment_hash_ref;
29949 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29950 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29951 LDKThirtyTwoBytes payment_secret_ref;
29952 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29953 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29954 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29955 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29956 return (int64_t)ret_conv;
29959 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) {
29960 LDKChannelManager this_arg_conv;
29961 this_arg_conv.inner = (void*)(this_arg & (~1));
29962 this_arg_conv.is_owned = false;
29963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29964 LDKRoute route_conv;
29965 route_conv.inner = (void*)(route & (~1));
29966 route_conv.is_owned = false;
29967 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29968 LDKThirtyTwoBytes payment_id_ref;
29969 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29970 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29971 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29972 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29973 return (int64_t)ret_conv;
29976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29977 LDKChannelManager this_arg_conv;
29978 this_arg_conv.inner = (void*)(this_arg & (~1));
29979 this_arg_conv.is_owned = false;
29980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29981 LDKThirtyTwoBytes payment_id_ref;
29982 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29983 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29984 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29987 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) {
29988 LDKChannelManager this_arg_conv;
29989 this_arg_conv.inner = (void*)(this_arg & (~1));
29990 this_arg_conv.is_owned = false;
29991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29992 LDKRoute route_conv;
29993 route_conv.inner = (void*)(route & (~1));
29994 route_conv.is_owned = false;
29995 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29996 LDKThirtyTwoBytes payment_preimage_ref;
29997 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29998 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29999 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
30000 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
30001 return (int64_t)ret_conv;
30004 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) {
30005 LDKChannelManager this_arg_conv;
30006 this_arg_conv.inner = (void*)(this_arg & (~1));
30007 this_arg_conv.is_owned = false;
30008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30009 unsigned char temporary_channel_id_arr[32];
30010 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30011 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30012 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30013 LDKPublicKey counterparty_node_id_ref;
30014 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30015 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30016 LDKTransaction funding_transaction_ref;
30017 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
30018 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
30019 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
30020 funding_transaction_ref.data_is_owned = true;
30021 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30022 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
30023 return (int64_t)ret_conv;
30026 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) {
30027 LDKChannelManager this_arg_conv;
30028 this_arg_conv.inner = (void*)(this_arg & (~1));
30029 this_arg_conv.is_owned = false;
30030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30031 LDKThreeBytes rgb_ref;
30032 CHECK((*env)->GetArrayLength(env, rgb) == 3);
30033 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
30034 LDKThirtyTwoBytes alias_ref;
30035 CHECK((*env)->GetArrayLength(env, alias) == 32);
30036 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
30037 LDKCVec_NetAddressZ addresses_constr;
30038 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
30039 if (addresses_constr.datalen > 0)
30040 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30042 addresses_constr.data = NULL;
30043 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
30044 for (size_t m = 0; m < addresses_constr.datalen; m++) {
30045 int64_t addresses_conv_12 = addresses_vals[m];
30046 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
30047 CHECK_ACCESS(addresses_conv_12_ptr);
30048 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
30049 addresses_constr.data[m] = addresses_conv_12_conv;
30051 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
30052 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
30055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
30056 LDKChannelManager this_arg_conv;
30057 this_arg_conv.inner = (void*)(this_arg & (~1));
30058 this_arg_conv.is_owned = false;
30059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30060 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
30063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
30064 LDKChannelManager this_arg_conv;
30065 this_arg_conv.inner = (void*)(this_arg & (~1));
30066 this_arg_conv.is_owned = false;
30067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30068 ChannelManager_timer_tick_occurred(&this_arg_conv);
30071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
30072 LDKChannelManager this_arg_conv;
30073 this_arg_conv.inner = (void*)(this_arg & (~1));
30074 this_arg_conv.is_owned = false;
30075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30076 unsigned char payment_hash_arr[32];
30077 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30078 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
30079 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
30080 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
30083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
30084 LDKChannelManager this_arg_conv;
30085 this_arg_conv.inner = (void*)(this_arg & (~1));
30086 this_arg_conv.is_owned = false;
30087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30088 LDKThirtyTwoBytes payment_preimage_ref;
30089 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
30090 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
30091 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
30094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
30095 LDKChannelManager this_arg_conv;
30096 this_arg_conv.inner = (void*)(this_arg & (~1));
30097 this_arg_conv.is_owned = false;
30098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30099 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30100 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
30104 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) {
30105 LDKChannelManager this_arg_conv;
30106 this_arg_conv.inner = (void*)(this_arg & (~1));
30107 this_arg_conv.is_owned = false;
30108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30109 unsigned char temporary_channel_id_arr[32];
30110 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30111 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30112 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30113 LDKPublicKey counterparty_node_id_ref;
30114 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30115 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30116 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30117 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
30118 return (int64_t)ret_conv;
30121 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) {
30122 LDKChannelManager this_arg_conv;
30123 this_arg_conv.inner = (void*)(this_arg & (~1));
30124 this_arg_conv.is_owned = false;
30125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30126 unsigned char temporary_channel_id_arr[32];
30127 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
30128 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
30129 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
30130 LDKPublicKey counterparty_node_id_ref;
30131 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30132 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30133 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30134 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
30135 return (int64_t)ret_conv;
30138 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) {
30139 LDKChannelManager this_arg_conv;
30140 this_arg_conv.inner = (void*)(this_arg & (~1));
30141 this_arg_conv.is_owned = false;
30142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30143 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30144 CHECK_ACCESS(min_value_msat_ptr);
30145 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30146 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30147 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30148 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30149 return (int64_t)ret_conv;
30152 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) {
30153 LDKChannelManager this_arg_conv;
30154 this_arg_conv.inner = (void*)(this_arg & (~1));
30155 this_arg_conv.is_owned = false;
30156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30157 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30158 CHECK_ACCESS(min_value_msat_ptr);
30159 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30160 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30161 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
30162 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30163 return (int64_t)ret_conv;
30166 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) {
30167 LDKChannelManager this_arg_conv;
30168 this_arg_conv.inner = (void*)(this_arg & (~1));
30169 this_arg_conv.is_owned = false;
30170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30171 LDKThirtyTwoBytes payment_hash_ref;
30172 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30173 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30174 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30175 CHECK_ACCESS(min_value_msat_ptr);
30176 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30177 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30178 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30179 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30180 return (int64_t)ret_conv;
30183 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) {
30184 LDKChannelManager this_arg_conv;
30185 this_arg_conv.inner = (void*)(this_arg & (~1));
30186 this_arg_conv.is_owned = false;
30187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30188 LDKThirtyTwoBytes payment_hash_ref;
30189 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30190 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30191 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30192 CHECK_ACCESS(min_value_msat_ptr);
30193 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30194 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30195 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
30196 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30197 return (int64_t)ret_conv;
30200 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) {
30201 LDKChannelManager this_arg_conv;
30202 this_arg_conv.inner = (void*)(this_arg & (~1));
30203 this_arg_conv.is_owned = false;
30204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30205 LDKThirtyTwoBytes payment_hash_ref;
30206 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30207 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30208 LDKThirtyTwoBytes payment_secret_ref;
30209 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30210 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30211 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
30212 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
30213 return (int64_t)ret_conv;
30216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30217 LDKChannelManager this_arg_conv;
30218 this_arg_conv.inner = (void*)(this_arg & (~1));
30219 this_arg_conv.is_owned = false;
30220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30221 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
30225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
30226 LDKChannelManager this_arg_conv;
30227 this_arg_conv.inner = (void*)(this_arg & (~1));
30228 this_arg_conv.is_owned = false;
30229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30230 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
30231 int64_t ret_ref = 0;
30232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30235 ret_ref = (uintptr_t)ret_var.inner;
30236 if (ret_var.is_owned) {
30242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30243 LDKChannelManager this_arg_conv;
30244 this_arg_conv.inner = (void*)(this_arg & (~1));
30245 this_arg_conv.is_owned = false;
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30247 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
30248 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
30249 return (int64_t)ret_ret;
30252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30253 LDKChannelManager this_arg_conv;
30254 this_arg_conv.inner = (void*)(this_arg & (~1));
30255 this_arg_conv.is_owned = false;
30256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30257 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30258 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
30259 return (int64_t)ret_ret;
30262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
30263 LDKChannelManager this_arg_conv;
30264 this_arg_conv.inner = (void*)(this_arg & (~1));
30265 this_arg_conv.is_owned = false;
30266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30267 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30268 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
30269 return (int64_t)ret_ret;
30272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
30273 LDKChannelManager this_arg_conv;
30274 this_arg_conv.inner = (void*)(this_arg & (~1));
30275 this_arg_conv.is_owned = false;
30276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30277 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30278 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
30279 return (int64_t)ret_ret;
30282 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) {
30283 LDKChannelManager this_arg_conv;
30284 this_arg_conv.inner = (void*)(this_arg & (~1));
30285 this_arg_conv.is_owned = false;
30286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30287 jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
30291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
30292 LDKChannelManager this_arg_conv;
30293 this_arg_conv.inner = (void*)(this_arg & (~1));
30294 this_arg_conv.is_owned = false;
30295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30296 ChannelManager_await_persistable_update(&this_arg_conv);
30299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
30300 LDKChannelManager this_arg_conv;
30301 this_arg_conv.inner = (void*)(this_arg & (~1));
30302 this_arg_conv.is_owned = false;
30303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30304 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
30305 int64_t ret_ref = 0;
30306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30309 ret_ref = (uintptr_t)ret_var.inner;
30310 if (ret_var.is_owned) {
30316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
30317 LDKChannelManager this_arg_conv;
30318 this_arg_conv.inner = (void*)(this_arg & (~1));
30319 this_arg_conv.is_owned = false;
30320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30321 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
30322 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
30323 return (int64_t)ret_ret;
30326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30327 LDKCounterpartyForwardingInfo obj_conv;
30328 obj_conv.inner = (void*)(obj & (~1));
30329 obj_conv.is_owned = false;
30330 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30331 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
30332 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30333 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30334 CVec_u8Z_free(ret_var);
30338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30339 LDKu8slice ser_ref;
30340 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30341 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30342 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30343 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
30344 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30345 return (int64_t)ret_conv;
30348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
30349 LDKChannelCounterparty obj_conv;
30350 obj_conv.inner = (void*)(obj & (~1));
30351 obj_conv.is_owned = false;
30352 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30353 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
30354 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30355 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30356 CVec_u8Z_free(ret_var);
30360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30361 LDKu8slice ser_ref;
30362 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30363 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30364 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30365 *ret_conv = ChannelCounterparty_read(ser_ref);
30366 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30367 return (int64_t)ret_conv;
30370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
30371 LDKChannelDetails obj_conv;
30372 obj_conv.inner = (void*)(obj & (~1));
30373 obj_conv.is_owned = false;
30374 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30375 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
30376 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30377 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30378 CVec_u8Z_free(ret_var);
30382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30383 LDKu8slice ser_ref;
30384 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30385 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30386 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30387 *ret_conv = ChannelDetails_read(ser_ref);
30388 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30389 return (int64_t)ret_conv;
30392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
30393 LDKPhantomRouteHints obj_conv;
30394 obj_conv.inner = (void*)(obj & (~1));
30395 obj_conv.is_owned = false;
30396 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30397 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
30398 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30399 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30400 CVec_u8Z_free(ret_var);
30404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30405 LDKu8slice ser_ref;
30406 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30407 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30408 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30409 *ret_conv = PhantomRouteHints_read(ser_ref);
30410 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30411 return (int64_t)ret_conv;
30414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
30415 LDKChannelManager obj_conv;
30416 obj_conv.inner = (void*)(obj & (~1));
30417 obj_conv.is_owned = false;
30418 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30419 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
30420 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30421 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30422 CVec_u8Z_free(ret_var);
30426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30427 LDKChannelManagerReadArgs this_obj_conv;
30428 this_obj_conv.inner = (void*)(this_obj & (~1));
30429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30431 ChannelManagerReadArgs_free(this_obj_conv);
30434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
30435 LDKChannelManagerReadArgs this_ptr_conv;
30436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30437 this_ptr_conv.is_owned = false;
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30439 // WARNING: This object doesn't live past this scope, needs clone!
30440 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
30444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30445 LDKChannelManagerReadArgs this_ptr_conv;
30446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30447 this_ptr_conv.is_owned = false;
30448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30449 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30450 CHECK_ACCESS(val_ptr);
30451 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
30452 if (val_conv.free == LDKKeysInterface_JCalls_free) {
30453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30454 LDKKeysInterface_JCalls_cloned(&val_conv);
30456 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
30459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
30460 LDKChannelManagerReadArgs this_ptr_conv;
30461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30462 this_ptr_conv.is_owned = false;
30463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30464 // WARNING: This object doesn't live past this scope, needs clone!
30465 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
30469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30470 LDKChannelManagerReadArgs this_ptr_conv;
30471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30472 this_ptr_conv.is_owned = false;
30473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30474 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30475 CHECK_ACCESS(val_ptr);
30476 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
30477 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
30478 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30479 LDKFeeEstimator_JCalls_cloned(&val_conv);
30481 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
30484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
30485 LDKChannelManagerReadArgs this_ptr_conv;
30486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30487 this_ptr_conv.is_owned = false;
30488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30489 // WARNING: This object doesn't live past this scope, needs clone!
30490 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
30494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30495 LDKChannelManagerReadArgs this_ptr_conv;
30496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30497 this_ptr_conv.is_owned = false;
30498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30499 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30500 CHECK_ACCESS(val_ptr);
30501 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
30502 if (val_conv.free == LDKWatch_JCalls_free) {
30503 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30504 LDKWatch_JCalls_cloned(&val_conv);
30506 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
30509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
30510 LDKChannelManagerReadArgs this_ptr_conv;
30511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30512 this_ptr_conv.is_owned = false;
30513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30514 // WARNING: This object doesn't live past this scope, needs clone!
30515 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
30519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30520 LDKChannelManagerReadArgs this_ptr_conv;
30521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30522 this_ptr_conv.is_owned = false;
30523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30524 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30525 CHECK_ACCESS(val_ptr);
30526 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
30527 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
30528 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30529 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
30531 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
30534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
30535 LDKChannelManagerReadArgs this_ptr_conv;
30536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30537 this_ptr_conv.is_owned = false;
30538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30539 // WARNING: This object doesn't live past this scope, needs clone!
30540 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
30544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30545 LDKChannelManagerReadArgs this_ptr_conv;
30546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30547 this_ptr_conv.is_owned = false;
30548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30549 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30550 CHECK_ACCESS(val_ptr);
30551 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30552 if (val_conv.free == LDKLogger_JCalls_free) {
30553 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30554 LDKLogger_JCalls_cloned(&val_conv);
30556 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30560 LDKChannelManagerReadArgs this_ptr_conv;
30561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30562 this_ptr_conv.is_owned = false;
30563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30564 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30565 int64_t ret_ref = 0;
30566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30569 ret_ref = (uintptr_t)ret_var.inner;
30570 if (ret_var.is_owned) {
30576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30577 LDKChannelManagerReadArgs this_ptr_conv;
30578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30579 this_ptr_conv.is_owned = false;
30580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30581 LDKUserConfig val_conv;
30582 val_conv.inner = (void*)(val & (~1));
30583 val_conv.is_owned = (val & 1) || (val == 0);
30584 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30585 val_conv = UserConfig_clone(&val_conv);
30586 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30589 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) {
30590 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30591 CHECK_ACCESS(keys_manager_ptr);
30592 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30593 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30594 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30595 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30597 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
30598 CHECK_ACCESS(fee_estimator_ptr);
30599 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30600 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30601 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30602 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30604 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
30605 CHECK_ACCESS(chain_monitor_ptr);
30606 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30607 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30608 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30609 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30611 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
30612 CHECK_ACCESS(tx_broadcaster_ptr);
30613 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30614 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30615 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30616 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30618 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
30619 CHECK_ACCESS(logger_ptr);
30620 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30621 if (logger_conv.free == LDKLogger_JCalls_free) {
30622 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30623 LDKLogger_JCalls_cloned(&logger_conv);
30625 LDKUserConfig default_config_conv;
30626 default_config_conv.inner = (void*)(default_config & (~1));
30627 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
30628 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30629 default_config_conv = UserConfig_clone(&default_config_conv);
30630 LDKCVec_ChannelMonitorZ channel_monitors_constr;
30631 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
30632 if (channel_monitors_constr.datalen > 0)
30633 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30635 channel_monitors_constr.data = NULL;
30636 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
30637 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30638 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30639 LDKChannelMonitor channel_monitors_conv_16_conv;
30640 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
30641 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
30642 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30643 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30645 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
30646 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);
30647 int64_t ret_ref = 0;
30648 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30649 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30651 ret_ref = (uintptr_t)ret_var.inner;
30652 if (ret_var.is_owned) {
30658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
30659 LDKu8slice ser_ref;
30660 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30661 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30662 LDKChannelManagerReadArgs arg_conv;
30663 arg_conv.inner = (void*)(arg & (~1));
30664 arg_conv.is_owned = (arg & 1) || (arg == 0);
30665 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30666 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30667 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30668 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30669 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30670 return (int64_t)ret_conv;
30673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30674 LDKExpandedKey this_obj_conv;
30675 this_obj_conv.inner = (void*)(this_obj & (~1));
30676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30678 ExpandedKey_free(this_obj_conv);
30681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
30682 unsigned char key_material_arr[32];
30683 CHECK((*env)->GetArrayLength(env, key_material) == 32);
30684 (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
30685 unsigned char (*key_material_ref)[32] = &key_material_arr;
30686 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30687 int64_t ret_ref = 0;
30688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30691 ret_ref = (uintptr_t)ret_var.inner;
30692 if (ret_var.is_owned) {
30698 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) {
30699 LDKExpandedKey keys_conv;
30700 keys_conv.inner = (void*)(keys & (~1));
30701 keys_conv.is_owned = false;
30702 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30703 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30704 CHECK_ACCESS(min_value_msat_ptr);
30705 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30706 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30707 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30708 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
30709 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
30710 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30711 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
30712 return (int64_t)ret_conv;
30715 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) {
30716 LDKExpandedKey keys_conv;
30717 keys_conv.inner = (void*)(keys & (~1));
30718 keys_conv.is_owned = false;
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30720 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
30721 CHECK_ACCESS(min_value_msat_ptr);
30722 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30723 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
30724 LDKThirtyTwoBytes payment_hash_ref;
30725 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30726 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30727 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30728 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
30729 return (int64_t)ret_conv;
30732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30733 LDKDecodeError this_obj_conv;
30734 this_obj_conv.inner = (void*)(this_obj & (~1));
30735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30737 DecodeError_free(this_obj_conv);
30740 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30741 LDKDecodeError ret_var = DecodeError_clone(arg);
30742 int64_t ret_ref = 0;
30743 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30744 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30746 ret_ref = (uintptr_t)ret_var.inner;
30747 if (ret_var.is_owned) {
30752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30753 LDKDecodeError arg_conv;
30754 arg_conv.inner = (void*)(arg & (~1));
30755 arg_conv.is_owned = false;
30756 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30757 int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
30761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30762 LDKDecodeError orig_conv;
30763 orig_conv.inner = (void*)(orig & (~1));
30764 orig_conv.is_owned = false;
30765 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30766 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
30767 int64_t ret_ref = 0;
30768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30771 ret_ref = (uintptr_t)ret_var.inner;
30772 if (ret_var.is_owned) {
30778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30779 LDKInit this_obj_conv;
30780 this_obj_conv.inner = (void*)(this_obj & (~1));
30781 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30783 Init_free(this_obj_conv);
30786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30787 LDKInit this_ptr_conv;
30788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30789 this_ptr_conv.is_owned = false;
30790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30791 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30792 int64_t ret_ref = 0;
30793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30796 ret_ref = (uintptr_t)ret_var.inner;
30797 if (ret_var.is_owned) {
30803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30804 LDKInit this_ptr_conv;
30805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30806 this_ptr_conv.is_owned = false;
30807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30808 LDKInitFeatures val_conv;
30809 val_conv.inner = (void*)(val & (~1));
30810 val_conv.is_owned = (val & 1) || (val == 0);
30811 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30812 val_conv = InitFeatures_clone(&val_conv);
30813 Init_set_features(&this_ptr_conv, val_conv);
30816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
30817 LDKInit this_ptr_conv;
30818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30819 this_ptr_conv.is_owned = false;
30820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30821 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30822 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30823 int64_t ret_ref = (uintptr_t)ret_copy;
30827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30828 LDKInit this_ptr_conv;
30829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30830 this_ptr_conv.is_owned = false;
30831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30832 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30833 CHECK_ACCESS(val_ptr);
30834 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30835 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
30836 Init_set_remote_network_address(&this_ptr_conv, val_conv);
30839 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) {
30840 LDKInitFeatures features_arg_conv;
30841 features_arg_conv.inner = (void*)(features_arg & (~1));
30842 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
30843 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30844 features_arg_conv = InitFeatures_clone(&features_arg_conv);
30845 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
30846 CHECK_ACCESS(remote_network_address_arg_ptr);
30847 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30848 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30849 int64_t ret_ref = 0;
30850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30853 ret_ref = (uintptr_t)ret_var.inner;
30854 if (ret_var.is_owned) {
30860 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30861 LDKInit ret_var = Init_clone(arg);
30862 int64_t ret_ref = 0;
30863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30866 ret_ref = (uintptr_t)ret_var.inner;
30867 if (ret_var.is_owned) {
30872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30874 arg_conv.inner = (void*)(arg & (~1));
30875 arg_conv.is_owned = false;
30876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30877 int64_t ret_conv = Init_clone_ptr(&arg_conv);
30881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30883 orig_conv.inner = (void*)(orig & (~1));
30884 orig_conv.is_owned = false;
30885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30886 LDKInit ret_var = Init_clone(&orig_conv);
30887 int64_t ret_ref = 0;
30888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30891 ret_ref = (uintptr_t)ret_var.inner;
30892 if (ret_var.is_owned) {
30898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30899 LDKErrorMessage this_obj_conv;
30900 this_obj_conv.inner = (void*)(this_obj & (~1));
30901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30903 ErrorMessage_free(this_obj_conv);
30906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30907 LDKErrorMessage this_ptr_conv;
30908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30909 this_ptr_conv.is_owned = false;
30910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30911 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30917 LDKErrorMessage this_ptr_conv;
30918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30919 this_ptr_conv.is_owned = false;
30920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30921 LDKThirtyTwoBytes val_ref;
30922 CHECK((*env)->GetArrayLength(env, val) == 32);
30923 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30924 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30927 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30928 LDKErrorMessage this_ptr_conv;
30929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30930 this_ptr_conv.is_owned = false;
30931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30932 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30933 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30939 LDKErrorMessage this_ptr_conv;
30940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30941 this_ptr_conv.is_owned = false;
30942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30943 LDKStr val_conv = java_to_owned_str(env, val);
30944 ErrorMessage_set_data(&this_ptr_conv, val_conv);
30947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30948 LDKThirtyTwoBytes channel_id_arg_ref;
30949 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30950 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30951 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30952 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30953 int64_t ret_ref = 0;
30954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30957 ret_ref = (uintptr_t)ret_var.inner;
30958 if (ret_var.is_owned) {
30964 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30965 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30966 int64_t ret_ref = 0;
30967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30970 ret_ref = (uintptr_t)ret_var.inner;
30971 if (ret_var.is_owned) {
30976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30977 LDKErrorMessage arg_conv;
30978 arg_conv.inner = (void*)(arg & (~1));
30979 arg_conv.is_owned = false;
30980 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30981 int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30986 LDKErrorMessage orig_conv;
30987 orig_conv.inner = (void*)(orig & (~1));
30988 orig_conv.is_owned = false;
30989 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30990 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30991 int64_t ret_ref = 0;
30992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30995 ret_ref = (uintptr_t)ret_var.inner;
30996 if (ret_var.is_owned) {
31002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31003 LDKWarningMessage this_obj_conv;
31004 this_obj_conv.inner = (void*)(this_obj & (~1));
31005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31007 WarningMessage_free(this_obj_conv);
31010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31011 LDKWarningMessage this_ptr_conv;
31012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31013 this_ptr_conv.is_owned = false;
31014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31015 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31016 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
31020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31021 LDKWarningMessage this_ptr_conv;
31022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31023 this_ptr_conv.is_owned = false;
31024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31025 LDKThirtyTwoBytes val_ref;
31026 CHECK((*env)->GetArrayLength(env, val) == 32);
31027 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31028 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
31031 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
31032 LDKWarningMessage this_ptr_conv;
31033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31034 this_ptr_conv.is_owned = false;
31035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31036 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
31037 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
31043 LDKWarningMessage this_ptr_conv;
31044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31045 this_ptr_conv.is_owned = false;
31046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31047 LDKStr val_conv = java_to_owned_str(env, val);
31048 WarningMessage_set_data(&this_ptr_conv, val_conv);
31051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
31052 LDKThirtyTwoBytes channel_id_arg_ref;
31053 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31054 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31055 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
31056 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
31057 int64_t ret_ref = 0;
31058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31061 ret_ref = (uintptr_t)ret_var.inner;
31062 if (ret_var.is_owned) {
31068 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
31069 LDKWarningMessage ret_var = WarningMessage_clone(arg);
31070 int64_t ret_ref = 0;
31071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31074 ret_ref = (uintptr_t)ret_var.inner;
31075 if (ret_var.is_owned) {
31080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31081 LDKWarningMessage arg_conv;
31082 arg_conv.inner = (void*)(arg & (~1));
31083 arg_conv.is_owned = false;
31084 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31085 int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
31089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31090 LDKWarningMessage orig_conv;
31091 orig_conv.inner = (void*)(orig & (~1));
31092 orig_conv.is_owned = false;
31093 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31094 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
31095 int64_t ret_ref = 0;
31096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31099 ret_ref = (uintptr_t)ret_var.inner;
31100 if (ret_var.is_owned) {
31106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31107 LDKPing this_obj_conv;
31108 this_obj_conv.inner = (void*)(this_obj & (~1));
31109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31111 Ping_free(this_obj_conv);
31114 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31115 LDKPing this_ptr_conv;
31116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31117 this_ptr_conv.is_owned = false;
31118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31119 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
31123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31124 LDKPing this_ptr_conv;
31125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31126 this_ptr_conv.is_owned = false;
31127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31128 Ping_set_ponglen(&this_ptr_conv, val);
31131 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31132 LDKPing this_ptr_conv;
31133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31134 this_ptr_conv.is_owned = false;
31135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31136 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
31140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31141 LDKPing this_ptr_conv;
31142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31143 this_ptr_conv.is_owned = false;
31144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31145 Ping_set_byteslen(&this_ptr_conv, val);
31148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
31149 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
31150 int64_t ret_ref = 0;
31151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31154 ret_ref = (uintptr_t)ret_var.inner;
31155 if (ret_var.is_owned) {
31161 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
31162 LDKPing ret_var = Ping_clone(arg);
31163 int64_t ret_ref = 0;
31164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31167 ret_ref = (uintptr_t)ret_var.inner;
31168 if (ret_var.is_owned) {
31173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31175 arg_conv.inner = (void*)(arg & (~1));
31176 arg_conv.is_owned = false;
31177 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31178 int64_t ret_conv = Ping_clone_ptr(&arg_conv);
31182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31184 orig_conv.inner = (void*)(orig & (~1));
31185 orig_conv.is_owned = false;
31186 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31187 LDKPing ret_var = Ping_clone(&orig_conv);
31188 int64_t ret_ref = 0;
31189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31192 ret_ref = (uintptr_t)ret_var.inner;
31193 if (ret_var.is_owned) {
31199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31200 LDKPong this_obj_conv;
31201 this_obj_conv.inner = (void*)(this_obj & (~1));
31202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31204 Pong_free(this_obj_conv);
31207 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31208 LDKPong this_ptr_conv;
31209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31210 this_ptr_conv.is_owned = false;
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31212 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
31216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31217 LDKPong this_ptr_conv;
31218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31219 this_ptr_conv.is_owned = false;
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31221 Pong_set_byteslen(&this_ptr_conv, val);
31224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
31225 LDKPong ret_var = Pong_new(byteslen_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) {
31237 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
31238 LDKPong ret_var = Pong_clone(arg);
31239 int64_t ret_ref = 0;
31240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31243 ret_ref = (uintptr_t)ret_var.inner;
31244 if (ret_var.is_owned) {
31249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31251 arg_conv.inner = (void*)(arg & (~1));
31252 arg_conv.is_owned = false;
31253 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31254 int64_t ret_conv = Pong_clone_ptr(&arg_conv);
31258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31260 orig_conv.inner = (void*)(orig & (~1));
31261 orig_conv.is_owned = false;
31262 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31263 LDKPong ret_var = Pong_clone(&orig_conv);
31264 int64_t ret_ref = 0;
31265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31268 ret_ref = (uintptr_t)ret_var.inner;
31269 if (ret_var.is_owned) {
31275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31276 LDKOpenChannel this_obj_conv;
31277 this_obj_conv.inner = (void*)(this_obj & (~1));
31278 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31280 OpenChannel_free(this_obj_conv);
31283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31284 LDKOpenChannel this_ptr_conv;
31285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31286 this_ptr_conv.is_owned = false;
31287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31288 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31289 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
31293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31294 LDKOpenChannel this_ptr_conv;
31295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31296 this_ptr_conv.is_owned = false;
31297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31298 LDKThirtyTwoBytes val_ref;
31299 CHECK((*env)->GetArrayLength(env, val) == 32);
31300 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31301 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
31304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31305 LDKOpenChannel this_ptr_conv;
31306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31307 this_ptr_conv.is_owned = false;
31308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31309 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31310 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
31314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31315 LDKOpenChannel this_ptr_conv;
31316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31317 this_ptr_conv.is_owned = false;
31318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31319 LDKThirtyTwoBytes val_ref;
31320 CHECK((*env)->GetArrayLength(env, val) == 32);
31321 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31322 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31326 LDKOpenChannel this_ptr_conv;
31327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31328 this_ptr_conv.is_owned = false;
31329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31330 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
31334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31335 LDKOpenChannel this_ptr_conv;
31336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31337 this_ptr_conv.is_owned = false;
31338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31339 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
31342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31343 LDKOpenChannel this_ptr_conv;
31344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31345 this_ptr_conv.is_owned = false;
31346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31347 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
31351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31352 LDKOpenChannel this_ptr_conv;
31353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31354 this_ptr_conv.is_owned = false;
31355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31356 OpenChannel_set_push_msat(&this_ptr_conv, val);
31359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31360 LDKOpenChannel this_ptr_conv;
31361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31362 this_ptr_conv.is_owned = false;
31363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31364 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
31368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31369 LDKOpenChannel this_ptr_conv;
31370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31371 this_ptr_conv.is_owned = false;
31372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31373 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31376 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) {
31377 LDKOpenChannel this_ptr_conv;
31378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31379 this_ptr_conv.is_owned = false;
31380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31381 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31385 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) {
31386 LDKOpenChannel this_ptr_conv;
31387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31388 this_ptr_conv.is_owned = false;
31389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31390 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31394 LDKOpenChannel this_ptr_conv;
31395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31396 this_ptr_conv.is_owned = false;
31397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31398 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31403 LDKOpenChannel this_ptr_conv;
31404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31405 this_ptr_conv.is_owned = false;
31406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31407 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31411 LDKOpenChannel this_ptr_conv;
31412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31413 this_ptr_conv.is_owned = false;
31414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31415 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
31419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31420 LDKOpenChannel this_ptr_conv;
31421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31422 this_ptr_conv.is_owned = false;
31423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31424 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31427 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31428 LDKOpenChannel this_ptr_conv;
31429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31430 this_ptr_conv.is_owned = false;
31431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31432 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31437 LDKOpenChannel this_ptr_conv;
31438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31439 this_ptr_conv.is_owned = false;
31440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31441 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31444 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31445 LDKOpenChannel this_ptr_conv;
31446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31447 this_ptr_conv.is_owned = false;
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31449 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31454 LDKOpenChannel this_ptr_conv;
31455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31456 this_ptr_conv.is_owned = false;
31457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31458 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31461 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31462 LDKOpenChannel this_ptr_conv;
31463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31464 this_ptr_conv.is_owned = false;
31465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31466 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31471 LDKOpenChannel this_ptr_conv;
31472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31473 this_ptr_conv.is_owned = false;
31474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31475 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31479 LDKOpenChannel 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31484 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31489 LDKOpenChannel this_ptr_conv;
31490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31491 this_ptr_conv.is_owned = false;
31492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31493 LDKPublicKey val_ref;
31494 CHECK((*env)->GetArrayLength(env, val) == 33);
31495 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31496 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31500 LDKOpenChannel this_ptr_conv;
31501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31502 this_ptr_conv.is_owned = false;
31503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31504 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31510 LDKOpenChannel this_ptr_conv;
31511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31512 this_ptr_conv.is_owned = false;
31513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31514 LDKPublicKey val_ref;
31515 CHECK((*env)->GetArrayLength(env, val) == 33);
31516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31517 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31521 LDKOpenChannel this_ptr_conv;
31522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31523 this_ptr_conv.is_owned = false;
31524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31525 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31526 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
31530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31531 LDKOpenChannel this_ptr_conv;
31532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31533 this_ptr_conv.is_owned = false;
31534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31535 LDKPublicKey val_ref;
31536 CHECK((*env)->GetArrayLength(env, val) == 33);
31537 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31538 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31542 LDKOpenChannel this_ptr_conv;
31543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31544 this_ptr_conv.is_owned = false;
31545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31546 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31547 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31552 LDKOpenChannel this_ptr_conv;
31553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31554 this_ptr_conv.is_owned = false;
31555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31556 LDKPublicKey val_ref;
31557 CHECK((*env)->GetArrayLength(env, val) == 33);
31558 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31559 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31563 LDKOpenChannel this_ptr_conv;
31564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31565 this_ptr_conv.is_owned = false;
31566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31567 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31568 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31573 LDKOpenChannel this_ptr_conv;
31574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31575 this_ptr_conv.is_owned = false;
31576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31577 LDKPublicKey val_ref;
31578 CHECK((*env)->GetArrayLength(env, val) == 33);
31579 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31580 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31584 LDKOpenChannel this_ptr_conv;
31585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31586 this_ptr_conv.is_owned = false;
31587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31588 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31593 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) {
31594 LDKOpenChannel this_ptr_conv;
31595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31596 this_ptr_conv.is_owned = false;
31597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31598 LDKPublicKey val_ref;
31599 CHECK((*env)->GetArrayLength(env, val) == 33);
31600 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31601 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31604 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31605 LDKOpenChannel this_ptr_conv;
31606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31607 this_ptr_conv.is_owned = false;
31608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31609 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31614 LDKOpenChannel this_ptr_conv;
31615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31616 this_ptr_conv.is_owned = false;
31617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31618 OpenChannel_set_channel_flags(&this_ptr_conv, val);
31621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31622 LDKOpenChannel this_ptr_conv;
31623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31624 this_ptr_conv.is_owned = false;
31625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31626 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31627 int64_t ret_ref = 0;
31628 if ((uintptr_t)ret_var.inner > 4096) {
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) {
31640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31641 LDKOpenChannel this_ptr_conv;
31642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31643 this_ptr_conv.is_owned = false;
31644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31645 LDKChannelTypeFeatures val_conv;
31646 val_conv.inner = (void*)(val & (~1));
31647 val_conv.is_owned = (val & 1) || (val == 0);
31648 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31649 val_conv = ChannelTypeFeatures_clone(&val_conv);
31650 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31653 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31654 LDKOpenChannel ret_var = OpenChannel_clone(arg);
31655 int64_t ret_ref = 0;
31656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31659 ret_ref = (uintptr_t)ret_var.inner;
31660 if (ret_var.is_owned) {
31665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31666 LDKOpenChannel arg_conv;
31667 arg_conv.inner = (void*)(arg & (~1));
31668 arg_conv.is_owned = false;
31669 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31670 int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31675 LDKOpenChannel orig_conv;
31676 orig_conv.inner = (void*)(orig & (~1));
31677 orig_conv.is_owned = false;
31678 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31679 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31680 int64_t ret_ref = 0;
31681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31684 ret_ref = (uintptr_t)ret_var.inner;
31685 if (ret_var.is_owned) {
31691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31692 LDKAcceptChannel this_obj_conv;
31693 this_obj_conv.inner = (void*)(this_obj & (~1));
31694 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31696 AcceptChannel_free(this_obj_conv);
31699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31700 LDKAcceptChannel this_ptr_conv;
31701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31702 this_ptr_conv.is_owned = false;
31703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31704 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31705 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
31709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31710 LDKAcceptChannel this_ptr_conv;
31711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31712 this_ptr_conv.is_owned = false;
31713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31714 LDKThirtyTwoBytes val_ref;
31715 CHECK((*env)->GetArrayLength(env, val) == 32);
31716 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31717 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31721 LDKAcceptChannel this_ptr_conv;
31722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31723 this_ptr_conv.is_owned = false;
31724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31730 LDKAcceptChannel this_ptr_conv;
31731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31732 this_ptr_conv.is_owned = false;
31733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31734 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31737 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) {
31738 LDKAcceptChannel this_ptr_conv;
31739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31740 this_ptr_conv.is_owned = false;
31741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31742 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31746 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) {
31747 LDKAcceptChannel this_ptr_conv;
31748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31749 this_ptr_conv.is_owned = false;
31750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31751 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31755 LDKAcceptChannel this_ptr_conv;
31756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31757 this_ptr_conv.is_owned = false;
31758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31759 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31764 LDKAcceptChannel this_ptr_conv;
31765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31766 this_ptr_conv.is_owned = false;
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31768 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31772 LDKAcceptChannel this_ptr_conv;
31773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31774 this_ptr_conv.is_owned = false;
31775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31776 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31781 LDKAcceptChannel this_ptr_conv;
31782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31783 this_ptr_conv.is_owned = false;
31784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31785 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31788 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
31789 LDKAcceptChannel this_ptr_conv;
31790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31791 this_ptr_conv.is_owned = false;
31792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31793 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31798 LDKAcceptChannel this_ptr_conv;
31799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31800 this_ptr_conv.is_owned = false;
31801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31802 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31805 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31806 LDKAcceptChannel this_ptr_conv;
31807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31808 this_ptr_conv.is_owned = false;
31809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31810 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31815 LDKAcceptChannel this_ptr_conv;
31816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31817 this_ptr_conv.is_owned = false;
31818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31819 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31822 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31823 LDKAcceptChannel this_ptr_conv;
31824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31825 this_ptr_conv.is_owned = false;
31826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31827 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31832 LDKAcceptChannel this_ptr_conv;
31833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31834 this_ptr_conv.is_owned = false;
31835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31836 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31840 LDKAcceptChannel this_ptr_conv;
31841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31842 this_ptr_conv.is_owned = false;
31843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31844 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31845 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31850 LDKAcceptChannel this_ptr_conv;
31851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31852 this_ptr_conv.is_owned = false;
31853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31854 LDKPublicKey val_ref;
31855 CHECK((*env)->GetArrayLength(env, val) == 33);
31856 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31857 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31861 LDKAcceptChannel this_ptr_conv;
31862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31863 this_ptr_conv.is_owned = false;
31864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31865 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31871 LDKAcceptChannel this_ptr_conv;
31872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31873 this_ptr_conv.is_owned = false;
31874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31875 LDKPublicKey val_ref;
31876 CHECK((*env)->GetArrayLength(env, val) == 33);
31877 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31878 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31882 LDKAcceptChannel this_ptr_conv;
31883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31884 this_ptr_conv.is_owned = false;
31885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31886 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31887 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
31891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31892 LDKAcceptChannel this_ptr_conv;
31893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31894 this_ptr_conv.is_owned = false;
31895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31896 LDKPublicKey val_ref;
31897 CHECK((*env)->GetArrayLength(env, val) == 33);
31898 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31899 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31903 LDKAcceptChannel this_ptr_conv;
31904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31905 this_ptr_conv.is_owned = false;
31906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31907 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31908 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31913 LDKAcceptChannel this_ptr_conv;
31914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31915 this_ptr_conv.is_owned = false;
31916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31917 LDKPublicKey val_ref;
31918 CHECK((*env)->GetArrayLength(env, val) == 33);
31919 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31920 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31924 LDKAcceptChannel this_ptr_conv;
31925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31926 this_ptr_conv.is_owned = false;
31927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31928 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31929 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31934 LDKAcceptChannel this_ptr_conv;
31935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31936 this_ptr_conv.is_owned = false;
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31938 LDKPublicKey val_ref;
31939 CHECK((*env)->GetArrayLength(env, val) == 33);
31940 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31941 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31945 LDKAcceptChannel this_ptr_conv;
31946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31947 this_ptr_conv.is_owned = false;
31948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31949 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31954 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) {
31955 LDKAcceptChannel this_ptr_conv;
31956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31957 this_ptr_conv.is_owned = false;
31958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31959 LDKPublicKey val_ref;
31960 CHECK((*env)->GetArrayLength(env, val) == 33);
31961 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31962 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31966 LDKAcceptChannel this_ptr_conv;
31967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31968 this_ptr_conv.is_owned = false;
31969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31970 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31971 int64_t ret_ref = 0;
31972 if ((uintptr_t)ret_var.inner > 4096) {
31973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31976 ret_ref = (uintptr_t)ret_var.inner;
31977 if (ret_var.is_owned) {
31984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31985 LDKAcceptChannel this_ptr_conv;
31986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31987 this_ptr_conv.is_owned = false;
31988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31989 LDKChannelTypeFeatures val_conv;
31990 val_conv.inner = (void*)(val & (~1));
31991 val_conv.is_owned = (val & 1) || (val == 0);
31992 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31993 val_conv = ChannelTypeFeatures_clone(&val_conv);
31994 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31997 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31998 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31999 int64_t ret_ref = 0;
32000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32003 ret_ref = (uintptr_t)ret_var.inner;
32004 if (ret_var.is_owned) {
32009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32010 LDKAcceptChannel arg_conv;
32011 arg_conv.inner = (void*)(arg & (~1));
32012 arg_conv.is_owned = false;
32013 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32014 int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
32018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32019 LDKAcceptChannel orig_conv;
32020 orig_conv.inner = (void*)(orig & (~1));
32021 orig_conv.is_owned = false;
32022 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32023 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
32024 int64_t ret_ref = 0;
32025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32028 ret_ref = (uintptr_t)ret_var.inner;
32029 if (ret_var.is_owned) {
32035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32036 LDKFundingCreated this_obj_conv;
32037 this_obj_conv.inner = (void*)(this_obj & (~1));
32038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32040 FundingCreated_free(this_obj_conv);
32043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32044 LDKFundingCreated this_ptr_conv;
32045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32046 this_ptr_conv.is_owned = false;
32047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
32053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32054 LDKFundingCreated this_ptr_conv;
32055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32056 this_ptr_conv.is_owned = false;
32057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32058 LDKThirtyTwoBytes val_ref;
32059 CHECK((*env)->GetArrayLength(env, val) == 32);
32060 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32061 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
32064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
32065 LDKFundingCreated this_ptr_conv;
32066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32067 this_ptr_conv.is_owned = false;
32068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32069 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32070 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
32074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32075 LDKFundingCreated this_ptr_conv;
32076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32077 this_ptr_conv.is_owned = false;
32078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32079 LDKThirtyTwoBytes val_ref;
32080 CHECK((*env)->GetArrayLength(env, val) == 32);
32081 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32082 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
32085 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
32086 LDKFundingCreated this_ptr_conv;
32087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32088 this_ptr_conv.is_owned = false;
32089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32090 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
32094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32095 LDKFundingCreated this_ptr_conv;
32096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32097 this_ptr_conv.is_owned = false;
32098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32099 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
32102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32103 LDKFundingCreated this_ptr_conv;
32104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32105 this_ptr_conv.is_owned = false;
32106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32107 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32108 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
32112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32113 LDKFundingCreated this_ptr_conv;
32114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32115 this_ptr_conv.is_owned = false;
32116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32117 LDKSignature val_ref;
32118 CHECK((*env)->GetArrayLength(env, val) == 64);
32119 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32120 FundingCreated_set_signature(&this_ptr_conv, val_ref);
32123 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) {
32124 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
32125 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
32126 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
32127 LDKThirtyTwoBytes funding_txid_arg_ref;
32128 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
32129 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
32130 LDKSignature signature_arg_ref;
32131 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32132 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32133 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
32134 int64_t ret_ref = 0;
32135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32138 ret_ref = (uintptr_t)ret_var.inner;
32139 if (ret_var.is_owned) {
32145 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
32146 LDKFundingCreated ret_var = FundingCreated_clone(arg);
32147 int64_t ret_ref = 0;
32148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32151 ret_ref = (uintptr_t)ret_var.inner;
32152 if (ret_var.is_owned) {
32157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32158 LDKFundingCreated arg_conv;
32159 arg_conv.inner = (void*)(arg & (~1));
32160 arg_conv.is_owned = false;
32161 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32162 int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
32166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32167 LDKFundingCreated orig_conv;
32168 orig_conv.inner = (void*)(orig & (~1));
32169 orig_conv.is_owned = false;
32170 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32171 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
32172 int64_t ret_ref = 0;
32173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32176 ret_ref = (uintptr_t)ret_var.inner;
32177 if (ret_var.is_owned) {
32183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32184 LDKFundingSigned this_obj_conv;
32185 this_obj_conv.inner = (void*)(this_obj & (~1));
32186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32188 FundingSigned_free(this_obj_conv);
32191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32192 LDKFundingSigned this_ptr_conv;
32193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32194 this_ptr_conv.is_owned = false;
32195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32196 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32197 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
32201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32202 LDKFundingSigned this_ptr_conv;
32203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32204 this_ptr_conv.is_owned = false;
32205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32206 LDKThirtyTwoBytes val_ref;
32207 CHECK((*env)->GetArrayLength(env, val) == 32);
32208 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32209 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
32212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32213 LDKFundingSigned this_ptr_conv;
32214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32215 this_ptr_conv.is_owned = false;
32216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32217 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
32222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32223 LDKFundingSigned this_ptr_conv;
32224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32225 this_ptr_conv.is_owned = false;
32226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32227 LDKSignature val_ref;
32228 CHECK((*env)->GetArrayLength(env, val) == 64);
32229 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32230 FundingSigned_set_signature(&this_ptr_conv, val_ref);
32233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
32234 LDKThirtyTwoBytes channel_id_arg_ref;
32235 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32236 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32237 LDKSignature signature_arg_ref;
32238 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32239 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32240 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
32241 int64_t ret_ref = 0;
32242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32245 ret_ref = (uintptr_t)ret_var.inner;
32246 if (ret_var.is_owned) {
32252 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
32253 LDKFundingSigned ret_var = FundingSigned_clone(arg);
32254 int64_t ret_ref = 0;
32255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32258 ret_ref = (uintptr_t)ret_var.inner;
32259 if (ret_var.is_owned) {
32264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32265 LDKFundingSigned arg_conv;
32266 arg_conv.inner = (void*)(arg & (~1));
32267 arg_conv.is_owned = false;
32268 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32269 int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
32273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32274 LDKFundingSigned orig_conv;
32275 orig_conv.inner = (void*)(orig & (~1));
32276 orig_conv.is_owned = false;
32277 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32278 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
32279 int64_t ret_ref = 0;
32280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32283 ret_ref = (uintptr_t)ret_var.inner;
32284 if (ret_var.is_owned) {
32290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32291 LDKChannelReady this_obj_conv;
32292 this_obj_conv.inner = (void*)(this_obj & (~1));
32293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32295 ChannelReady_free(this_obj_conv);
32298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32299 LDKChannelReady this_ptr_conv;
32300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32301 this_ptr_conv.is_owned = false;
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
32308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32309 LDKChannelReady 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 LDKThirtyTwoBytes val_ref;
32314 CHECK((*env)->GetArrayLength(env, val) == 32);
32315 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32316 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
32319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32320 LDKChannelReady this_ptr_conv;
32321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32322 this_ptr_conv.is_owned = false;
32323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32324 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32329 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) {
32330 LDKChannelReady 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 LDKPublicKey val_ref;
32335 CHECK((*env)->GetArrayLength(env, val) == 33);
32336 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32337 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32341 LDKChannelReady this_ptr_conv;
32342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32343 this_ptr_conv.is_owned = false;
32344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32345 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32346 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
32347 int64_t ret_ref = (uintptr_t)ret_copy;
32351 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) {
32352 LDKChannelReady this_ptr_conv;
32353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32354 this_ptr_conv.is_owned = false;
32355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32356 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32357 CHECK_ACCESS(val_ptr);
32358 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32359 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
32360 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32363 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) {
32364 LDKThirtyTwoBytes channel_id_arg_ref;
32365 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32366 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32367 LDKPublicKey next_per_commitment_point_arg_ref;
32368 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32369 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32370 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
32371 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32372 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32373 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
32374 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32375 int64_t ret_ref = 0;
32376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32379 ret_ref = (uintptr_t)ret_var.inner;
32380 if (ret_var.is_owned) {
32386 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32387 LDKChannelReady ret_var = ChannelReady_clone(arg);
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) {
32398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32399 LDKChannelReady arg_conv;
32400 arg_conv.inner = (void*)(arg & (~1));
32401 arg_conv.is_owned = false;
32402 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32403 int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32408 LDKChannelReady orig_conv;
32409 orig_conv.inner = (void*)(orig & (~1));
32410 orig_conv.is_owned = false;
32411 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32412 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32413 int64_t ret_ref = 0;
32414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32417 ret_ref = (uintptr_t)ret_var.inner;
32418 if (ret_var.is_owned) {
32424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32425 LDKShutdown this_obj_conv;
32426 this_obj_conv.inner = (void*)(this_obj & (~1));
32427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32429 Shutdown_free(this_obj_conv);
32432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32433 LDKShutdown this_ptr_conv;
32434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32435 this_ptr_conv.is_owned = false;
32436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32437 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32438 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
32442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32443 LDKShutdown this_ptr_conv;
32444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32445 this_ptr_conv.is_owned = false;
32446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32447 LDKThirtyTwoBytes val_ref;
32448 CHECK((*env)->GetArrayLength(env, val) == 32);
32449 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32450 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32454 LDKShutdown this_ptr_conv;
32455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32456 this_ptr_conv.is_owned = false;
32457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32458 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32459 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32460 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32465 LDKShutdown this_ptr_conv;
32466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32467 this_ptr_conv.is_owned = false;
32468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32469 LDKCVec_u8Z val_ref;
32470 val_ref.datalen = (*env)->GetArrayLength(env, val);
32471 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32472 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
32473 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32477 LDKThirtyTwoBytes channel_id_arg_ref;
32478 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32479 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32480 LDKCVec_u8Z scriptpubkey_arg_ref;
32481 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
32482 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32483 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
32484 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32485 int64_t ret_ref = 0;
32486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32489 ret_ref = (uintptr_t)ret_var.inner;
32490 if (ret_var.is_owned) {
32496 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32497 LDKShutdown ret_var = Shutdown_clone(arg);
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) {
32508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32509 LDKShutdown arg_conv;
32510 arg_conv.inner = (void*)(arg & (~1));
32511 arg_conv.is_owned = false;
32512 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32513 int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32518 LDKShutdown orig_conv;
32519 orig_conv.inner = (void*)(orig & (~1));
32520 orig_conv.is_owned = false;
32521 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32522 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32523 int64_t ret_ref = 0;
32524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32527 ret_ref = (uintptr_t)ret_var.inner;
32528 if (ret_var.is_owned) {
32534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32535 LDKClosingSignedFeeRange this_obj_conv;
32536 this_obj_conv.inner = (void*)(this_obj & (~1));
32537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32539 ClosingSignedFeeRange_free(this_obj_conv);
32542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32543 LDKClosingSignedFeeRange this_ptr_conv;
32544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32545 this_ptr_conv.is_owned = false;
32546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32547 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32552 LDKClosingSignedFeeRange this_ptr_conv;
32553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32554 this_ptr_conv.is_owned = false;
32555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32556 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32560 LDKClosingSignedFeeRange this_ptr_conv;
32561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32562 this_ptr_conv.is_owned = false;
32563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32564 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32569 LDKClosingSignedFeeRange this_ptr_conv;
32570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32571 this_ptr_conv.is_owned = false;
32572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32573 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32576 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) {
32577 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32578 int64_t ret_ref = 0;
32579 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32580 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32582 ret_ref = (uintptr_t)ret_var.inner;
32583 if (ret_var.is_owned) {
32589 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32590 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32591 int64_t ret_ref = 0;
32592 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32593 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32595 ret_ref = (uintptr_t)ret_var.inner;
32596 if (ret_var.is_owned) {
32601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32602 LDKClosingSignedFeeRange arg_conv;
32603 arg_conv.inner = (void*)(arg & (~1));
32604 arg_conv.is_owned = false;
32605 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32606 int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32611 LDKClosingSignedFeeRange orig_conv;
32612 orig_conv.inner = (void*)(orig & (~1));
32613 orig_conv.is_owned = false;
32614 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32615 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32616 int64_t ret_ref = 0;
32617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32620 ret_ref = (uintptr_t)ret_var.inner;
32621 if (ret_var.is_owned) {
32627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32628 LDKClosingSigned this_obj_conv;
32629 this_obj_conv.inner = (void*)(this_obj & (~1));
32630 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32632 ClosingSigned_free(this_obj_conv);
32635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32636 LDKClosingSigned this_ptr_conv;
32637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32638 this_ptr_conv.is_owned = false;
32639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32640 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32641 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
32645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32646 LDKClosingSigned this_ptr_conv;
32647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32648 this_ptr_conv.is_owned = false;
32649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32650 LDKThirtyTwoBytes val_ref;
32651 CHECK((*env)->GetArrayLength(env, val) == 32);
32652 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32653 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32657 LDKClosingSigned this_ptr_conv;
32658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32659 this_ptr_conv.is_owned = false;
32660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32661 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32666 LDKClosingSigned this_ptr_conv;
32667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32668 this_ptr_conv.is_owned = false;
32669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32670 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32674 LDKClosingSigned this_ptr_conv;
32675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32676 this_ptr_conv.is_owned = false;
32677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32678 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32679 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
32683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32684 LDKClosingSigned 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 LDKSignature val_ref;
32689 CHECK((*env)->GetArrayLength(env, val) == 64);
32690 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32691 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
32695 LDKClosingSigned this_ptr_conv;
32696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32697 this_ptr_conv.is_owned = false;
32698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32699 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32700 int64_t ret_ref = 0;
32701 if ((uintptr_t)ret_var.inner > 4096) {
32702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32705 ret_ref = (uintptr_t)ret_var.inner;
32706 if (ret_var.is_owned) {
32713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32714 LDKClosingSigned this_ptr_conv;
32715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32716 this_ptr_conv.is_owned = false;
32717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32718 LDKClosingSignedFeeRange val_conv;
32719 val_conv.inner = (void*)(val & (~1));
32720 val_conv.is_owned = (val & 1) || (val == 0);
32721 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32722 val_conv = ClosingSignedFeeRange_clone(&val_conv);
32723 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32726 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) {
32727 LDKThirtyTwoBytes channel_id_arg_ref;
32728 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32729 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32730 LDKSignature signature_arg_ref;
32731 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32732 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32733 LDKClosingSignedFeeRange fee_range_arg_conv;
32734 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
32735 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
32736 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32737 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32738 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_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 ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32751 LDKClosingSigned ret_var = ClosingSigned_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_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32763 LDKClosingSigned 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 = ClosingSigned_clone_ptr(&arg_conv);
32771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32772 LDKClosingSigned 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 LDKClosingSigned ret_var = ClosingSigned_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_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32789 LDKUpdateAddHTLC 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 UpdateAddHTLC_free(this_obj_conv);
32796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32797 LDKUpdateAddHTLC 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, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
32806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32807 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32818 LDKUpdateAddHTLC 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 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32827 LDKUpdateAddHTLC this_ptr_conv;
32828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32829 this_ptr_conv.is_owned = false;
32830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32831 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32835 LDKUpdateAddHTLC this_ptr_conv;
32836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32837 this_ptr_conv.is_owned = false;
32838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32839 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32844 LDKUpdateAddHTLC this_ptr_conv;
32845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32846 this_ptr_conv.is_owned = false;
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32848 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32852 LDKUpdateAddHTLC this_ptr_conv;
32853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32854 this_ptr_conv.is_owned = false;
32855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32856 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
32861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32862 LDKUpdateAddHTLC this_ptr_conv;
32863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32864 this_ptr_conv.is_owned = false;
32865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32866 LDKThirtyTwoBytes val_ref;
32867 CHECK((*env)->GetArrayLength(env, val) == 32);
32868 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32869 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32872 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
32873 LDKUpdateAddHTLC this_ptr_conv;
32874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32875 this_ptr_conv.is_owned = false;
32876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32877 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32882 LDKUpdateAddHTLC this_ptr_conv;
32883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32884 this_ptr_conv.is_owned = false;
32885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32886 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32889 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32890 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32891 int64_t ret_ref = 0;
32892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32895 ret_ref = (uintptr_t)ret_var.inner;
32896 if (ret_var.is_owned) {
32901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32902 LDKUpdateAddHTLC arg_conv;
32903 arg_conv.inner = (void*)(arg & (~1));
32904 arg_conv.is_owned = false;
32905 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32906 int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32911 LDKUpdateAddHTLC orig_conv;
32912 orig_conv.inner = (void*)(orig & (~1));
32913 orig_conv.is_owned = false;
32914 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32915 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32916 int64_t ret_ref = 0;
32917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32920 ret_ref = (uintptr_t)ret_var.inner;
32921 if (ret_var.is_owned) {
32927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32928 LDKUpdateFulfillHTLC this_obj_conv;
32929 this_obj_conv.inner = (void*)(this_obj & (~1));
32930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32932 UpdateFulfillHTLC_free(this_obj_conv);
32935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32936 LDKUpdateFulfillHTLC this_ptr_conv;
32937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32938 this_ptr_conv.is_owned = false;
32939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32940 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32946 LDKUpdateFulfillHTLC this_ptr_conv;
32947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32948 this_ptr_conv.is_owned = false;
32949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32950 LDKThirtyTwoBytes val_ref;
32951 CHECK((*env)->GetArrayLength(env, val) == 32);
32952 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32953 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32957 LDKUpdateFulfillHTLC this_ptr_conv;
32958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32959 this_ptr_conv.is_owned = false;
32960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32961 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32966 LDKUpdateFulfillHTLC this_ptr_conv;
32967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32968 this_ptr_conv.is_owned = false;
32969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32970 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32974 LDKUpdateFulfillHTLC this_ptr_conv;
32975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32976 this_ptr_conv.is_owned = false;
32977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32978 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32979 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32984 LDKUpdateFulfillHTLC this_ptr_conv;
32985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32986 this_ptr_conv.is_owned = false;
32987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32988 LDKThirtyTwoBytes val_ref;
32989 CHECK((*env)->GetArrayLength(env, val) == 32);
32990 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32991 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32994 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) {
32995 LDKThirtyTwoBytes channel_id_arg_ref;
32996 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32997 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32998 LDKThirtyTwoBytes payment_preimage_arg_ref;
32999 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
33000 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
33001 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
33002 int64_t ret_ref = 0;
33003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33006 ret_ref = (uintptr_t)ret_var.inner;
33007 if (ret_var.is_owned) {
33013 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
33014 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
33015 int64_t ret_ref = 0;
33016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33019 ret_ref = (uintptr_t)ret_var.inner;
33020 if (ret_var.is_owned) {
33025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33026 LDKUpdateFulfillHTLC arg_conv;
33027 arg_conv.inner = (void*)(arg & (~1));
33028 arg_conv.is_owned = false;
33029 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33030 int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
33034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33035 LDKUpdateFulfillHTLC orig_conv;
33036 orig_conv.inner = (void*)(orig & (~1));
33037 orig_conv.is_owned = false;
33038 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33039 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
33040 int64_t ret_ref = 0;
33041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33044 ret_ref = (uintptr_t)ret_var.inner;
33045 if (ret_var.is_owned) {
33051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33052 LDKUpdateFailHTLC this_obj_conv;
33053 this_obj_conv.inner = (void*)(this_obj & (~1));
33054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33056 UpdateFailHTLC_free(this_obj_conv);
33059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33060 LDKUpdateFailHTLC this_ptr_conv;
33061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33062 this_ptr_conv.is_owned = false;
33063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33064 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33065 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
33069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33070 LDKUpdateFailHTLC this_ptr_conv;
33071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33072 this_ptr_conv.is_owned = false;
33073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074 LDKThirtyTwoBytes val_ref;
33075 CHECK((*env)->GetArrayLength(env, val) == 32);
33076 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33077 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
33080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33081 LDKUpdateFailHTLC this_ptr_conv;
33082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33083 this_ptr_conv.is_owned = false;
33084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33085 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
33089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33090 LDKUpdateFailHTLC this_ptr_conv;
33091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33092 this_ptr_conv.is_owned = false;
33093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33094 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
33097 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
33098 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
33099 int64_t ret_ref = 0;
33100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33103 ret_ref = (uintptr_t)ret_var.inner;
33104 if (ret_var.is_owned) {
33109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33110 LDKUpdateFailHTLC arg_conv;
33111 arg_conv.inner = (void*)(arg & (~1));
33112 arg_conv.is_owned = false;
33113 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33114 int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
33118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33119 LDKUpdateFailHTLC orig_conv;
33120 orig_conv.inner = (void*)(orig & (~1));
33121 orig_conv.is_owned = false;
33122 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33123 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
33124 int64_t ret_ref = 0;
33125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33128 ret_ref = (uintptr_t)ret_var.inner;
33129 if (ret_var.is_owned) {
33135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33136 LDKUpdateFailMalformedHTLC this_obj_conv;
33137 this_obj_conv.inner = (void*)(this_obj & (~1));
33138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33140 UpdateFailMalformedHTLC_free(this_obj_conv);
33143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33144 LDKUpdateFailMalformedHTLC this_ptr_conv;
33145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33146 this_ptr_conv.is_owned = false;
33147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33148 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33149 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
33153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33154 LDKUpdateFailMalformedHTLC this_ptr_conv;
33155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33156 this_ptr_conv.is_owned = false;
33157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33158 LDKThirtyTwoBytes val_ref;
33159 CHECK((*env)->GetArrayLength(env, val) == 32);
33160 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33161 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
33164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33165 LDKUpdateFailMalformedHTLC this_ptr_conv;
33166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33167 this_ptr_conv.is_owned = false;
33168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33169 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
33173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33174 LDKUpdateFailMalformedHTLC this_ptr_conv;
33175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33176 this_ptr_conv.is_owned = false;
33177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33178 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
33181 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
33182 LDKUpdateFailMalformedHTLC 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 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
33190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33191 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
33198 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
33199 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
33200 int64_t ret_ref = 0;
33201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33204 ret_ref = (uintptr_t)ret_var.inner;
33205 if (ret_var.is_owned) {
33210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33211 LDKUpdateFailMalformedHTLC arg_conv;
33212 arg_conv.inner = (void*)(arg & (~1));
33213 arg_conv.is_owned = false;
33214 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33215 int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
33219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33220 LDKUpdateFailMalformedHTLC orig_conv;
33221 orig_conv.inner = (void*)(orig & (~1));
33222 orig_conv.is_owned = false;
33223 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33224 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
33225 int64_t ret_ref = 0;
33226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33229 ret_ref = (uintptr_t)ret_var.inner;
33230 if (ret_var.is_owned) {
33236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33237 LDKCommitmentSigned this_obj_conv;
33238 this_obj_conv.inner = (void*)(this_obj & (~1));
33239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33241 CommitmentSigned_free(this_obj_conv);
33244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33245 LDKCommitmentSigned this_ptr_conv;
33246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33247 this_ptr_conv.is_owned = false;
33248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
33254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33255 LDKCommitmentSigned this_ptr_conv;
33256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33257 this_ptr_conv.is_owned = false;
33258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259 LDKThirtyTwoBytes val_ref;
33260 CHECK((*env)->GetArrayLength(env, val) == 32);
33261 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33262 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33266 LDKCommitmentSigned this_ptr_conv;
33267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33268 this_ptr_conv.is_owned = false;
33269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33270 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33271 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
33275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33276 LDKCommitmentSigned this_ptr_conv;
33277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33278 this_ptr_conv.is_owned = false;
33279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33280 LDKSignature val_ref;
33281 CHECK((*env)->GetArrayLength(env, val) == 64);
33282 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33283 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
33287 LDKCommitmentSigned this_ptr_conv;
33288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33289 this_ptr_conv.is_owned = false;
33290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33291 LDKCVec_SignatureZ val_constr;
33292 val_constr.datalen = (*env)->GetArrayLength(env, val);
33293 if (val_constr.datalen > 0)
33294 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33296 val_constr.data = NULL;
33297 for (size_t i = 0; i < val_constr.datalen; i++) {
33298 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
33299 LDKSignature val_conv_8_ref;
33300 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
33301 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
33302 val_constr.data[i] = val_conv_8_ref;
33304 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33307 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) {
33308 LDKThirtyTwoBytes channel_id_arg_ref;
33309 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33310 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33311 LDKSignature signature_arg_ref;
33312 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33313 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33314 LDKCVec_SignatureZ htlc_signatures_arg_constr;
33315 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
33316 if (htlc_signatures_arg_constr.datalen > 0)
33317 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33319 htlc_signatures_arg_constr.data = NULL;
33320 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
33321 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
33322 LDKSignature htlc_signatures_arg_conv_8_ref;
33323 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
33324 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
33325 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
33327 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33328 int64_t ret_ref = 0;
33329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33332 ret_ref = (uintptr_t)ret_var.inner;
33333 if (ret_var.is_owned) {
33339 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33340 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33341 int64_t ret_ref = 0;
33342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33345 ret_ref = (uintptr_t)ret_var.inner;
33346 if (ret_var.is_owned) {
33351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33352 LDKCommitmentSigned arg_conv;
33353 arg_conv.inner = (void*)(arg & (~1));
33354 arg_conv.is_owned = false;
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33356 int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33361 LDKCommitmentSigned orig_conv;
33362 orig_conv.inner = (void*)(orig & (~1));
33363 orig_conv.is_owned = false;
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33365 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33366 int64_t ret_ref = 0;
33367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33370 ret_ref = (uintptr_t)ret_var.inner;
33371 if (ret_var.is_owned) {
33377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33378 LDKRevokeAndACK this_obj_conv;
33379 this_obj_conv.inner = (void*)(this_obj & (~1));
33380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33382 RevokeAndACK_free(this_obj_conv);
33385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33386 LDKRevokeAndACK this_ptr_conv;
33387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33388 this_ptr_conv.is_owned = false;
33389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33390 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
33395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33396 LDKRevokeAndACK this_ptr_conv;
33397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33398 this_ptr_conv.is_owned = false;
33399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33400 LDKThirtyTwoBytes val_ref;
33401 CHECK((*env)->GetArrayLength(env, val) == 32);
33402 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33403 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33407 LDKRevokeAndACK this_ptr_conv;
33408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33409 this_ptr_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33412 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
33416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33417 LDKRevokeAndACK this_ptr_conv;
33418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33419 this_ptr_conv.is_owned = false;
33420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33421 LDKThirtyTwoBytes val_ref;
33422 CHECK((*env)->GetArrayLength(env, val) == 32);
33423 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33424 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33428 LDKRevokeAndACK this_ptr_conv;
33429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33430 this_ptr_conv.is_owned = false;
33431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33432 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33433 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33437 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) {
33438 LDKRevokeAndACK this_ptr_conv;
33439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33440 this_ptr_conv.is_owned = false;
33441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33442 LDKPublicKey val_ref;
33443 CHECK((*env)->GetArrayLength(env, val) == 33);
33444 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33445 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33448 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) {
33449 LDKThirtyTwoBytes channel_id_arg_ref;
33450 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33451 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33452 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33453 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
33454 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
33455 LDKPublicKey next_per_commitment_point_arg_ref;
33456 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33457 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33458 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33459 int64_t ret_ref = 0;
33460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33463 ret_ref = (uintptr_t)ret_var.inner;
33464 if (ret_var.is_owned) {
33470 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33471 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33472 int64_t ret_ref = 0;
33473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33476 ret_ref = (uintptr_t)ret_var.inner;
33477 if (ret_var.is_owned) {
33482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33483 LDKRevokeAndACK arg_conv;
33484 arg_conv.inner = (void*)(arg & (~1));
33485 arg_conv.is_owned = false;
33486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33487 int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33492 LDKRevokeAndACK orig_conv;
33493 orig_conv.inner = (void*)(orig & (~1));
33494 orig_conv.is_owned = false;
33495 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33496 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33497 int64_t ret_ref = 0;
33498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33501 ret_ref = (uintptr_t)ret_var.inner;
33502 if (ret_var.is_owned) {
33508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33509 LDKUpdateFee this_obj_conv;
33510 this_obj_conv.inner = (void*)(this_obj & (~1));
33511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33513 UpdateFee_free(this_obj_conv);
33516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33517 LDKUpdateFee this_ptr_conv;
33518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33519 this_ptr_conv.is_owned = false;
33520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33521 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33522 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
33526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33527 LDKUpdateFee this_ptr_conv;
33528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33529 this_ptr_conv.is_owned = false;
33530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33531 LDKThirtyTwoBytes val_ref;
33532 CHECK((*env)->GetArrayLength(env, val) == 32);
33533 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33534 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
33538 LDKUpdateFee 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 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33547 LDKUpdateFee this_ptr_conv;
33548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33549 this_ptr_conv.is_owned = false;
33550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33551 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33554 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) {
33555 LDKThirtyTwoBytes channel_id_arg_ref;
33556 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33557 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33558 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33559 int64_t ret_ref = 0;
33560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33563 ret_ref = (uintptr_t)ret_var.inner;
33564 if (ret_var.is_owned) {
33570 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33571 LDKUpdateFee ret_var = UpdateFee_clone(arg);
33572 int64_t ret_ref = 0;
33573 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33574 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33576 ret_ref = (uintptr_t)ret_var.inner;
33577 if (ret_var.is_owned) {
33582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33583 LDKUpdateFee arg_conv;
33584 arg_conv.inner = (void*)(arg & (~1));
33585 arg_conv.is_owned = false;
33586 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33587 int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33592 LDKUpdateFee orig_conv;
33593 orig_conv.inner = (void*)(orig & (~1));
33594 orig_conv.is_owned = false;
33595 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33596 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33597 int64_t ret_ref = 0;
33598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33601 ret_ref = (uintptr_t)ret_var.inner;
33602 if (ret_var.is_owned) {
33608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33609 LDKDataLossProtect this_obj_conv;
33610 this_obj_conv.inner = (void*)(this_obj & (~1));
33611 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33613 DataLossProtect_free(this_obj_conv);
33616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33617 LDKDataLossProtect this_ptr_conv;
33618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33619 this_ptr_conv.is_owned = false;
33620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33621 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33622 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
33626 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) {
33627 LDKDataLossProtect this_ptr_conv;
33628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33629 this_ptr_conv.is_owned = false;
33630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33631 LDKThirtyTwoBytes val_ref;
33632 CHECK((*env)->GetArrayLength(env, val) == 32);
33633 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33634 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33638 LDKDataLossProtect this_ptr_conv;
33639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33640 this_ptr_conv.is_owned = false;
33641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33642 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33643 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
33647 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) {
33648 LDKDataLossProtect this_ptr_conv;
33649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33650 this_ptr_conv.is_owned = false;
33651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33652 LDKPublicKey val_ref;
33653 CHECK((*env)->GetArrayLength(env, val) == 33);
33654 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33655 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33658 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) {
33659 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33660 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
33661 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
33662 LDKPublicKey my_current_per_commitment_point_arg_ref;
33663 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
33664 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
33665 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33666 int64_t ret_ref = 0;
33667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33670 ret_ref = (uintptr_t)ret_var.inner;
33671 if (ret_var.is_owned) {
33677 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33678 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33679 int64_t ret_ref = 0;
33680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33683 ret_ref = (uintptr_t)ret_var.inner;
33684 if (ret_var.is_owned) {
33689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33690 LDKDataLossProtect arg_conv;
33691 arg_conv.inner = (void*)(arg & (~1));
33692 arg_conv.is_owned = false;
33693 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33694 int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33699 LDKDataLossProtect orig_conv;
33700 orig_conv.inner = (void*)(orig & (~1));
33701 orig_conv.is_owned = false;
33702 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33703 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33704 int64_t ret_ref = 0;
33705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33708 ret_ref = (uintptr_t)ret_var.inner;
33709 if (ret_var.is_owned) {
33715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33716 LDKChannelReestablish this_obj_conv;
33717 this_obj_conv.inner = (void*)(this_obj & (~1));
33718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33720 ChannelReestablish_free(this_obj_conv);
33723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33724 LDKChannelReestablish this_ptr_conv;
33725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33726 this_ptr_conv.is_owned = false;
33727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33728 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33729 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
33733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33734 LDKChannelReestablish this_ptr_conv;
33735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33736 this_ptr_conv.is_owned = false;
33737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33738 LDKThirtyTwoBytes val_ref;
33739 CHECK((*env)->GetArrayLength(env, val) == 32);
33740 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33741 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33745 LDKChannelReestablish this_ptr_conv;
33746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33747 this_ptr_conv.is_owned = false;
33748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33749 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33753 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) {
33754 LDKChannelReestablish this_ptr_conv;
33755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33756 this_ptr_conv.is_owned = false;
33757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33758 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33762 LDKChannelReestablish this_ptr_conv;
33763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33764 this_ptr_conv.is_owned = false;
33765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33766 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33770 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) {
33771 LDKChannelReestablish 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 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33778 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33779 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33780 int64_t ret_ref = 0;
33781 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33782 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33784 ret_ref = (uintptr_t)ret_var.inner;
33785 if (ret_var.is_owned) {
33790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33791 LDKChannelReestablish arg_conv;
33792 arg_conv.inner = (void*)(arg & (~1));
33793 arg_conv.is_owned = false;
33794 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33795 int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33800 LDKChannelReestablish orig_conv;
33801 orig_conv.inner = (void*)(orig & (~1));
33802 orig_conv.is_owned = false;
33803 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33804 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33805 int64_t ret_ref = 0;
33806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33809 ret_ref = (uintptr_t)ret_var.inner;
33810 if (ret_var.is_owned) {
33816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33817 LDKAnnouncementSignatures this_obj_conv;
33818 this_obj_conv.inner = (void*)(this_obj & (~1));
33819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33821 AnnouncementSignatures_free(this_obj_conv);
33824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33825 LDKAnnouncementSignatures this_ptr_conv;
33826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33827 this_ptr_conv.is_owned = false;
33828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33829 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33830 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
33834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33835 LDKAnnouncementSignatures this_ptr_conv;
33836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33837 this_ptr_conv.is_owned = false;
33838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33839 LDKThirtyTwoBytes val_ref;
33840 CHECK((*env)->GetArrayLength(env, val) == 32);
33841 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33842 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33846 LDKAnnouncementSignatures this_ptr_conv;
33847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33848 this_ptr_conv.is_owned = false;
33849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33850 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33855 LDKAnnouncementSignatures this_ptr_conv;
33856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33857 this_ptr_conv.is_owned = false;
33858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33859 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33863 LDKAnnouncementSignatures this_ptr_conv;
33864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33865 this_ptr_conv.is_owned = false;
33866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33867 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33868 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
33872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33873 LDKAnnouncementSignatures this_ptr_conv;
33874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33875 this_ptr_conv.is_owned = false;
33876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33877 LDKSignature val_ref;
33878 CHECK((*env)->GetArrayLength(env, val) == 64);
33879 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33880 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33884 LDKAnnouncementSignatures this_ptr_conv;
33885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33886 this_ptr_conv.is_owned = false;
33887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33888 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33889 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
33893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33894 LDKAnnouncementSignatures this_ptr_conv;
33895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33896 this_ptr_conv.is_owned = false;
33897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33898 LDKSignature val_ref;
33899 CHECK((*env)->GetArrayLength(env, val) == 64);
33900 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33901 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33904 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) {
33905 LDKThirtyTwoBytes channel_id_arg_ref;
33906 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33907 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33908 LDKSignature node_signature_arg_ref;
33909 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
33910 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
33911 LDKSignature bitcoin_signature_arg_ref;
33912 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
33913 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
33914 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33915 int64_t ret_ref = 0;
33916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33919 ret_ref = (uintptr_t)ret_var.inner;
33920 if (ret_var.is_owned) {
33926 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33927 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33928 int64_t ret_ref = 0;
33929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33932 ret_ref = (uintptr_t)ret_var.inner;
33933 if (ret_var.is_owned) {
33938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33939 LDKAnnouncementSignatures arg_conv;
33940 arg_conv.inner = (void*)(arg & (~1));
33941 arg_conv.is_owned = false;
33942 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33943 int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33948 LDKAnnouncementSignatures orig_conv;
33949 orig_conv.inner = (void*)(orig & (~1));
33950 orig_conv.is_owned = false;
33951 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33952 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33953 int64_t ret_ref = 0;
33954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33957 ret_ref = (uintptr_t)ret_var.inner;
33958 if (ret_var.is_owned) {
33964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33965 if ((this_ptr & 1) != 0) return;
33966 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33967 CHECK_ACCESS(this_ptr_ptr);
33968 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33969 FREE((void*)this_ptr);
33970 NetAddress_free(this_ptr_conv);
33973 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33974 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33975 *ret_copy = NetAddress_clone(arg);
33976 int64_t ret_ref = (uintptr_t)ret_copy;
33979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33980 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
33981 int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33986 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
33987 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33988 *ret_copy = NetAddress_clone(orig_conv);
33989 int64_t ret_ref = (uintptr_t)ret_copy;
33993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33994 LDKFourBytes addr_ref;
33995 CHECK((*env)->GetArrayLength(env, addr) == 4);
33996 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33997 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33998 *ret_copy = NetAddress_ipv4(addr_ref, port);
33999 int64_t ret_ref = (uintptr_t)ret_copy;
34003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
34004 LDKSixteenBytes addr_ref;
34005 CHECK((*env)->GetArrayLength(env, addr) == 16);
34006 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
34007 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34008 *ret_copy = NetAddress_ipv6(addr_ref, port);
34009 int64_t ret_ref = (uintptr_t)ret_copy;
34013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
34014 LDKTwelveBytes a_ref;
34015 CHECK((*env)->GetArrayLength(env, a) == 12);
34016 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
34017 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34018 *ret_copy = NetAddress_onion_v2(a_ref);
34019 int64_t ret_ref = (uintptr_t)ret_copy;
34023 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) {
34024 LDKThirtyTwoBytes ed25519_pubkey_ref;
34025 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
34026 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
34027 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
34028 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
34029 int64_t ret_ref = (uintptr_t)ret_copy;
34033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
34034 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
34035 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
34036 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34037 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34038 CVec_u8Z_free(ret_var);
34042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34043 LDKu8slice ser_ref;
34044 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34045 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34046 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
34047 *ret_conv = NetAddress_read(ser_ref);
34048 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34049 return (int64_t)ret_conv;
34052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34053 LDKUnsignedNodeAnnouncement this_obj_conv;
34054 this_obj_conv.inner = (void*)(this_obj & (~1));
34055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34057 UnsignedNodeAnnouncement_free(this_obj_conv);
34060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34061 LDKUnsignedNodeAnnouncement this_ptr_conv;
34062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34063 this_ptr_conv.is_owned = false;
34064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34065 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
34066 int64_t ret_ref = 0;
34067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34070 ret_ref = (uintptr_t)ret_var.inner;
34071 if (ret_var.is_owned) {
34077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34078 LDKUnsignedNodeAnnouncement this_ptr_conv;
34079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34080 this_ptr_conv.is_owned = false;
34081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34082 LDKNodeFeatures val_conv;
34083 val_conv.inner = (void*)(val & (~1));
34084 val_conv.is_owned = (val & 1) || (val == 0);
34085 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34086 val_conv = NodeFeatures_clone(&val_conv);
34087 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
34090 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34091 LDKUnsignedNodeAnnouncement this_ptr_conv;
34092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34093 this_ptr_conv.is_owned = false;
34094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34095 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
34099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34100 LDKUnsignedNodeAnnouncement this_ptr_conv;
34101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34102 this_ptr_conv.is_owned = false;
34103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34104 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
34107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34108 LDKUnsignedNodeAnnouncement this_ptr_conv;
34109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34110 this_ptr_conv.is_owned = false;
34111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34112 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
34117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34118 LDKUnsignedNodeAnnouncement 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 LDKPublicKey val_ref;
34123 CHECK((*env)->GetArrayLength(env, val) == 33);
34124 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34125 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
34128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
34129 LDKUnsignedNodeAnnouncement this_ptr_conv;
34130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34131 this_ptr_conv.is_owned = false;
34132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34133 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
34134 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
34138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34139 LDKUnsignedNodeAnnouncement this_ptr_conv;
34140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34141 this_ptr_conv.is_owned = false;
34142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34143 LDKThreeBytes val_ref;
34144 CHECK((*env)->GetArrayLength(env, val) == 3);
34145 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
34146 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
34149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
34150 LDKUnsignedNodeAnnouncement this_ptr_conv;
34151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34152 this_ptr_conv.is_owned = false;
34153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34154 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34155 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
34159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34160 LDKUnsignedNodeAnnouncement this_ptr_conv;
34161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34162 this_ptr_conv.is_owned = false;
34163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34164 LDKThirtyTwoBytes val_ref;
34165 CHECK((*env)->GetArrayLength(env, val) == 32);
34166 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34167 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
34170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34171 LDKUnsignedNodeAnnouncement this_ptr_conv;
34172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34173 this_ptr_conv.is_owned = false;
34174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34175 LDKCVec_NetAddressZ val_constr;
34176 val_constr.datalen = (*env)->GetArrayLength(env, val);
34177 if (val_constr.datalen > 0)
34178 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
34180 val_constr.data = NULL;
34181 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34182 for (size_t m = 0; m < val_constr.datalen; m++) {
34183 int64_t val_conv_12 = val_vals[m];
34184 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
34185 CHECK_ACCESS(val_conv_12_ptr);
34186 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
34187 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
34188 val_constr.data[m] = val_conv_12_conv;
34190 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34191 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
34194 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
34195 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
34196 int64_t ret_ref = 0;
34197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34200 ret_ref = (uintptr_t)ret_var.inner;
34201 if (ret_var.is_owned) {
34206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34207 LDKUnsignedNodeAnnouncement arg_conv;
34208 arg_conv.inner = (void*)(arg & (~1));
34209 arg_conv.is_owned = false;
34210 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34211 int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34216 LDKUnsignedNodeAnnouncement orig_conv;
34217 orig_conv.inner = (void*)(orig & (~1));
34218 orig_conv.is_owned = false;
34219 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34220 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34221 int64_t ret_ref = 0;
34222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34225 ret_ref = (uintptr_t)ret_var.inner;
34226 if (ret_var.is_owned) {
34232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34233 LDKNodeAnnouncement this_obj_conv;
34234 this_obj_conv.inner = (void*)(this_obj & (~1));
34235 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34237 NodeAnnouncement_free(this_obj_conv);
34240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34241 LDKNodeAnnouncement this_ptr_conv;
34242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34243 this_ptr_conv.is_owned = false;
34244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34245 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34246 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
34250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34251 LDKNodeAnnouncement this_ptr_conv;
34252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34253 this_ptr_conv.is_owned = false;
34254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34255 LDKSignature val_ref;
34256 CHECK((*env)->GetArrayLength(env, val) == 64);
34257 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34258 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34262 LDKNodeAnnouncement this_ptr_conv;
34263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34264 this_ptr_conv.is_owned = false;
34265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34266 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34267 int64_t ret_ref = 0;
34268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34271 ret_ref = (uintptr_t)ret_var.inner;
34272 if (ret_var.is_owned) {
34278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34279 LDKNodeAnnouncement this_ptr_conv;
34280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34281 this_ptr_conv.is_owned = false;
34282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34283 LDKUnsignedNodeAnnouncement val_conv;
34284 val_conv.inner = (void*)(val & (~1));
34285 val_conv.is_owned = (val & 1) || (val == 0);
34286 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34287 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34288 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34292 LDKSignature signature_arg_ref;
34293 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34294 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34295 LDKUnsignedNodeAnnouncement contents_arg_conv;
34296 contents_arg_conv.inner = (void*)(contents_arg & (~1));
34297 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
34298 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34299 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34300 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34301 int64_t ret_ref = 0;
34302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34305 ret_ref = (uintptr_t)ret_var.inner;
34306 if (ret_var.is_owned) {
34312 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34313 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34314 int64_t ret_ref = 0;
34315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34318 ret_ref = (uintptr_t)ret_var.inner;
34319 if (ret_var.is_owned) {
34324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34325 LDKNodeAnnouncement arg_conv;
34326 arg_conv.inner = (void*)(arg & (~1));
34327 arg_conv.is_owned = false;
34328 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34329 int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34334 LDKNodeAnnouncement orig_conv;
34335 orig_conv.inner = (void*)(orig & (~1));
34336 orig_conv.is_owned = false;
34337 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34338 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34339 int64_t ret_ref = 0;
34340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34343 ret_ref = (uintptr_t)ret_var.inner;
34344 if (ret_var.is_owned) {
34350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34351 LDKUnsignedChannelAnnouncement this_obj_conv;
34352 this_obj_conv.inner = (void*)(this_obj & (~1));
34353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34355 UnsignedChannelAnnouncement_free(this_obj_conv);
34358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34359 LDKUnsignedChannelAnnouncement this_ptr_conv;
34360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34361 this_ptr_conv.is_owned = false;
34362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34363 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34364 int64_t ret_ref = 0;
34365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34368 ret_ref = (uintptr_t)ret_var.inner;
34369 if (ret_var.is_owned) {
34375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34376 LDKUnsignedChannelAnnouncement this_ptr_conv;
34377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34378 this_ptr_conv.is_owned = false;
34379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34380 LDKChannelFeatures val_conv;
34381 val_conv.inner = (void*)(val & (~1));
34382 val_conv.is_owned = (val & 1) || (val == 0);
34383 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34384 val_conv = ChannelFeatures_clone(&val_conv);
34385 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34389 LDKUnsignedChannelAnnouncement this_ptr_conv;
34390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34391 this_ptr_conv.is_owned = false;
34392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34393 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34394 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
34398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34399 LDKUnsignedChannelAnnouncement this_ptr_conv;
34400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34401 this_ptr_conv.is_owned = false;
34402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34403 LDKThirtyTwoBytes val_ref;
34404 CHECK((*env)->GetArrayLength(env, val) == 32);
34405 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34406 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34410 LDKUnsignedChannelAnnouncement this_ptr_conv;
34411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34412 this_ptr_conv.is_owned = false;
34413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34414 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34419 LDKUnsignedChannelAnnouncement this_ptr_conv;
34420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34421 this_ptr_conv.is_owned = false;
34422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34423 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34427 LDKUnsignedChannelAnnouncement this_ptr_conv;
34428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34429 this_ptr_conv.is_owned = false;
34430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34431 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34432 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
34436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34437 LDKUnsignedChannelAnnouncement this_ptr_conv;
34438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34439 this_ptr_conv.is_owned = false;
34440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34441 LDKPublicKey val_ref;
34442 CHECK((*env)->GetArrayLength(env, val) == 33);
34443 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34444 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
34447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34448 LDKUnsignedChannelAnnouncement this_ptr_conv;
34449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34450 this_ptr_conv.is_owned = false;
34451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34452 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
34457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34458 LDKUnsignedChannelAnnouncement this_ptr_conv;
34459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34460 this_ptr_conv.is_owned = false;
34461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34462 LDKPublicKey val_ref;
34463 CHECK((*env)->GetArrayLength(env, val) == 33);
34464 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34465 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
34468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34469 LDKUnsignedChannelAnnouncement this_ptr_conv;
34470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34471 this_ptr_conv.is_owned = false;
34472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34473 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34474 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
34478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34479 LDKUnsignedChannelAnnouncement this_ptr_conv;
34480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34481 this_ptr_conv.is_owned = false;
34482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34483 LDKPublicKey val_ref;
34484 CHECK((*env)->GetArrayLength(env, val) == 33);
34485 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34486 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
34489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34490 LDKUnsignedChannelAnnouncement this_ptr_conv;
34491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34492 this_ptr_conv.is_owned = false;
34493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34494 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34495 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
34499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34500 LDKUnsignedChannelAnnouncement this_ptr_conv;
34501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34502 this_ptr_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34504 LDKPublicKey val_ref;
34505 CHECK((*env)->GetArrayLength(env, val) == 33);
34506 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34507 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
34510 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34511 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34512 int64_t ret_ref = 0;
34513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34516 ret_ref = (uintptr_t)ret_var.inner;
34517 if (ret_var.is_owned) {
34522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34523 LDKUnsignedChannelAnnouncement arg_conv;
34524 arg_conv.inner = (void*)(arg & (~1));
34525 arg_conv.is_owned = false;
34526 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34527 int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34532 LDKUnsignedChannelAnnouncement orig_conv;
34533 orig_conv.inner = (void*)(orig & (~1));
34534 orig_conv.is_owned = false;
34535 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34536 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34537 int64_t ret_ref = 0;
34538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34541 ret_ref = (uintptr_t)ret_var.inner;
34542 if (ret_var.is_owned) {
34548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34549 LDKChannelAnnouncement this_obj_conv;
34550 this_obj_conv.inner = (void*)(this_obj & (~1));
34551 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34553 ChannelAnnouncement_free(this_obj_conv);
34556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34557 LDKChannelAnnouncement this_ptr_conv;
34558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34559 this_ptr_conv.is_owned = false;
34560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34561 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34562 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
34566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34567 LDKChannelAnnouncement this_ptr_conv;
34568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34569 this_ptr_conv.is_owned = false;
34570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34571 LDKSignature val_ref;
34572 CHECK((*env)->GetArrayLength(env, val) == 64);
34573 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34574 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34578 LDKChannelAnnouncement this_ptr_conv;
34579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34580 this_ptr_conv.is_owned = false;
34581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34582 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34583 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
34587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34588 LDKChannelAnnouncement this_ptr_conv;
34589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34590 this_ptr_conv.is_owned = false;
34591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34592 LDKSignature val_ref;
34593 CHECK((*env)->GetArrayLength(env, val) == 64);
34594 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34595 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34599 LDKChannelAnnouncement this_ptr_conv;
34600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34601 this_ptr_conv.is_owned = false;
34602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34603 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34604 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
34608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34609 LDKChannelAnnouncement this_ptr_conv;
34610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34611 this_ptr_conv.is_owned = false;
34612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34613 LDKSignature val_ref;
34614 CHECK((*env)->GetArrayLength(env, val) == 64);
34615 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34616 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34620 LDKChannelAnnouncement this_ptr_conv;
34621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34622 this_ptr_conv.is_owned = false;
34623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34624 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
34629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34630 LDKChannelAnnouncement this_ptr_conv;
34631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34632 this_ptr_conv.is_owned = false;
34633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34634 LDKSignature val_ref;
34635 CHECK((*env)->GetArrayLength(env, val) == 64);
34636 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34637 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34641 LDKChannelAnnouncement this_ptr_conv;
34642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34643 this_ptr_conv.is_owned = false;
34644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34645 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34646 int64_t ret_ref = 0;
34647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34650 ret_ref = (uintptr_t)ret_var.inner;
34651 if (ret_var.is_owned) {
34657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34658 LDKChannelAnnouncement this_ptr_conv;
34659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34660 this_ptr_conv.is_owned = false;
34661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34662 LDKUnsignedChannelAnnouncement val_conv;
34663 val_conv.inner = (void*)(val & (~1));
34664 val_conv.is_owned = (val & 1) || (val == 0);
34665 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34666 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34667 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34670 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) {
34671 LDKSignature node_signature_1_arg_ref;
34672 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
34673 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
34674 LDKSignature node_signature_2_arg_ref;
34675 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
34676 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
34677 LDKSignature bitcoin_signature_1_arg_ref;
34678 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
34679 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
34680 LDKSignature bitcoin_signature_2_arg_ref;
34681 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
34682 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
34683 LDKUnsignedChannelAnnouncement contents_arg_conv;
34684 contents_arg_conv.inner = (void*)(contents_arg & (~1));
34685 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
34686 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34687 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34688 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);
34689 int64_t ret_ref = 0;
34690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34693 ret_ref = (uintptr_t)ret_var.inner;
34694 if (ret_var.is_owned) {
34700 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34701 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34702 int64_t ret_ref = 0;
34703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34706 ret_ref = (uintptr_t)ret_var.inner;
34707 if (ret_var.is_owned) {
34712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34713 LDKChannelAnnouncement arg_conv;
34714 arg_conv.inner = (void*)(arg & (~1));
34715 arg_conv.is_owned = false;
34716 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34717 int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34722 LDKChannelAnnouncement orig_conv;
34723 orig_conv.inner = (void*)(orig & (~1));
34724 orig_conv.is_owned = false;
34725 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34726 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34727 int64_t ret_ref = 0;
34728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34731 ret_ref = (uintptr_t)ret_var.inner;
34732 if (ret_var.is_owned) {
34738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34739 LDKUnsignedChannelUpdate this_obj_conv;
34740 this_obj_conv.inner = (void*)(this_obj & (~1));
34741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34743 UnsignedChannelUpdate_free(this_obj_conv);
34746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34747 LDKUnsignedChannelUpdate this_ptr_conv;
34748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34749 this_ptr_conv.is_owned = false;
34750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34751 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34752 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
34756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34757 LDKUnsignedChannelUpdate this_ptr_conv;
34758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34759 this_ptr_conv.is_owned = false;
34760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34761 LDKThirtyTwoBytes val_ref;
34762 CHECK((*env)->GetArrayLength(env, val) == 32);
34763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34764 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34768 LDKUnsignedChannelUpdate this_ptr_conv;
34769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34770 this_ptr_conv.is_owned = false;
34771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34772 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34777 LDKUnsignedChannelUpdate this_ptr_conv;
34778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34779 this_ptr_conv.is_owned = false;
34780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34781 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34784 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34785 LDKUnsignedChannelUpdate this_ptr_conv;
34786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34787 this_ptr_conv.is_owned = false;
34788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34789 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34794 LDKUnsignedChannelUpdate this_ptr_conv;
34795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34796 this_ptr_conv.is_owned = false;
34797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34798 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34801 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
34802 LDKUnsignedChannelUpdate this_ptr_conv;
34803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34804 this_ptr_conv.is_owned = false;
34805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34806 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
34811 LDKUnsignedChannelUpdate this_ptr_conv;
34812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34813 this_ptr_conv.is_owned = false;
34814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34815 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34818 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34819 LDKUnsignedChannelUpdate this_ptr_conv;
34820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34821 this_ptr_conv.is_owned = false;
34822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34823 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34828 LDKUnsignedChannelUpdate this_ptr_conv;
34829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34830 this_ptr_conv.is_owned = false;
34831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34832 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34836 LDKUnsignedChannelUpdate this_ptr_conv;
34837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34838 this_ptr_conv.is_owned = false;
34839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34840 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34845 LDKUnsignedChannelUpdate this_ptr_conv;
34846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34847 this_ptr_conv.is_owned = false;
34848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34849 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34852 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34853 LDKUnsignedChannelUpdate this_ptr_conv;
34854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34855 this_ptr_conv.is_owned = false;
34856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34857 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34862 LDKUnsignedChannelUpdate this_ptr_conv;
34863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34864 this_ptr_conv.is_owned = false;
34865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34866 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34869 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34870 LDKUnsignedChannelUpdate this_ptr_conv;
34871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34872 this_ptr_conv.is_owned = false;
34873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34874 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34879 LDKUnsignedChannelUpdate this_ptr_conv;
34880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34881 this_ptr_conv.is_owned = false;
34882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34883 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34887 LDKUnsignedChannelUpdate this_ptr_conv;
34888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34889 this_ptr_conv.is_owned = false;
34890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34891 LDKCVec_u8Z val_ref;
34892 val_ref.datalen = (*env)->GetArrayLength(env, val);
34893 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34894 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34895 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34898 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34899 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34900 int64_t ret_ref = 0;
34901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34904 ret_ref = (uintptr_t)ret_var.inner;
34905 if (ret_var.is_owned) {
34910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34911 LDKUnsignedChannelUpdate arg_conv;
34912 arg_conv.inner = (void*)(arg & (~1));
34913 arg_conv.is_owned = false;
34914 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34915 int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34920 LDKUnsignedChannelUpdate orig_conv;
34921 orig_conv.inner = (void*)(orig & (~1));
34922 orig_conv.is_owned = false;
34923 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34924 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34925 int64_t ret_ref = 0;
34926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34929 ret_ref = (uintptr_t)ret_var.inner;
34930 if (ret_var.is_owned) {
34936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34937 LDKChannelUpdate this_obj_conv;
34938 this_obj_conv.inner = (void*)(this_obj & (~1));
34939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34941 ChannelUpdate_free(this_obj_conv);
34944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34945 LDKChannelUpdate this_ptr_conv;
34946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34947 this_ptr_conv.is_owned = false;
34948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34949 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34955 LDKChannelUpdate this_ptr_conv;
34956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34957 this_ptr_conv.is_owned = false;
34958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34959 LDKSignature val_ref;
34960 CHECK((*env)->GetArrayLength(env, val) == 64);
34961 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34962 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34966 LDKChannelUpdate this_ptr_conv;
34967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34968 this_ptr_conv.is_owned = false;
34969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34970 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34971 int64_t ret_ref = 0;
34972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34975 ret_ref = (uintptr_t)ret_var.inner;
34976 if (ret_var.is_owned) {
34982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34983 LDKChannelUpdate this_ptr_conv;
34984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34985 this_ptr_conv.is_owned = false;
34986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34987 LDKUnsignedChannelUpdate val_conv;
34988 val_conv.inner = (void*)(val & (~1));
34989 val_conv.is_owned = (val & 1) || (val == 0);
34990 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34991 val_conv = UnsignedChannelUpdate_clone(&val_conv);
34992 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34996 LDKSignature signature_arg_ref;
34997 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34998 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34999 LDKUnsignedChannelUpdate contents_arg_conv;
35000 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35001 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35002 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35003 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
35004 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
35005 int64_t ret_ref = 0;
35006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35009 ret_ref = (uintptr_t)ret_var.inner;
35010 if (ret_var.is_owned) {
35016 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
35017 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
35018 int64_t ret_ref = 0;
35019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35022 ret_ref = (uintptr_t)ret_var.inner;
35023 if (ret_var.is_owned) {
35028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35029 LDKChannelUpdate arg_conv;
35030 arg_conv.inner = (void*)(arg & (~1));
35031 arg_conv.is_owned = false;
35032 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35033 int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
35037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35038 LDKChannelUpdate orig_conv;
35039 orig_conv.inner = (void*)(orig & (~1));
35040 orig_conv.is_owned = false;
35041 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35042 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
35043 int64_t ret_ref = 0;
35044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35047 ret_ref = (uintptr_t)ret_var.inner;
35048 if (ret_var.is_owned) {
35054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35055 LDKQueryChannelRange this_obj_conv;
35056 this_obj_conv.inner = (void*)(this_obj & (~1));
35057 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35059 QueryChannelRange_free(this_obj_conv);
35062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35063 LDKQueryChannelRange this_ptr_conv;
35064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35065 this_ptr_conv.is_owned = false;
35066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35067 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
35072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35073 LDKQueryChannelRange this_ptr_conv;
35074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35075 this_ptr_conv.is_owned = false;
35076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35077 LDKThirtyTwoBytes val_ref;
35078 CHECK((*env)->GetArrayLength(env, val) == 32);
35079 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35080 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35083 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35084 LDKQueryChannelRange this_ptr_conv;
35085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35086 this_ptr_conv.is_owned = false;
35087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35088 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
35092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35093 LDKQueryChannelRange this_ptr_conv;
35094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35095 this_ptr_conv.is_owned = false;
35096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35097 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
35100 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35101 LDKQueryChannelRange this_ptr_conv;
35102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35103 this_ptr_conv.is_owned = false;
35104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35105 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
35109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35110 LDKQueryChannelRange this_ptr_conv;
35111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35112 this_ptr_conv.is_owned = false;
35113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35114 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35117 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) {
35118 LDKThirtyTwoBytes chain_hash_arg_ref;
35119 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35120 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35121 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
35122 int64_t ret_ref = 0;
35123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35126 ret_ref = (uintptr_t)ret_var.inner;
35127 if (ret_var.is_owned) {
35133 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
35134 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
35135 int64_t ret_ref = 0;
35136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35139 ret_ref = (uintptr_t)ret_var.inner;
35140 if (ret_var.is_owned) {
35145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35146 LDKQueryChannelRange arg_conv;
35147 arg_conv.inner = (void*)(arg & (~1));
35148 arg_conv.is_owned = false;
35149 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35150 int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
35154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35155 LDKQueryChannelRange orig_conv;
35156 orig_conv.inner = (void*)(orig & (~1));
35157 orig_conv.is_owned = false;
35158 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35159 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
35160 int64_t ret_ref = 0;
35161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35164 ret_ref = (uintptr_t)ret_var.inner;
35165 if (ret_var.is_owned) {
35171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35172 LDKReplyChannelRange this_obj_conv;
35173 this_obj_conv.inner = (void*)(this_obj & (~1));
35174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35176 ReplyChannelRange_free(this_obj_conv);
35179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35180 LDKReplyChannelRange this_ptr_conv;
35181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35182 this_ptr_conv.is_owned = false;
35183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35184 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35185 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
35189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35190 LDKReplyChannelRange this_ptr_conv;
35191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35192 this_ptr_conv.is_owned = false;
35193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35194 LDKThirtyTwoBytes val_ref;
35195 CHECK((*env)->GetArrayLength(env, val) == 32);
35196 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35197 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
35200 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35201 LDKReplyChannelRange this_ptr_conv;
35202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35203 this_ptr_conv.is_owned = false;
35204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35205 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35210 LDKReplyChannelRange this_ptr_conv;
35211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35212 this_ptr_conv.is_owned = false;
35213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35214 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35217 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35218 LDKReplyChannelRange this_ptr_conv;
35219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35220 this_ptr_conv.is_owned = false;
35221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35222 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35227 LDKReplyChannelRange this_ptr_conv;
35228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35229 this_ptr_conv.is_owned = false;
35230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35231 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
35235 LDKReplyChannelRange this_ptr_conv;
35236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35237 this_ptr_conv.is_owned = false;
35238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35239 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35244 LDKReplyChannelRange this_ptr_conv;
35245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35246 this_ptr_conv.is_owned = false;
35247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35248 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35252 LDKReplyChannelRange this_ptr_conv;
35253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35254 this_ptr_conv.is_owned = false;
35255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35256 LDKCVec_u64Z val_constr;
35257 val_constr.datalen = (*env)->GetArrayLength(env, val);
35258 if (val_constr.datalen > 0)
35259 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35261 val_constr.data = NULL;
35262 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35263 for (size_t g = 0; g < val_constr.datalen; g++) {
35264 int64_t val_conv_6 = val_vals[g];
35265 val_constr.data[g] = val_conv_6;
35267 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35268 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35271 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) {
35272 LDKThirtyTwoBytes chain_hash_arg_ref;
35273 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35274 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35275 LDKCVec_u64Z short_channel_ids_arg_constr;
35276 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35277 if (short_channel_ids_arg_constr.datalen > 0)
35278 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35280 short_channel_ids_arg_constr.data = NULL;
35281 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35282 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35283 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35284 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35286 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35287 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35288 int64_t ret_ref = 0;
35289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35292 ret_ref = (uintptr_t)ret_var.inner;
35293 if (ret_var.is_owned) {
35299 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35300 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35301 int64_t ret_ref = 0;
35302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35305 ret_ref = (uintptr_t)ret_var.inner;
35306 if (ret_var.is_owned) {
35311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35312 LDKReplyChannelRange arg_conv;
35313 arg_conv.inner = (void*)(arg & (~1));
35314 arg_conv.is_owned = false;
35315 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35316 int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35321 LDKReplyChannelRange orig_conv;
35322 orig_conv.inner = (void*)(orig & (~1));
35323 orig_conv.is_owned = false;
35324 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35325 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35326 int64_t ret_ref = 0;
35327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35330 ret_ref = (uintptr_t)ret_var.inner;
35331 if (ret_var.is_owned) {
35337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35338 LDKQueryShortChannelIds this_obj_conv;
35339 this_obj_conv.inner = (void*)(this_obj & (~1));
35340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35342 QueryShortChannelIds_free(this_obj_conv);
35345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35346 LDKQueryShortChannelIds this_ptr_conv;
35347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35348 this_ptr_conv.is_owned = false;
35349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35350 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35351 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
35355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35356 LDKQueryShortChannelIds this_ptr_conv;
35357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35358 this_ptr_conv.is_owned = false;
35359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35360 LDKThirtyTwoBytes val_ref;
35361 CHECK((*env)->GetArrayLength(env, val) == 32);
35362 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35363 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35367 LDKQueryShortChannelIds this_ptr_conv;
35368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35369 this_ptr_conv.is_owned = false;
35370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35371 LDKCVec_u64Z val_constr;
35372 val_constr.datalen = (*env)->GetArrayLength(env, val);
35373 if (val_constr.datalen > 0)
35374 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35376 val_constr.data = NULL;
35377 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35378 for (size_t g = 0; g < val_constr.datalen; g++) {
35379 int64_t val_conv_6 = val_vals[g];
35380 val_constr.data[g] = val_conv_6;
35382 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35383 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35386 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) {
35387 LDKThirtyTwoBytes chain_hash_arg_ref;
35388 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35389 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35390 LDKCVec_u64Z short_channel_ids_arg_constr;
35391 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35392 if (short_channel_ids_arg_constr.datalen > 0)
35393 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35395 short_channel_ids_arg_constr.data = NULL;
35396 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35397 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35398 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35399 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35401 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35402 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35403 int64_t ret_ref = 0;
35404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35407 ret_ref = (uintptr_t)ret_var.inner;
35408 if (ret_var.is_owned) {
35414 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35415 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35416 int64_t ret_ref = 0;
35417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35420 ret_ref = (uintptr_t)ret_var.inner;
35421 if (ret_var.is_owned) {
35426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35427 LDKQueryShortChannelIds arg_conv;
35428 arg_conv.inner = (void*)(arg & (~1));
35429 arg_conv.is_owned = false;
35430 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35431 int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35436 LDKQueryShortChannelIds orig_conv;
35437 orig_conv.inner = (void*)(orig & (~1));
35438 orig_conv.is_owned = false;
35439 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35440 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35441 int64_t ret_ref = 0;
35442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35445 ret_ref = (uintptr_t)ret_var.inner;
35446 if (ret_var.is_owned) {
35452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35453 LDKReplyShortChannelIdsEnd this_obj_conv;
35454 this_obj_conv.inner = (void*)(this_obj & (~1));
35455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35457 ReplyShortChannelIdsEnd_free(this_obj_conv);
35460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35461 LDKReplyShortChannelIdsEnd this_ptr_conv;
35462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35463 this_ptr_conv.is_owned = false;
35464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35465 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35466 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
35470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35471 LDKReplyShortChannelIdsEnd this_ptr_conv;
35472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35473 this_ptr_conv.is_owned = false;
35474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35475 LDKThirtyTwoBytes val_ref;
35476 CHECK((*env)->GetArrayLength(env, val) == 32);
35477 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35478 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
35482 LDKReplyShortChannelIdsEnd this_ptr_conv;
35483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35484 this_ptr_conv.is_owned = false;
35485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35486 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35491 LDKReplyShortChannelIdsEnd this_ptr_conv;
35492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35493 this_ptr_conv.is_owned = false;
35494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35495 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
35499 LDKThirtyTwoBytes chain_hash_arg_ref;
35500 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35501 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35502 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35503 int64_t ret_ref = 0;
35504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35507 ret_ref = (uintptr_t)ret_var.inner;
35508 if (ret_var.is_owned) {
35514 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35515 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35516 int64_t ret_ref = 0;
35517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35520 ret_ref = (uintptr_t)ret_var.inner;
35521 if (ret_var.is_owned) {
35526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35527 LDKReplyShortChannelIdsEnd arg_conv;
35528 arg_conv.inner = (void*)(arg & (~1));
35529 arg_conv.is_owned = false;
35530 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35531 int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35536 LDKReplyShortChannelIdsEnd orig_conv;
35537 orig_conv.inner = (void*)(orig & (~1));
35538 orig_conv.is_owned = false;
35539 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35540 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35541 int64_t ret_ref = 0;
35542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35545 ret_ref = (uintptr_t)ret_var.inner;
35546 if (ret_var.is_owned) {
35552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35553 LDKGossipTimestampFilter this_obj_conv;
35554 this_obj_conv.inner = (void*)(this_obj & (~1));
35555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35557 GossipTimestampFilter_free(this_obj_conv);
35560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35561 LDKGossipTimestampFilter this_ptr_conv;
35562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35563 this_ptr_conv.is_owned = false;
35564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35565 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35566 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
35570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35571 LDKGossipTimestampFilter this_ptr_conv;
35572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35573 this_ptr_conv.is_owned = false;
35574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575 LDKThirtyTwoBytes val_ref;
35576 CHECK((*env)->GetArrayLength(env, val) == 32);
35577 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35578 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35581 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35582 LDKGossipTimestampFilter 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 = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35591 LDKGossipTimestampFilter 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 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35598 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
35599 LDKGossipTimestampFilter 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 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35608 LDKGossipTimestampFilter 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 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35615 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) {
35616 LDKThirtyTwoBytes chain_hash_arg_ref;
35617 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35618 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35619 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35620 int64_t ret_ref = 0;
35621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35624 ret_ref = (uintptr_t)ret_var.inner;
35625 if (ret_var.is_owned) {
35631 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35632 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35633 int64_t ret_ref = 0;
35634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35637 ret_ref = (uintptr_t)ret_var.inner;
35638 if (ret_var.is_owned) {
35643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35644 LDKGossipTimestampFilter arg_conv;
35645 arg_conv.inner = (void*)(arg & (~1));
35646 arg_conv.is_owned = false;
35647 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35648 int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35653 LDKGossipTimestampFilter orig_conv;
35654 orig_conv.inner = (void*)(orig & (~1));
35655 orig_conv.is_owned = false;
35656 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35657 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35658 int64_t ret_ref = 0;
35659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35662 ret_ref = (uintptr_t)ret_var.inner;
35663 if (ret_var.is_owned) {
35669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35670 if ((this_ptr & 1) != 0) return;
35671 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35672 CHECK_ACCESS(this_ptr_ptr);
35673 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35674 FREE((void*)this_ptr);
35675 ErrorAction_free(this_ptr_conv);
35678 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35679 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35680 *ret_copy = ErrorAction_clone(arg);
35681 int64_t ret_ref = (uintptr_t)ret_copy;
35684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35685 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
35686 int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35691 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
35692 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35693 *ret_copy = ErrorAction_clone(orig_conv);
35694 int64_t ret_ref = (uintptr_t)ret_copy;
35698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
35699 LDKErrorMessage msg_conv;
35700 msg_conv.inner = (void*)(msg & (~1));
35701 msg_conv.is_owned = (msg & 1) || (msg == 0);
35702 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35703 msg_conv = ErrorMessage_clone(&msg_conv);
35704 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35705 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35706 int64_t ret_ref = (uintptr_t)ret_copy;
35710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
35711 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35712 *ret_copy = ErrorAction_ignore_error();
35713 int64_t ret_ref = (uintptr_t)ret_copy;
35717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
35718 LDKLevel a_conv = LDKLevel_from_java(env, a);
35719 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35720 *ret_copy = ErrorAction_ignore_and_log(a_conv);
35721 int64_t ret_ref = (uintptr_t)ret_copy;
35725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
35726 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35727 *ret_copy = ErrorAction_ignore_duplicate_gossip();
35728 int64_t ret_ref = (uintptr_t)ret_copy;
35732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
35733 LDKErrorMessage msg_conv;
35734 msg_conv.inner = (void*)(msg & (~1));
35735 msg_conv.is_owned = (msg & 1) || (msg == 0);
35736 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35737 msg_conv = ErrorMessage_clone(&msg_conv);
35738 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35739 *ret_copy = ErrorAction_send_error_message(msg_conv);
35740 int64_t ret_ref = (uintptr_t)ret_copy;
35744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
35745 LDKWarningMessage msg_conv;
35746 msg_conv.inner = (void*)(msg & (~1));
35747 msg_conv.is_owned = (msg & 1) || (msg == 0);
35748 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35749 msg_conv = WarningMessage_clone(&msg_conv);
35750 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
35751 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35752 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35753 int64_t ret_ref = (uintptr_t)ret_copy;
35757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35758 LDKLightningError this_obj_conv;
35759 this_obj_conv.inner = (void*)(this_obj & (~1));
35760 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35762 LightningError_free(this_obj_conv);
35765 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
35766 LDKLightningError this_ptr_conv;
35767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35768 this_ptr_conv.is_owned = false;
35769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35770 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35771 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35777 LDKLightningError this_ptr_conv;
35778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35779 this_ptr_conv.is_owned = false;
35780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35781 LDKStr val_conv = java_to_owned_str(env, val);
35782 LightningError_set_err(&this_ptr_conv, val_conv);
35785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
35786 LDKLightningError this_ptr_conv;
35787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35788 this_ptr_conv.is_owned = false;
35789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35790 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35791 *ret_copy = LightningError_get_action(&this_ptr_conv);
35792 int64_t ret_ref = (uintptr_t)ret_copy;
35796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35797 LDKLightningError this_ptr_conv;
35798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35799 this_ptr_conv.is_owned = false;
35800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35801 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35802 CHECK_ACCESS(val_ptr);
35803 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35804 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
35805 LightningError_set_action(&this_ptr_conv, val_conv);
35808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
35809 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
35810 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
35811 CHECK_ACCESS(action_arg_ptr);
35812 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35813 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
35814 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35815 int64_t ret_ref = 0;
35816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35819 ret_ref = (uintptr_t)ret_var.inner;
35820 if (ret_var.is_owned) {
35826 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35827 LDKLightningError ret_var = LightningError_clone(arg);
35828 int64_t ret_ref = 0;
35829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35832 ret_ref = (uintptr_t)ret_var.inner;
35833 if (ret_var.is_owned) {
35838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35839 LDKLightningError arg_conv;
35840 arg_conv.inner = (void*)(arg & (~1));
35841 arg_conv.is_owned = false;
35842 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35843 int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35848 LDKLightningError orig_conv;
35849 orig_conv.inner = (void*)(orig & (~1));
35850 orig_conv.is_owned = false;
35851 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35852 LDKLightningError ret_var = LightningError_clone(&orig_conv);
35853 int64_t ret_ref = 0;
35854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35857 ret_ref = (uintptr_t)ret_var.inner;
35858 if (ret_var.is_owned) {
35864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35865 LDKCommitmentUpdate this_obj_conv;
35866 this_obj_conv.inner = (void*)(this_obj & (~1));
35867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35869 CommitmentUpdate_free(this_obj_conv);
35872 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35873 LDKCommitmentUpdate this_ptr_conv;
35874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35875 this_ptr_conv.is_owned = false;
35876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35877 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35878 int64_tArray ret_arr = NULL;
35879 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35880 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35881 for (size_t p = 0; p < ret_var.datalen; p++) {
35882 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35883 int64_t ret_conv_15_ref = 0;
35884 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35885 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35887 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
35888 if (ret_conv_15_var.is_owned) {
35889 ret_conv_15_ref |= 1;
35891 ret_arr_ptr[p] = ret_conv_15_ref;
35893 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35894 FREE(ret_var.data);
35898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35899 LDKCommitmentUpdate this_ptr_conv;
35900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35901 this_ptr_conv.is_owned = false;
35902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35903 LDKCVec_UpdateAddHTLCZ val_constr;
35904 val_constr.datalen = (*env)->GetArrayLength(env, val);
35905 if (val_constr.datalen > 0)
35906 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35908 val_constr.data = NULL;
35909 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35910 for (size_t p = 0; p < val_constr.datalen; p++) {
35911 int64_t val_conv_15 = val_vals[p];
35912 LDKUpdateAddHTLC val_conv_15_conv;
35913 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
35914 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
35915 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35916 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35917 val_constr.data[p] = val_conv_15_conv;
35919 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35920 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35923 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35924 LDKCommitmentUpdate this_ptr_conv;
35925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35926 this_ptr_conv.is_owned = false;
35927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35928 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35929 int64_tArray ret_arr = NULL;
35930 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35931 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35932 for (size_t t = 0; t < ret_var.datalen; t++) {
35933 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35934 int64_t ret_conv_19_ref = 0;
35935 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35936 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35938 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
35939 if (ret_conv_19_var.is_owned) {
35940 ret_conv_19_ref |= 1;
35942 ret_arr_ptr[t] = ret_conv_19_ref;
35944 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35945 FREE(ret_var.data);
35949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35950 LDKCommitmentUpdate this_ptr_conv;
35951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35952 this_ptr_conv.is_owned = false;
35953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35954 LDKCVec_UpdateFulfillHTLCZ val_constr;
35955 val_constr.datalen = (*env)->GetArrayLength(env, val);
35956 if (val_constr.datalen > 0)
35957 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35959 val_constr.data = NULL;
35960 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35961 for (size_t t = 0; t < val_constr.datalen; t++) {
35962 int64_t val_conv_19 = val_vals[t];
35963 LDKUpdateFulfillHTLC val_conv_19_conv;
35964 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
35965 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
35966 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35967 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35968 val_constr.data[t] = val_conv_19_conv;
35970 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35971 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35974 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35975 LDKCommitmentUpdate this_ptr_conv;
35976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35977 this_ptr_conv.is_owned = false;
35978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35979 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35980 int64_tArray ret_arr = NULL;
35981 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35982 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35983 for (size_t q = 0; q < ret_var.datalen; q++) {
35984 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35985 int64_t ret_conv_16_ref = 0;
35986 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35987 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35989 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
35990 if (ret_conv_16_var.is_owned) {
35991 ret_conv_16_ref |= 1;
35993 ret_arr_ptr[q] = ret_conv_16_ref;
35995 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35996 FREE(ret_var.data);
36000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36001 LDKCommitmentUpdate this_ptr_conv;
36002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36003 this_ptr_conv.is_owned = false;
36004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36005 LDKCVec_UpdateFailHTLCZ val_constr;
36006 val_constr.datalen = (*env)->GetArrayLength(env, val);
36007 if (val_constr.datalen > 0)
36008 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36010 val_constr.data = NULL;
36011 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36012 for (size_t q = 0; q < val_constr.datalen; q++) {
36013 int64_t val_conv_16 = val_vals[q];
36014 LDKUpdateFailHTLC val_conv_16_conv;
36015 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
36016 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
36017 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
36018 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
36019 val_constr.data[q] = val_conv_16_conv;
36021 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36022 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
36025 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36026 LDKCommitmentUpdate this_ptr_conv;
36027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36028 this_ptr_conv.is_owned = false;
36029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36030 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
36031 int64_tArray ret_arr = NULL;
36032 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36033 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36034 for (size_t z = 0; z < ret_var.datalen; z++) {
36035 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
36036 int64_t ret_conv_25_ref = 0;
36037 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36038 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
36040 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
36041 if (ret_conv_25_var.is_owned) {
36042 ret_conv_25_ref |= 1;
36044 ret_arr_ptr[z] = ret_conv_25_ref;
36046 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36047 FREE(ret_var.data);
36051 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) {
36052 LDKCommitmentUpdate this_ptr_conv;
36053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36054 this_ptr_conv.is_owned = false;
36055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36056 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
36057 val_constr.datalen = (*env)->GetArrayLength(env, val);
36058 if (val_constr.datalen > 0)
36059 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36061 val_constr.data = NULL;
36062 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36063 for (size_t z = 0; z < val_constr.datalen; z++) {
36064 int64_t val_conv_25 = val_vals[z];
36065 LDKUpdateFailMalformedHTLC val_conv_25_conv;
36066 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
36067 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
36068 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
36069 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
36070 val_constr.data[z] = val_conv_25_conv;
36072 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36073 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
36076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
36077 LDKCommitmentUpdate this_ptr_conv;
36078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36079 this_ptr_conv.is_owned = false;
36080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36081 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
36082 int64_t ret_ref = 0;
36083 if ((uintptr_t)ret_var.inner > 4096) {
36084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36087 ret_ref = (uintptr_t)ret_var.inner;
36088 if (ret_var.is_owned) {
36095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36096 LDKCommitmentUpdate this_ptr_conv;
36097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36098 this_ptr_conv.is_owned = false;
36099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36100 LDKUpdateFee val_conv;
36101 val_conv.inner = (void*)(val & (~1));
36102 val_conv.is_owned = (val & 1) || (val == 0);
36103 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36104 val_conv = UpdateFee_clone(&val_conv);
36105 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
36108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
36109 LDKCommitmentUpdate this_ptr_conv;
36110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36111 this_ptr_conv.is_owned = false;
36112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36113 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
36114 int64_t ret_ref = 0;
36115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36118 ret_ref = (uintptr_t)ret_var.inner;
36119 if (ret_var.is_owned) {
36125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36126 LDKCommitmentUpdate this_ptr_conv;
36127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36128 this_ptr_conv.is_owned = false;
36129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130 LDKCommitmentSigned val_conv;
36131 val_conv.inner = (void*)(val & (~1));
36132 val_conv.is_owned = (val & 1) || (val == 0);
36133 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36134 val_conv = CommitmentSigned_clone(&val_conv);
36135 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
36138 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) {
36139 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
36140 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
36141 if (update_add_htlcs_arg_constr.datalen > 0)
36142 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
36144 update_add_htlcs_arg_constr.data = NULL;
36145 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
36146 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
36147 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
36148 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
36149 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
36150 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
36151 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
36152 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
36153 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
36155 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
36156 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
36157 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
36158 if (update_fulfill_htlcs_arg_constr.datalen > 0)
36159 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
36161 update_fulfill_htlcs_arg_constr.data = NULL;
36162 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
36163 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
36164 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
36165 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
36166 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
36167 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
36168 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
36169 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
36170 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
36172 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
36173 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
36174 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
36175 if (update_fail_htlcs_arg_constr.datalen > 0)
36176 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
36178 update_fail_htlcs_arg_constr.data = NULL;
36179 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
36180 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
36181 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
36182 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
36183 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
36184 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
36185 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
36186 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
36187 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
36189 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
36190 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
36191 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
36192 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
36193 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
36195 update_fail_malformed_htlcs_arg_constr.data = NULL;
36196 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
36197 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
36198 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
36199 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
36200 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
36201 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);
36202 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
36203 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
36204 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
36206 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
36207 LDKUpdateFee update_fee_arg_conv;
36208 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
36209 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
36210 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
36211 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
36212 LDKCommitmentSigned commitment_signed_arg_conv;
36213 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
36214 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
36215 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
36216 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
36217 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);
36218 int64_t ret_ref = 0;
36219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36222 ret_ref = (uintptr_t)ret_var.inner;
36223 if (ret_var.is_owned) {
36229 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36230 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36231 int64_t ret_ref = 0;
36232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36235 ret_ref = (uintptr_t)ret_var.inner;
36236 if (ret_var.is_owned) {
36241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36242 LDKCommitmentUpdate arg_conv;
36243 arg_conv.inner = (void*)(arg & (~1));
36244 arg_conv.is_owned = false;
36245 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36246 int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36251 LDKCommitmentUpdate orig_conv;
36252 orig_conv.inner = (void*)(orig & (~1));
36253 orig_conv.is_owned = false;
36254 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36255 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36256 int64_t ret_ref = 0;
36257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36260 ret_ref = (uintptr_t)ret_var.inner;
36261 if (ret_var.is_owned) {
36267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36268 if ((this_ptr & 1) != 0) return;
36269 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36270 CHECK_ACCESS(this_ptr_ptr);
36271 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36272 FREE((void*)this_ptr);
36273 ChannelMessageHandler_free(this_ptr_conv);
36276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36277 if ((this_ptr & 1) != 0) return;
36278 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36279 CHECK_ACCESS(this_ptr_ptr);
36280 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36281 FREE((void*)this_ptr);
36282 RoutingMessageHandler_free(this_ptr_conv);
36285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36286 LDKAcceptChannel obj_conv;
36287 obj_conv.inner = (void*)(obj & (~1));
36288 obj_conv.is_owned = false;
36289 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36290 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36291 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36292 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36293 CVec_u8Z_free(ret_var);
36297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36298 LDKu8slice ser_ref;
36299 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36300 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36301 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36302 *ret_conv = AcceptChannel_read(ser_ref);
36303 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36304 return (int64_t)ret_conv;
36307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36308 LDKAnnouncementSignatures obj_conv;
36309 obj_conv.inner = (void*)(obj & (~1));
36310 obj_conv.is_owned = false;
36311 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36312 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36313 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36314 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36315 CVec_u8Z_free(ret_var);
36319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36320 LDKu8slice ser_ref;
36321 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36322 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36323 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36324 *ret_conv = AnnouncementSignatures_read(ser_ref);
36325 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36326 return (int64_t)ret_conv;
36329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
36330 LDKChannelReestablish obj_conv;
36331 obj_conv.inner = (void*)(obj & (~1));
36332 obj_conv.is_owned = false;
36333 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36334 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36337 CVec_u8Z_free(ret_var);
36341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36342 LDKu8slice ser_ref;
36343 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36344 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36345 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36346 *ret_conv = ChannelReestablish_read(ser_ref);
36347 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36348 return (int64_t)ret_conv;
36351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36352 LDKClosingSigned obj_conv;
36353 obj_conv.inner = (void*)(obj & (~1));
36354 obj_conv.is_owned = false;
36355 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36356 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36357 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36358 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36359 CVec_u8Z_free(ret_var);
36363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36364 LDKu8slice ser_ref;
36365 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36366 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36367 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36368 *ret_conv = ClosingSigned_read(ser_ref);
36369 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36370 return (int64_t)ret_conv;
36373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36374 LDKClosingSignedFeeRange obj_conv;
36375 obj_conv.inner = (void*)(obj & (~1));
36376 obj_conv.is_owned = false;
36377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36378 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36381 CVec_u8Z_free(ret_var);
36385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36386 LDKu8slice ser_ref;
36387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36389 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36390 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36392 return (int64_t)ret_conv;
36395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36396 LDKCommitmentSigned obj_conv;
36397 obj_conv.inner = (void*)(obj & (~1));
36398 obj_conv.is_owned = false;
36399 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36400 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36401 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36402 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36403 CVec_u8Z_free(ret_var);
36407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36408 LDKu8slice ser_ref;
36409 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36410 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36411 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36412 *ret_conv = CommitmentSigned_read(ser_ref);
36413 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36414 return (int64_t)ret_conv;
36417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
36418 LDKFundingCreated obj_conv;
36419 obj_conv.inner = (void*)(obj & (~1));
36420 obj_conv.is_owned = false;
36421 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36422 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36423 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36424 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36425 CVec_u8Z_free(ret_var);
36429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36430 LDKu8slice ser_ref;
36431 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36432 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36433 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36434 *ret_conv = FundingCreated_read(ser_ref);
36435 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36436 return (int64_t)ret_conv;
36439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36440 LDKFundingSigned obj_conv;
36441 obj_conv.inner = (void*)(obj & (~1));
36442 obj_conv.is_owned = false;
36443 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36444 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36445 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36446 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36447 CVec_u8Z_free(ret_var);
36451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36452 LDKu8slice ser_ref;
36453 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36454 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36455 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36456 *ret_conv = FundingSigned_read(ser_ref);
36457 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36458 return (int64_t)ret_conv;
36461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
36462 LDKChannelReady obj_conv;
36463 obj_conv.inner = (void*)(obj & (~1));
36464 obj_conv.is_owned = false;
36465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36466 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36467 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36468 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36469 CVec_u8Z_free(ret_var);
36473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36474 LDKu8slice ser_ref;
36475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36477 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36478 *ret_conv = ChannelReady_read(ser_ref);
36479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36480 return (int64_t)ret_conv;
36483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
36485 obj_conv.inner = (void*)(obj & (~1));
36486 obj_conv.is_owned = false;
36487 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36488 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36489 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36490 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36491 CVec_u8Z_free(ret_var);
36495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36496 LDKu8slice ser_ref;
36497 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36498 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36499 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36500 *ret_conv = Init_read(ser_ref);
36501 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36502 return (int64_t)ret_conv;
36505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36506 LDKOpenChannel obj_conv;
36507 obj_conv.inner = (void*)(obj & (~1));
36508 obj_conv.is_owned = false;
36509 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36510 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36511 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36512 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36513 CVec_u8Z_free(ret_var);
36517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36518 LDKu8slice ser_ref;
36519 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36520 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36521 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36522 *ret_conv = OpenChannel_read(ser_ref);
36523 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36524 return (int64_t)ret_conv;
36527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
36528 LDKRevokeAndACK obj_conv;
36529 obj_conv.inner = (void*)(obj & (~1));
36530 obj_conv.is_owned = false;
36531 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36532 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36533 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36534 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36535 CVec_u8Z_free(ret_var);
36539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36540 LDKu8slice ser_ref;
36541 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36542 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36543 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36544 *ret_conv = RevokeAndACK_read(ser_ref);
36545 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36546 return (int64_t)ret_conv;
36549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
36550 LDKShutdown obj_conv;
36551 obj_conv.inner = (void*)(obj & (~1));
36552 obj_conv.is_owned = false;
36553 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36554 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36555 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36556 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36557 CVec_u8Z_free(ret_var);
36561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36562 LDKu8slice ser_ref;
36563 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36564 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36565 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36566 *ret_conv = Shutdown_read(ser_ref);
36567 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36568 return (int64_t)ret_conv;
36571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36572 LDKUpdateFailHTLC obj_conv;
36573 obj_conv.inner = (void*)(obj & (~1));
36574 obj_conv.is_owned = false;
36575 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36576 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36577 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36578 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36579 CVec_u8Z_free(ret_var);
36583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36584 LDKu8slice ser_ref;
36585 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36586 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36587 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36588 *ret_conv = UpdateFailHTLC_read(ser_ref);
36589 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36590 return (int64_t)ret_conv;
36593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36594 LDKUpdateFailMalformedHTLC obj_conv;
36595 obj_conv.inner = (void*)(obj & (~1));
36596 obj_conv.is_owned = false;
36597 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36598 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36601 CVec_u8Z_free(ret_var);
36605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36606 LDKu8slice ser_ref;
36607 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36608 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36609 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36610 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36611 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36612 return (int64_t)ret_conv;
36615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
36616 LDKUpdateFee obj_conv;
36617 obj_conv.inner = (void*)(obj & (~1));
36618 obj_conv.is_owned = false;
36619 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36620 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36621 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36622 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36623 CVec_u8Z_free(ret_var);
36627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36628 LDKu8slice ser_ref;
36629 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36630 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36631 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36632 *ret_conv = UpdateFee_read(ser_ref);
36633 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36634 return (int64_t)ret_conv;
36637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36638 LDKUpdateFulfillHTLC obj_conv;
36639 obj_conv.inner = (void*)(obj & (~1));
36640 obj_conv.is_owned = false;
36641 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36642 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36643 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36644 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36645 CVec_u8Z_free(ret_var);
36649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36650 LDKu8slice ser_ref;
36651 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36652 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36653 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36654 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36655 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36656 return (int64_t)ret_conv;
36659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36660 LDKUpdateAddHTLC obj_conv;
36661 obj_conv.inner = (void*)(obj & (~1));
36662 obj_conv.is_owned = false;
36663 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36664 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36665 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36666 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36667 CVec_u8Z_free(ret_var);
36671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36672 LDKu8slice ser_ref;
36673 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36674 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36675 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36676 *ret_conv = UpdateAddHTLC_read(ser_ref);
36677 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36678 return (int64_t)ret_conv;
36681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
36683 obj_conv.inner = (void*)(obj & (~1));
36684 obj_conv.is_owned = false;
36685 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36686 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36687 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36688 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36689 CVec_u8Z_free(ret_var);
36693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36694 LDKu8slice ser_ref;
36695 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36696 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36697 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36698 *ret_conv = Ping_read(ser_ref);
36699 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36700 return (int64_t)ret_conv;
36703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
36705 obj_conv.inner = (void*)(obj & (~1));
36706 obj_conv.is_owned = false;
36707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36708 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36709 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36710 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36711 CVec_u8Z_free(ret_var);
36715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36716 LDKu8slice ser_ref;
36717 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36718 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36719 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36720 *ret_conv = Pong_read(ser_ref);
36721 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36722 return (int64_t)ret_conv;
36725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36726 LDKUnsignedChannelAnnouncement obj_conv;
36727 obj_conv.inner = (void*)(obj & (~1));
36728 obj_conv.is_owned = false;
36729 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36730 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36731 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36732 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36733 CVec_u8Z_free(ret_var);
36737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36738 LDKu8slice ser_ref;
36739 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36740 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36741 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36742 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36743 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36744 return (int64_t)ret_conv;
36747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36748 LDKChannelAnnouncement obj_conv;
36749 obj_conv.inner = (void*)(obj & (~1));
36750 obj_conv.is_owned = false;
36751 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36752 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36753 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36754 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36755 CVec_u8Z_free(ret_var);
36759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36760 LDKu8slice ser_ref;
36761 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36762 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36763 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36764 *ret_conv = ChannelAnnouncement_read(ser_ref);
36765 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36766 return (int64_t)ret_conv;
36769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36770 LDKUnsignedChannelUpdate obj_conv;
36771 obj_conv.inner = (void*)(obj & (~1));
36772 obj_conv.is_owned = false;
36773 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36774 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36775 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36776 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36777 CVec_u8Z_free(ret_var);
36781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36782 LDKu8slice ser_ref;
36783 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36784 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36785 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36786 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36787 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36788 return (int64_t)ret_conv;
36791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36792 LDKChannelUpdate obj_conv;
36793 obj_conv.inner = (void*)(obj & (~1));
36794 obj_conv.is_owned = false;
36795 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36796 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36797 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36798 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36799 CVec_u8Z_free(ret_var);
36803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36804 LDKu8slice ser_ref;
36805 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36806 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36807 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36808 *ret_conv = ChannelUpdate_read(ser_ref);
36809 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36810 return (int64_t)ret_conv;
36813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36814 LDKErrorMessage obj_conv;
36815 obj_conv.inner = (void*)(obj & (~1));
36816 obj_conv.is_owned = false;
36817 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36818 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36819 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36820 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36821 CVec_u8Z_free(ret_var);
36825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36826 LDKu8slice ser_ref;
36827 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36828 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36829 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36830 *ret_conv = ErrorMessage_read(ser_ref);
36831 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36832 return (int64_t)ret_conv;
36835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36836 LDKWarningMessage obj_conv;
36837 obj_conv.inner = (void*)(obj & (~1));
36838 obj_conv.is_owned = false;
36839 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36840 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36841 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36842 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36843 CVec_u8Z_free(ret_var);
36847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36848 LDKu8slice ser_ref;
36849 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36850 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36851 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36852 *ret_conv = WarningMessage_read(ser_ref);
36853 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36854 return (int64_t)ret_conv;
36857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36858 LDKUnsignedNodeAnnouncement obj_conv;
36859 obj_conv.inner = (void*)(obj & (~1));
36860 obj_conv.is_owned = false;
36861 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36862 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36863 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36864 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36865 CVec_u8Z_free(ret_var);
36869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36870 LDKu8slice ser_ref;
36871 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36872 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36873 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36874 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36875 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36876 return (int64_t)ret_conv;
36879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36880 LDKNodeAnnouncement obj_conv;
36881 obj_conv.inner = (void*)(obj & (~1));
36882 obj_conv.is_owned = false;
36883 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36884 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36885 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36886 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36887 CVec_u8Z_free(ret_var);
36891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36892 LDKu8slice ser_ref;
36893 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36894 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36895 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36896 *ret_conv = NodeAnnouncement_read(ser_ref);
36897 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36898 return (int64_t)ret_conv;
36901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36902 LDKu8slice ser_ref;
36903 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36904 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36905 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36906 *ret_conv = QueryShortChannelIds_read(ser_ref);
36907 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36908 return (int64_t)ret_conv;
36911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
36912 LDKQueryShortChannelIds obj_conv;
36913 obj_conv.inner = (void*)(obj & (~1));
36914 obj_conv.is_owned = false;
36915 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36916 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36917 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36918 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36919 CVec_u8Z_free(ret_var);
36923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
36924 LDKReplyShortChannelIdsEnd obj_conv;
36925 obj_conv.inner = (void*)(obj & (~1));
36926 obj_conv.is_owned = false;
36927 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36928 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36929 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36930 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36931 CVec_u8Z_free(ret_var);
36935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36936 LDKu8slice ser_ref;
36937 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36938 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36939 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36940 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36942 return (int64_t)ret_conv;
36945 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36946 LDKQueryChannelRange this_arg_conv;
36947 this_arg_conv.inner = (void*)(this_arg & (~1));
36948 this_arg_conv.is_owned = false;
36949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36950 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36955 LDKQueryChannelRange obj_conv;
36956 obj_conv.inner = (void*)(obj & (~1));
36957 obj_conv.is_owned = false;
36958 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36959 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36960 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36961 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36962 CVec_u8Z_free(ret_var);
36966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36967 LDKu8slice ser_ref;
36968 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36969 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36970 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36971 *ret_conv = QueryChannelRange_read(ser_ref);
36972 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36973 return (int64_t)ret_conv;
36976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36977 LDKu8slice ser_ref;
36978 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36979 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36980 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36981 *ret_conv = ReplyChannelRange_read(ser_ref);
36982 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36983 return (int64_t)ret_conv;
36986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36987 LDKReplyChannelRange obj_conv;
36988 obj_conv.inner = (void*)(obj & (~1));
36989 obj_conv.is_owned = false;
36990 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36991 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36992 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36993 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36994 CVec_u8Z_free(ret_var);
36998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36999 LDKGossipTimestampFilter obj_conv;
37000 obj_conv.inner = (void*)(obj & (~1));
37001 obj_conv.is_owned = false;
37002 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37003 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
37004 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37005 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37006 CVec_u8Z_free(ret_var);
37010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37011 LDKu8slice ser_ref;
37012 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37013 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37014 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
37015 *ret_conv = GossipTimestampFilter_read(ser_ref);
37016 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37017 return (int64_t)ret_conv;
37020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37021 if ((this_ptr & 1) != 0) return;
37022 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37023 CHECK_ACCESS(this_ptr_ptr);
37024 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
37025 FREE((void*)this_ptr);
37026 CustomMessageHandler_free(this_ptr_conv);
37029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37030 LDKIgnoringMessageHandler this_obj_conv;
37031 this_obj_conv.inner = (void*)(this_obj & (~1));
37032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37034 IgnoringMessageHandler_free(this_obj_conv);
37037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
37038 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
37039 int64_t ret_ref = 0;
37040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37043 ret_ref = (uintptr_t)ret_var.inner;
37044 if (ret_var.is_owned) {
37050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37051 LDKIgnoringMessageHandler this_arg_conv;
37052 this_arg_conv.inner = (void*)(this_arg & (~1));
37053 this_arg_conv.is_owned = false;
37054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37055 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37056 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37057 return (int64_t)ret_ret;
37060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37061 LDKIgnoringMessageHandler this_arg_conv;
37062 this_arg_conv.inner = (void*)(this_arg & (~1));
37063 this_arg_conv.is_owned = false;
37064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37065 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37066 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
37067 return (int64_t)ret_ret;
37070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
37071 LDKIgnoringMessageHandler this_arg_conv;
37072 this_arg_conv.inner = (void*)(this_arg & (~1));
37073 this_arg_conv.is_owned = false;
37074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37075 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
37076 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
37077 return (int64_t)ret_ret;
37080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37081 LDKIgnoringMessageHandler this_arg_conv;
37082 this_arg_conv.inner = (void*)(this_arg & (~1));
37083 this_arg_conv.is_owned = false;
37084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37085 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
37086 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
37087 return (int64_t)ret_ret;
37090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37091 LDKErroringMessageHandler this_obj_conv;
37092 this_obj_conv.inner = (void*)(this_obj & (~1));
37093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37095 ErroringMessageHandler_free(this_obj_conv);
37098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
37099 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
37100 int64_t ret_ref = 0;
37101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37104 ret_ref = (uintptr_t)ret_var.inner;
37105 if (ret_var.is_owned) {
37111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37112 LDKErroringMessageHandler this_arg_conv;
37113 this_arg_conv.inner = (void*)(this_arg & (~1));
37114 this_arg_conv.is_owned = false;
37115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37116 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37117 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
37118 return (int64_t)ret_ret;
37121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37122 LDKErroringMessageHandler this_arg_conv;
37123 this_arg_conv.inner = (void*)(this_arg & (~1));
37124 this_arg_conv.is_owned = false;
37125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37126 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
37127 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
37128 return (int64_t)ret_ret;
37131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37132 LDKMessageHandler this_obj_conv;
37133 this_obj_conv.inner = (void*)(this_obj & (~1));
37134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37136 MessageHandler_free(this_obj_conv);
37139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
37140 LDKMessageHandler this_ptr_conv;
37141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37142 this_ptr_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37144 // WARNING: This object doesn't live past this scope, needs clone!
37145 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
37149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37150 LDKMessageHandler this_ptr_conv;
37151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37152 this_ptr_conv.is_owned = false;
37153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37154 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37155 CHECK_ACCESS(val_ptr);
37156 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
37157 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
37158 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37159 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
37161 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
37164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
37165 LDKMessageHandler this_ptr_conv;
37166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37167 this_ptr_conv.is_owned = false;
37168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37169 // WARNING: This object doesn't live past this scope, needs clone!
37170 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
37174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37175 LDKMessageHandler this_ptr_conv;
37176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37177 this_ptr_conv.is_owned = false;
37178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37179 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37180 CHECK_ACCESS(val_ptr);
37181 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
37182 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37183 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37184 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
37186 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
37189 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) {
37190 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
37191 CHECK_ACCESS(chan_handler_arg_ptr);
37192 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
37193 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
37194 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37195 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
37197 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
37198 CHECK_ACCESS(route_handler_arg_ptr);
37199 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
37200 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37201 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37202 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37204 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
37205 int64_t ret_ref = 0;
37206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37209 ret_ref = (uintptr_t)ret_var.inner;
37210 if (ret_var.is_owned) {
37216 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37217 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37218 *ret_ret = SocketDescriptor_clone(arg);
37219 return (int64_t)ret_ret;
37221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37222 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37223 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37224 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37225 int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37230 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
37231 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
37232 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37233 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37234 *ret_ret = SocketDescriptor_clone(orig_conv);
37235 return (int64_t)ret_ret;
37238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37239 if ((this_ptr & 1) != 0) return;
37240 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37241 CHECK_ACCESS(this_ptr_ptr);
37242 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37243 FREE((void*)this_ptr);
37244 SocketDescriptor_free(this_ptr_conv);
37247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37248 LDKPeerHandleError this_obj_conv;
37249 this_obj_conv.inner = (void*)(this_obj & (~1));
37250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37252 PeerHandleError_free(this_obj_conv);
37255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
37256 LDKPeerHandleError this_ptr_conv;
37257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37258 this_ptr_conv.is_owned = false;
37259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37260 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
37264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37265 LDKPeerHandleError this_ptr_conv;
37266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37267 this_ptr_conv.is_owned = false;
37268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37269 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
37272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
37273 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
37274 int64_t ret_ref = 0;
37275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37278 ret_ref = (uintptr_t)ret_var.inner;
37279 if (ret_var.is_owned) {
37285 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37286 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37287 int64_t ret_ref = 0;
37288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37291 ret_ref = (uintptr_t)ret_var.inner;
37292 if (ret_var.is_owned) {
37297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37298 LDKPeerHandleError arg_conv;
37299 arg_conv.inner = (void*)(arg & (~1));
37300 arg_conv.is_owned = false;
37301 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37302 int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37307 LDKPeerHandleError orig_conv;
37308 orig_conv.inner = (void*)(orig & (~1));
37309 orig_conv.is_owned = false;
37310 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37311 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37312 int64_t ret_ref = 0;
37313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37316 ret_ref = (uintptr_t)ret_var.inner;
37317 if (ret_var.is_owned) {
37323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37324 LDKPeerManager this_obj_conv;
37325 this_obj_conv.inner = (void*)(this_obj & (~1));
37326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37328 PeerManager_free(this_obj_conv);
37331 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) {
37332 LDKMessageHandler message_handler_conv;
37333 message_handler_conv.inner = (void*)(message_handler & (~1));
37334 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
37335 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37336 // WARNING: we need a move here but no clone is available for LDKMessageHandler
37337 LDKSecretKey our_node_secret_ref;
37338 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
37339 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
37340 unsigned char ephemeral_random_data_arr[32];
37341 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
37342 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
37343 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37344 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
37345 CHECK_ACCESS(logger_ptr);
37346 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37347 if (logger_conv.free == LDKLogger_JCalls_free) {
37348 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37349 LDKLogger_JCalls_cloned(&logger_conv);
37351 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
37352 CHECK_ACCESS(custom_message_handler_ptr);
37353 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37354 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37355 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37356 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37358 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
37359 int64_t ret_ref = 0;
37360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37363 ret_ref = (uintptr_t)ret_var.inner;
37364 if (ret_var.is_owned) {
37370 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
37371 LDKPeerManager this_arg_conv;
37372 this_arg_conv.inner = (void*)(this_arg & (~1));
37373 this_arg_conv.is_owned = false;
37374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37375 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37376 jobjectArray ret_arr = NULL;
37377 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37379 for (size_t i = 0; i < ret_var.datalen; i++) {
37380 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
37381 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
37382 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
37385 FREE(ret_var.data);
37389 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) {
37390 LDKPeerManager this_arg_conv;
37391 this_arg_conv.inner = (void*)(this_arg & (~1));
37392 this_arg_conv.is_owned = false;
37393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37394 LDKPublicKey their_node_id_ref;
37395 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
37396 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
37397 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37398 CHECK_ACCESS(descriptor_ptr);
37399 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37400 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37401 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37402 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37404 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
37405 CHECK_ACCESS(remote_network_address_ptr);
37406 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37407 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37408 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37409 return (int64_t)ret_conv;
37412 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) {
37413 LDKPeerManager this_arg_conv;
37414 this_arg_conv.inner = (void*)(this_arg & (~1));
37415 this_arg_conv.is_owned = false;
37416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37417 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37418 CHECK_ACCESS(descriptor_ptr);
37419 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37420 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37422 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37424 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
37425 CHECK_ACCESS(remote_network_address_ptr);
37426 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37427 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37428 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37429 return (int64_t)ret_conv;
37432 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) {
37433 LDKPeerManager this_arg_conv;
37434 this_arg_conv.inner = (void*)(this_arg & (~1));
37435 this_arg_conv.is_owned = false;
37436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37437 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37438 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
37439 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37440 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37441 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37442 return (int64_t)ret_conv;
37445 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) {
37446 LDKPeerManager this_arg_conv;
37447 this_arg_conv.inner = (void*)(this_arg & (~1));
37448 this_arg_conv.is_owned = false;
37449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37450 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
37451 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
37452 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37453 LDKu8slice data_ref;
37454 data_ref.datalen = (*env)->GetArrayLength(env, data);
37455 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
37456 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37457 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37458 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
37459 return (int64_t)ret_conv;
37462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37463 LDKPeerManager this_arg_conv;
37464 this_arg_conv.inner = (void*)(this_arg & (~1));
37465 this_arg_conv.is_owned = false;
37466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37467 PeerManager_process_events(&this_arg_conv);
37470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
37471 LDKPeerManager this_arg_conv;
37472 this_arg_conv.inner = (void*)(this_arg & (~1));
37473 this_arg_conv.is_owned = false;
37474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37475 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
37476 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
37477 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37478 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37481 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) {
37482 LDKPeerManager this_arg_conv;
37483 this_arg_conv.inner = (void*)(this_arg & (~1));
37484 this_arg_conv.is_owned = false;
37485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37486 LDKPublicKey node_id_ref;
37487 CHECK((*env)->GetArrayLength(env, node_id) == 33);
37488 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37489 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
37492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
37493 LDKPeerManager this_arg_conv;
37494 this_arg_conv.inner = (void*)(this_arg & (~1));
37495 this_arg_conv.is_owned = false;
37496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37497 PeerManager_disconnect_all_peers(&this_arg_conv);
37500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
37501 LDKPeerManager this_arg_conv;
37502 this_arg_conv.inner = (void*)(this_arg & (~1));
37503 this_arg_conv.is_owned = false;
37504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37505 PeerManager_timer_tick_occurred(&this_arg_conv);
37508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37509 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37514 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
37519 unsigned char commitment_seed_arr[32];
37520 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
37521 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
37522 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37523 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37524 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
37528 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) {
37529 LDKCVec_u8Z to_holder_script_ref;
37530 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37531 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37532 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37533 LDKCVec_u8Z to_counterparty_script_ref;
37534 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37535 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37536 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37537 LDKOutPoint funding_outpoint_conv;
37538 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37539 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37540 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37541 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37542 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);
37543 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37544 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37545 Transaction_free(ret_var);
37549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37550 LDKCounterpartyCommitmentSecrets this_obj_conv;
37551 this_obj_conv.inner = (void*)(this_obj & (~1));
37552 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37554 CounterpartyCommitmentSecrets_free(this_obj_conv);
37557 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37558 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37559 int64_t ret_ref = 0;
37560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37563 ret_ref = (uintptr_t)ret_var.inner;
37564 if (ret_var.is_owned) {
37569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37570 LDKCounterpartyCommitmentSecrets arg_conv;
37571 arg_conv.inner = (void*)(arg & (~1));
37572 arg_conv.is_owned = false;
37573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37574 int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37579 LDKCounterpartyCommitmentSecrets orig_conv;
37580 orig_conv.inner = (void*)(orig & (~1));
37581 orig_conv.is_owned = false;
37582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37583 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37584 int64_t ret_ref = 0;
37585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37588 ret_ref = (uintptr_t)ret_var.inner;
37589 if (ret_var.is_owned) {
37595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
37596 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37597 int64_t ret_ref = 0;
37598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37601 ret_ref = (uintptr_t)ret_var.inner;
37602 if (ret_var.is_owned) {
37608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
37609 LDKCounterpartyCommitmentSecrets this_arg_conv;
37610 this_arg_conv.inner = (void*)(this_arg & (~1));
37611 this_arg_conv.is_owned = false;
37612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37613 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37617 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) {
37618 LDKCounterpartyCommitmentSecrets this_arg_conv;
37619 this_arg_conv.inner = (void*)(this_arg & (~1));
37620 this_arg_conv.is_owned = false;
37621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37622 LDKThirtyTwoBytes secret_ref;
37623 CHECK((*env)->GetArrayLength(env, secret) == 32);
37624 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
37625 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37626 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37627 return (int64_t)ret_conv;
37630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
37631 LDKCounterpartyCommitmentSecrets this_arg_conv;
37632 this_arg_conv.inner = (void*)(this_arg & (~1));
37633 this_arg_conv.is_owned = false;
37634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37635 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
37640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
37641 LDKCounterpartyCommitmentSecrets obj_conv;
37642 obj_conv.inner = (void*)(obj & (~1));
37643 obj_conv.is_owned = false;
37644 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37645 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37646 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37647 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37648 CVec_u8Z_free(ret_var);
37652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37653 LDKu8slice ser_ref;
37654 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37655 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37656 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37657 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37658 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37659 return (int64_t)ret_conv;
37662 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) {
37663 LDKPublicKey per_commitment_point_ref;
37664 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37665 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37666 unsigned char base_secret_arr[32];
37667 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
37668 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
37669 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37670 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37671 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
37672 return (int64_t)ret_conv;
37675 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) {
37676 LDKPublicKey per_commitment_point_ref;
37677 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37678 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37679 LDKPublicKey base_point_ref;
37680 CHECK((*env)->GetArrayLength(env, base_point) == 33);
37681 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
37682 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37683 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
37684 return (int64_t)ret_conv;
37687 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) {
37688 unsigned char per_commitment_secret_arr[32];
37689 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
37690 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
37691 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37692 unsigned char countersignatory_revocation_base_secret_arr[32];
37693 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
37694 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
37695 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37696 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37697 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
37698 return (int64_t)ret_conv;
37701 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) {
37702 LDKPublicKey per_commitment_point_ref;
37703 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37704 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37705 LDKPublicKey countersignatory_revocation_base_point_ref;
37706 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
37707 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
37708 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37709 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
37710 return (int64_t)ret_conv;
37713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37714 LDKTxCreationKeys this_obj_conv;
37715 this_obj_conv.inner = (void*)(this_obj & (~1));
37716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37718 TxCreationKeys_free(this_obj_conv);
37721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37722 LDKTxCreationKeys this_ptr_conv;
37723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37724 this_ptr_conv.is_owned = false;
37725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37726 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37727 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
37731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37732 LDKTxCreationKeys this_ptr_conv;
37733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37734 this_ptr_conv.is_owned = false;
37735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37736 LDKPublicKey val_ref;
37737 CHECK((*env)->GetArrayLength(env, val) == 33);
37738 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37739 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37743 LDKTxCreationKeys this_ptr_conv;
37744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37745 this_ptr_conv.is_owned = false;
37746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37747 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
37752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37753 LDKTxCreationKeys this_ptr_conv;
37754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37755 this_ptr_conv.is_owned = false;
37756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37757 LDKPublicKey val_ref;
37758 CHECK((*env)->GetArrayLength(env, val) == 33);
37759 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37760 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37764 LDKTxCreationKeys this_ptr_conv;
37765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37766 this_ptr_conv.is_owned = false;
37767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37768 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37769 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
37773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37774 LDKTxCreationKeys this_ptr_conv;
37775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37776 this_ptr_conv.is_owned = false;
37777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37778 LDKPublicKey val_ref;
37779 CHECK((*env)->GetArrayLength(env, val) == 33);
37780 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37781 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37785 LDKTxCreationKeys this_ptr_conv;
37786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37787 this_ptr_conv.is_owned = false;
37788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37789 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
37794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37795 LDKTxCreationKeys this_ptr_conv;
37796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37797 this_ptr_conv.is_owned = false;
37798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37799 LDKPublicKey val_ref;
37800 CHECK((*env)->GetArrayLength(env, val) == 33);
37801 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37802 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37806 LDKTxCreationKeys this_ptr_conv;
37807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37808 this_ptr_conv.is_owned = false;
37809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37810 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37811 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
37815 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) {
37816 LDKTxCreationKeys this_ptr_conv;
37817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37818 this_ptr_conv.is_owned = false;
37819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37820 LDKPublicKey val_ref;
37821 CHECK((*env)->GetArrayLength(env, val) == 33);
37822 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37823 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37826 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) {
37827 LDKPublicKey per_commitment_point_arg_ref;
37828 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
37829 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
37830 LDKPublicKey revocation_key_arg_ref;
37831 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
37832 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
37833 LDKPublicKey broadcaster_htlc_key_arg_ref;
37834 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
37835 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
37836 LDKPublicKey countersignatory_htlc_key_arg_ref;
37837 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
37838 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
37839 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37840 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
37841 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
37842 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);
37843 int64_t ret_ref = 0;
37844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37847 ret_ref = (uintptr_t)ret_var.inner;
37848 if (ret_var.is_owned) {
37854 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37855 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37856 int64_t ret_ref = 0;
37857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37860 ret_ref = (uintptr_t)ret_var.inner;
37861 if (ret_var.is_owned) {
37866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37867 LDKTxCreationKeys arg_conv;
37868 arg_conv.inner = (void*)(arg & (~1));
37869 arg_conv.is_owned = false;
37870 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37871 int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37876 LDKTxCreationKeys orig_conv;
37877 orig_conv.inner = (void*)(orig & (~1));
37878 orig_conv.is_owned = false;
37879 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37880 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37881 int64_t ret_ref = 0;
37882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37885 ret_ref = (uintptr_t)ret_var.inner;
37886 if (ret_var.is_owned) {
37892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37893 LDKTxCreationKeys obj_conv;
37894 obj_conv.inner = (void*)(obj & (~1));
37895 obj_conv.is_owned = false;
37896 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37897 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37898 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37899 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37900 CVec_u8Z_free(ret_var);
37904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37905 LDKu8slice ser_ref;
37906 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37907 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37908 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37909 *ret_conv = TxCreationKeys_read(ser_ref);
37910 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37911 return (int64_t)ret_conv;
37914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37915 LDKChannelPublicKeys this_obj_conv;
37916 this_obj_conv.inner = (void*)(this_obj & (~1));
37917 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37919 ChannelPublicKeys_free(this_obj_conv);
37922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37923 LDKChannelPublicKeys this_ptr_conv;
37924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37925 this_ptr_conv.is_owned = false;
37926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37927 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37928 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37933 LDKChannelPublicKeys this_ptr_conv;
37934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37935 this_ptr_conv.is_owned = false;
37936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37937 LDKPublicKey val_ref;
37938 CHECK((*env)->GetArrayLength(env, val) == 33);
37939 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37940 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37944 LDKChannelPublicKeys this_ptr_conv;
37945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37946 this_ptr_conv.is_owned = false;
37947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37948 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37949 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37954 LDKChannelPublicKeys this_ptr_conv;
37955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37956 this_ptr_conv.is_owned = false;
37957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37958 LDKPublicKey val_ref;
37959 CHECK((*env)->GetArrayLength(env, val) == 33);
37960 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37961 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37965 LDKChannelPublicKeys this_ptr_conv;
37966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37967 this_ptr_conv.is_owned = false;
37968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37969 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37970 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37975 LDKChannelPublicKeys this_ptr_conv;
37976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37977 this_ptr_conv.is_owned = false;
37978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37979 LDKPublicKey val_ref;
37980 CHECK((*env)->GetArrayLength(env, val) == 33);
37981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37982 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37986 LDKChannelPublicKeys this_ptr_conv;
37987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37988 this_ptr_conv.is_owned = false;
37989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37990 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37991 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37996 LDKChannelPublicKeys this_ptr_conv;
37997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37998 this_ptr_conv.is_owned = false;
37999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38000 LDKPublicKey val_ref;
38001 CHECK((*env)->GetArrayLength(env, val) == 33);
38002 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38003 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38007 LDKChannelPublicKeys this_ptr_conv;
38008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38009 this_ptr_conv.is_owned = false;
38010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38011 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38012 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
38016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38017 LDKChannelPublicKeys this_ptr_conv;
38018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38019 this_ptr_conv.is_owned = false;
38020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38021 LDKPublicKey val_ref;
38022 CHECK((*env)->GetArrayLength(env, val) == 33);
38023 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38024 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
38027 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) {
38028 LDKPublicKey funding_pubkey_arg_ref;
38029 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
38030 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
38031 LDKPublicKey revocation_basepoint_arg_ref;
38032 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
38033 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
38034 LDKPublicKey payment_point_arg_ref;
38035 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
38036 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
38037 LDKPublicKey delayed_payment_basepoint_arg_ref;
38038 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
38039 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
38040 LDKPublicKey htlc_basepoint_arg_ref;
38041 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
38042 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
38043 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);
38044 int64_t ret_ref = 0;
38045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38048 ret_ref = (uintptr_t)ret_var.inner;
38049 if (ret_var.is_owned) {
38055 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
38056 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
38057 int64_t ret_ref = 0;
38058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38061 ret_ref = (uintptr_t)ret_var.inner;
38062 if (ret_var.is_owned) {
38067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38068 LDKChannelPublicKeys arg_conv;
38069 arg_conv.inner = (void*)(arg & (~1));
38070 arg_conv.is_owned = false;
38071 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38072 int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
38076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38077 LDKChannelPublicKeys orig_conv;
38078 orig_conv.inner = (void*)(orig & (~1));
38079 orig_conv.is_owned = false;
38080 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38081 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
38082 int64_t ret_ref = 0;
38083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38086 ret_ref = (uintptr_t)ret_var.inner;
38087 if (ret_var.is_owned) {
38093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
38094 LDKChannelPublicKeys obj_conv;
38095 obj_conv.inner = (void*)(obj & (~1));
38096 obj_conv.is_owned = false;
38097 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38098 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
38099 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38100 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38101 CVec_u8Z_free(ret_var);
38105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38106 LDKu8slice ser_ref;
38107 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38108 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38109 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
38110 *ret_conv = ChannelPublicKeys_read(ser_ref);
38111 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38112 return (int64_t)ret_conv;
38115 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) {
38116 LDKPublicKey per_commitment_point_ref;
38117 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38118 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38119 LDKPublicKey broadcaster_delayed_payment_base_ref;
38120 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
38121 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
38122 LDKPublicKey broadcaster_htlc_base_ref;
38123 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
38124 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
38125 LDKPublicKey countersignatory_revocation_base_ref;
38126 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
38127 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
38128 LDKPublicKey countersignatory_htlc_base_ref;
38129 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
38130 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
38131 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
38132 *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);
38133 return (int64_t)ret_conv;
38136 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) {
38137 LDKPublicKey per_commitment_point_ref;
38138 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38139 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38140 LDKChannelPublicKeys broadcaster_keys_conv;
38141 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
38142 broadcaster_keys_conv.is_owned = false;
38143 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38144 LDKChannelPublicKeys countersignatory_keys_conv;
38145 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
38146 countersignatory_keys_conv.is_owned = false;
38147 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38148 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
38149 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
38150 return (int64_t)ret_conv;
38153 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) {
38154 LDKPublicKey revocation_key_ref;
38155 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38156 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38157 LDKPublicKey broadcaster_delayed_payment_key_ref;
38158 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38159 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38160 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
38161 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38162 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38163 CVec_u8Z_free(ret_var);
38167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38168 LDKHTLCOutputInCommitment this_obj_conv;
38169 this_obj_conv.inner = (void*)(this_obj & (~1));
38170 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38172 HTLCOutputInCommitment_free(this_obj_conv);
38175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
38176 LDKHTLCOutputInCommitment this_ptr_conv;
38177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38178 this_ptr_conv.is_owned = false;
38179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38180 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
38184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38185 LDKHTLCOutputInCommitment this_ptr_conv;
38186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38187 this_ptr_conv.is_owned = false;
38188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38189 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
38192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38193 LDKHTLCOutputInCommitment this_ptr_conv;
38194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38195 this_ptr_conv.is_owned = false;
38196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38197 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
38201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38202 LDKHTLCOutputInCommitment this_ptr_conv;
38203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38204 this_ptr_conv.is_owned = false;
38205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38206 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
38209 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
38210 LDKHTLCOutputInCommitment this_ptr_conv;
38211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38212 this_ptr_conv.is_owned = false;
38213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38214 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
38218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38219 LDKHTLCOutputInCommitment this_ptr_conv;
38220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38221 this_ptr_conv.is_owned = false;
38222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38223 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
38227 LDKHTLCOutputInCommitment this_ptr_conv;
38228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38229 this_ptr_conv.is_owned = false;
38230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38231 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38232 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
38236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38237 LDKHTLCOutputInCommitment this_ptr_conv;
38238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38239 this_ptr_conv.is_owned = false;
38240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38241 LDKThirtyTwoBytes val_ref;
38242 CHECK((*env)->GetArrayLength(env, val) == 32);
38243 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38244 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38248 LDKHTLCOutputInCommitment this_ptr_conv;
38249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38250 this_ptr_conv.is_owned = false;
38251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38252 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38253 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38254 int64_t ret_ref = (uintptr_t)ret_copy;
38258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38259 LDKHTLCOutputInCommitment this_ptr_conv;
38260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38261 this_ptr_conv.is_owned = false;
38262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38263 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38264 CHECK_ACCESS(val_ptr);
38265 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38266 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
38267 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38270 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) {
38271 LDKThirtyTwoBytes payment_hash_arg_ref;
38272 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
38273 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
38274 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
38275 CHECK_ACCESS(transaction_output_index_arg_ptr);
38276 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38277 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
38278 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38279 int64_t ret_ref = 0;
38280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38283 ret_ref = (uintptr_t)ret_var.inner;
38284 if (ret_var.is_owned) {
38290 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38291 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38292 int64_t ret_ref = 0;
38293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38296 ret_ref = (uintptr_t)ret_var.inner;
38297 if (ret_var.is_owned) {
38302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38303 LDKHTLCOutputInCommitment arg_conv;
38304 arg_conv.inner = (void*)(arg & (~1));
38305 arg_conv.is_owned = false;
38306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38307 int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38312 LDKHTLCOutputInCommitment orig_conv;
38313 orig_conv.inner = (void*)(orig & (~1));
38314 orig_conv.is_owned = false;
38315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38316 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38317 int64_t ret_ref = 0;
38318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38321 ret_ref = (uintptr_t)ret_var.inner;
38322 if (ret_var.is_owned) {
38328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
38329 LDKHTLCOutputInCommitment obj_conv;
38330 obj_conv.inner = (void*)(obj & (~1));
38331 obj_conv.is_owned = false;
38332 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38333 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38334 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38335 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38336 CVec_u8Z_free(ret_var);
38340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38341 LDKu8slice ser_ref;
38342 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38343 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38344 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38345 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38346 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38347 return (int64_t)ret_conv;
38350 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) {
38351 LDKHTLCOutputInCommitment htlc_conv;
38352 htlc_conv.inner = (void*)(htlc & (~1));
38353 htlc_conv.is_owned = false;
38354 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38355 LDKTxCreationKeys keys_conv;
38356 keys_conv.inner = (void*)(keys & (~1));
38357 keys_conv.is_owned = false;
38358 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38359 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38360 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38361 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38362 CVec_u8Z_free(ret_var);
38366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
38367 LDKPublicKey broadcaster_ref;
38368 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
38369 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
38370 LDKPublicKey countersignatory_ref;
38371 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
38372 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
38373 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38374 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38375 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38376 CVec_u8Z_free(ret_var);
38380 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) {
38381 unsigned char commitment_txid_arr[32];
38382 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
38383 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
38384 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
38385 LDKHTLCOutputInCommitment htlc_conv;
38386 htlc_conv.inner = (void*)(htlc & (~1));
38387 htlc_conv.is_owned = false;
38388 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38389 LDKPublicKey broadcaster_delayed_payment_key_ref;
38390 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38391 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38392 LDKPublicKey revocation_key_ref;
38393 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38394 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38395 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);
38396 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38397 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38398 Transaction_free(ret_var);
38402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
38403 LDKPublicKey funding_pubkey_ref;
38404 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
38405 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
38406 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38407 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38408 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38409 CVec_u8Z_free(ret_var);
38413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38414 LDKChannelTransactionParameters this_obj_conv;
38415 this_obj_conv.inner = (void*)(this_obj & (~1));
38416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38418 ChannelTransactionParameters_free(this_obj_conv);
38421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38422 LDKChannelTransactionParameters this_ptr_conv;
38423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38424 this_ptr_conv.is_owned = false;
38425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38426 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38427 int64_t ret_ref = 0;
38428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38431 ret_ref = (uintptr_t)ret_var.inner;
38432 if (ret_var.is_owned) {
38438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38439 LDKChannelTransactionParameters this_ptr_conv;
38440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38441 this_ptr_conv.is_owned = false;
38442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38443 LDKChannelPublicKeys val_conv;
38444 val_conv.inner = (void*)(val & (~1));
38445 val_conv.is_owned = (val & 1) || (val == 0);
38446 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38447 val_conv = ChannelPublicKeys_clone(&val_conv);
38448 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38451 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38452 LDKChannelTransactionParameters this_ptr_conv;
38453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38454 this_ptr_conv.is_owned = false;
38455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38456 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38460 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) {
38461 LDKChannelTransactionParameters this_ptr_conv;
38462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38463 this_ptr_conv.is_owned = false;
38464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38465 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
38469 LDKChannelTransactionParameters this_ptr_conv;
38470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38471 this_ptr_conv.is_owned = false;
38472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38473 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38478 LDKChannelTransactionParameters this_ptr_conv;
38479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38480 this_ptr_conv.is_owned = false;
38481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38482 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
38486 LDKChannelTransactionParameters this_ptr_conv;
38487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38488 this_ptr_conv.is_owned = false;
38489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38490 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38491 int64_t ret_ref = 0;
38492 if ((uintptr_t)ret_var.inner > 4096) {
38493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38496 ret_ref = (uintptr_t)ret_var.inner;
38497 if (ret_var.is_owned) {
38504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38505 LDKChannelTransactionParameters this_ptr_conv;
38506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38507 this_ptr_conv.is_owned = false;
38508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38509 LDKCounterpartyChannelTransactionParameters val_conv;
38510 val_conv.inner = (void*)(val & (~1));
38511 val_conv.is_owned = (val & 1) || (val == 0);
38512 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38513 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38514 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38518 LDKChannelTransactionParameters this_ptr_conv;
38519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38520 this_ptr_conv.is_owned = false;
38521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38522 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38523 int64_t ret_ref = 0;
38524 if ((uintptr_t)ret_var.inner > 4096) {
38525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38528 ret_ref = (uintptr_t)ret_var.inner;
38529 if (ret_var.is_owned) {
38536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38537 LDKChannelTransactionParameters this_ptr_conv;
38538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38539 this_ptr_conv.is_owned = false;
38540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38541 LDKOutPoint val_conv;
38542 val_conv.inner = (void*)(val & (~1));
38543 val_conv.is_owned = (val & 1) || (val == 0);
38544 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38545 val_conv = OutPoint_clone(&val_conv);
38546 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
38550 LDKChannelTransactionParameters this_ptr_conv;
38551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38552 this_ptr_conv.is_owned = false;
38553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38554 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38559 LDKChannelTransactionParameters this_ptr_conv;
38560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38561 this_ptr_conv.is_owned = false;
38562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38563 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
38564 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38567 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) {
38568 LDKChannelPublicKeys holder_pubkeys_arg_conv;
38569 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
38570 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
38571 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38572 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38573 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38574 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
38575 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
38576 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38577 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38578 LDKOutPoint funding_outpoint_arg_conv;
38579 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
38580 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
38581 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38582 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38583 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
38584 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);
38585 int64_t ret_ref = 0;
38586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38589 ret_ref = (uintptr_t)ret_var.inner;
38590 if (ret_var.is_owned) {
38596 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38597 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38598 int64_t ret_ref = 0;
38599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38602 ret_ref = (uintptr_t)ret_var.inner;
38603 if (ret_var.is_owned) {
38608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38609 LDKChannelTransactionParameters arg_conv;
38610 arg_conv.inner = (void*)(arg & (~1));
38611 arg_conv.is_owned = false;
38612 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38613 int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38618 LDKChannelTransactionParameters orig_conv;
38619 orig_conv.inner = (void*)(orig & (~1));
38620 orig_conv.is_owned = false;
38621 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38622 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38623 int64_t ret_ref = 0;
38624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38627 ret_ref = (uintptr_t)ret_var.inner;
38628 if (ret_var.is_owned) {
38634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38635 LDKCounterpartyChannelTransactionParameters this_obj_conv;
38636 this_obj_conv.inner = (void*)(this_obj & (~1));
38637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38639 CounterpartyChannelTransactionParameters_free(this_obj_conv);
38642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38643 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38645 this_ptr_conv.is_owned = false;
38646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38647 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38648 int64_t ret_ref = 0;
38649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38652 ret_ref = (uintptr_t)ret_var.inner;
38653 if (ret_var.is_owned) {
38659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38660 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38662 this_ptr_conv.is_owned = false;
38663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38664 LDKChannelPublicKeys val_conv;
38665 val_conv.inner = (void*)(val & (~1));
38666 val_conv.is_owned = (val & 1) || (val == 0);
38667 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38668 val_conv = ChannelPublicKeys_clone(&val_conv);
38669 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38672 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38673 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38675 this_ptr_conv.is_owned = false;
38676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38677 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38682 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38684 this_ptr_conv.is_owned = false;
38685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38686 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38689 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) {
38690 LDKChannelPublicKeys pubkeys_arg_conv;
38691 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
38692 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
38693 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38694 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38695 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38696 int64_t ret_ref = 0;
38697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38700 ret_ref = (uintptr_t)ret_var.inner;
38701 if (ret_var.is_owned) {
38707 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38708 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38709 int64_t ret_ref = 0;
38710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38713 ret_ref = (uintptr_t)ret_var.inner;
38714 if (ret_var.is_owned) {
38719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38720 LDKCounterpartyChannelTransactionParameters arg_conv;
38721 arg_conv.inner = (void*)(arg & (~1));
38722 arg_conv.is_owned = false;
38723 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38724 int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38729 LDKCounterpartyChannelTransactionParameters orig_conv;
38730 orig_conv.inner = (void*)(orig & (~1));
38731 orig_conv.is_owned = false;
38732 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38733 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38734 int64_t ret_ref = 0;
38735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38738 ret_ref = (uintptr_t)ret_var.inner;
38739 if (ret_var.is_owned) {
38745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
38746 LDKChannelTransactionParameters this_arg_conv;
38747 this_arg_conv.inner = (void*)(this_arg & (~1));
38748 this_arg_conv.is_owned = false;
38749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38750 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38755 LDKChannelTransactionParameters this_arg_conv;
38756 this_arg_conv.inner = (void*)(this_arg & (~1));
38757 this_arg_conv.is_owned = false;
38758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38759 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38760 int64_t ret_ref = 0;
38761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38764 ret_ref = (uintptr_t)ret_var.inner;
38765 if (ret_var.is_owned) {
38771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38772 LDKChannelTransactionParameters this_arg_conv;
38773 this_arg_conv.inner = (void*)(this_arg & (~1));
38774 this_arg_conv.is_owned = false;
38775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38776 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38777 int64_t ret_ref = 0;
38778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38781 ret_ref = (uintptr_t)ret_var.inner;
38782 if (ret_var.is_owned) {
38788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38789 LDKCounterpartyChannelTransactionParameters obj_conv;
38790 obj_conv.inner = (void*)(obj & (~1));
38791 obj_conv.is_owned = false;
38792 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38793 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38794 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38795 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38796 CVec_u8Z_free(ret_var);
38800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38801 LDKu8slice ser_ref;
38802 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38803 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38804 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38805 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38806 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38807 return (int64_t)ret_conv;
38810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38811 LDKChannelTransactionParameters obj_conv;
38812 obj_conv.inner = (void*)(obj & (~1));
38813 obj_conv.is_owned = false;
38814 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38815 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38816 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38817 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38818 CVec_u8Z_free(ret_var);
38822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38823 LDKu8slice ser_ref;
38824 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38825 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38826 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38827 *ret_conv = ChannelTransactionParameters_read(ser_ref);
38828 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38829 return (int64_t)ret_conv;
38832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38833 LDKDirectedChannelTransactionParameters this_obj_conv;
38834 this_obj_conv.inner = (void*)(this_obj & (~1));
38835 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38837 DirectedChannelTransactionParameters_free(this_obj_conv);
38840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38841 LDKDirectedChannelTransactionParameters this_arg_conv;
38842 this_arg_conv.inner = (void*)(this_arg & (~1));
38843 this_arg_conv.is_owned = false;
38844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38845 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38846 int64_t ret_ref = 0;
38847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38850 ret_ref = (uintptr_t)ret_var.inner;
38851 if (ret_var.is_owned) {
38857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38858 LDKDirectedChannelTransactionParameters this_arg_conv;
38859 this_arg_conv.inner = (void*)(this_arg & (~1));
38860 this_arg_conv.is_owned = false;
38861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38862 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38863 int64_t ret_ref = 0;
38864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38867 ret_ref = (uintptr_t)ret_var.inner;
38868 if (ret_var.is_owned) {
38874 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
38875 LDKDirectedChannelTransactionParameters this_arg_conv;
38876 this_arg_conv.inner = (void*)(this_arg & (~1));
38877 this_arg_conv.is_owned = false;
38878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38879 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
38884 LDKDirectedChannelTransactionParameters this_arg_conv;
38885 this_arg_conv.inner = (void*)(this_arg & (~1));
38886 this_arg_conv.is_owned = false;
38887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38888 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
38893 LDKDirectedChannelTransactionParameters this_arg_conv;
38894 this_arg_conv.inner = (void*)(this_arg & (~1));
38895 this_arg_conv.is_owned = false;
38896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38897 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38898 int64_t ret_ref = 0;
38899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38902 ret_ref = (uintptr_t)ret_var.inner;
38903 if (ret_var.is_owned) {
38909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38910 LDKDirectedChannelTransactionParameters this_arg_conv;
38911 this_arg_conv.inner = (void*)(this_arg & (~1));
38912 this_arg_conv.is_owned = false;
38913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38914 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38919 LDKHolderCommitmentTransaction this_obj_conv;
38920 this_obj_conv.inner = (void*)(this_obj & (~1));
38921 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38923 HolderCommitmentTransaction_free(this_obj_conv);
38926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
38927 LDKHolderCommitmentTransaction this_ptr_conv;
38928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38929 this_ptr_conv.is_owned = false;
38930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38931 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38937 LDKHolderCommitmentTransaction this_ptr_conv;
38938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38939 this_ptr_conv.is_owned = false;
38940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38941 LDKSignature val_ref;
38942 CHECK((*env)->GetArrayLength(env, val) == 64);
38943 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38944 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38948 LDKHolderCommitmentTransaction this_ptr_conv;
38949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38950 this_ptr_conv.is_owned = false;
38951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38952 LDKCVec_SignatureZ val_constr;
38953 val_constr.datalen = (*env)->GetArrayLength(env, val);
38954 if (val_constr.datalen > 0)
38955 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38957 val_constr.data = NULL;
38958 for (size_t i = 0; i < val_constr.datalen; i++) {
38959 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38960 LDKSignature val_conv_8_ref;
38961 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38962 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38963 val_constr.data[i] = val_conv_8_ref;
38965 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38968 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38969 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38970 int64_t ret_ref = 0;
38971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38974 ret_ref = (uintptr_t)ret_var.inner;
38975 if (ret_var.is_owned) {
38980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38981 LDKHolderCommitmentTransaction arg_conv;
38982 arg_conv.inner = (void*)(arg & (~1));
38983 arg_conv.is_owned = false;
38984 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38985 int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38990 LDKHolderCommitmentTransaction orig_conv;
38991 orig_conv.inner = (void*)(orig & (~1));
38992 orig_conv.is_owned = false;
38993 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38994 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38995 int64_t ret_ref = 0;
38996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38999 ret_ref = (uintptr_t)ret_var.inner;
39000 if (ret_var.is_owned) {
39006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39007 LDKHolderCommitmentTransaction obj_conv;
39008 obj_conv.inner = (void*)(obj & (~1));
39009 obj_conv.is_owned = false;
39010 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39011 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
39012 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39013 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39014 CVec_u8Z_free(ret_var);
39018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39019 LDKu8slice ser_ref;
39020 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39021 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39022 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
39023 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
39024 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39025 return (int64_t)ret_conv;
39028 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) {
39029 LDKCommitmentTransaction commitment_tx_conv;
39030 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
39031 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
39032 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
39033 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
39034 LDKSignature counterparty_sig_ref;
39035 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
39036 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
39037 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
39038 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
39039 if (counterparty_htlc_sigs_constr.datalen > 0)
39040 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39042 counterparty_htlc_sigs_constr.data = NULL;
39043 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
39044 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
39045 LDKSignature counterparty_htlc_sigs_conv_8_ref;
39046 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
39047 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
39048 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
39050 LDKPublicKey holder_funding_key_ref;
39051 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
39052 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
39053 LDKPublicKey counterparty_funding_key_ref;
39054 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
39055 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
39056 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
39057 int64_t ret_ref = 0;
39058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39061 ret_ref = (uintptr_t)ret_var.inner;
39062 if (ret_var.is_owned) {
39068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39069 LDKBuiltCommitmentTransaction this_obj_conv;
39070 this_obj_conv.inner = (void*)(this_obj & (~1));
39071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39073 BuiltCommitmentTransaction_free(this_obj_conv);
39076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
39077 LDKBuiltCommitmentTransaction this_ptr_conv;
39078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39079 this_ptr_conv.is_owned = false;
39080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39081 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
39082 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39083 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39084 Transaction_free(ret_var);
39088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39089 LDKBuiltCommitmentTransaction this_ptr_conv;
39090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39091 this_ptr_conv.is_owned = false;
39092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39093 LDKTransaction val_ref;
39094 val_ref.datalen = (*env)->GetArrayLength(env, val);
39095 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
39096 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39097 val_ref.data_is_owned = true;
39098 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
39101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
39102 LDKBuiltCommitmentTransaction this_ptr_conv;
39103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39104 this_ptr_conv.is_owned = false;
39105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39106 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39107 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
39111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39112 LDKBuiltCommitmentTransaction this_ptr_conv;
39113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39114 this_ptr_conv.is_owned = false;
39115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39116 LDKThirtyTwoBytes val_ref;
39117 CHECK((*env)->GetArrayLength(env, val) == 32);
39118 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39119 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
39122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
39123 LDKTransaction transaction_arg_ref;
39124 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
39125 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
39126 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
39127 transaction_arg_ref.data_is_owned = true;
39128 LDKThirtyTwoBytes txid_arg_ref;
39129 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
39130 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
39131 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
39132 int64_t ret_ref = 0;
39133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39136 ret_ref = (uintptr_t)ret_var.inner;
39137 if (ret_var.is_owned) {
39143 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
39144 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
39145 int64_t ret_ref = 0;
39146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39149 ret_ref = (uintptr_t)ret_var.inner;
39150 if (ret_var.is_owned) {
39155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39156 LDKBuiltCommitmentTransaction arg_conv;
39157 arg_conv.inner = (void*)(arg & (~1));
39158 arg_conv.is_owned = false;
39159 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39160 int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
39164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39165 LDKBuiltCommitmentTransaction orig_conv;
39166 orig_conv.inner = (void*)(orig & (~1));
39167 orig_conv.is_owned = false;
39168 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39169 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
39170 int64_t ret_ref = 0;
39171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39174 ret_ref = (uintptr_t)ret_var.inner;
39175 if (ret_var.is_owned) {
39181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39182 LDKBuiltCommitmentTransaction obj_conv;
39183 obj_conv.inner = (void*)(obj & (~1));
39184 obj_conv.is_owned = false;
39185 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39186 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
39187 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39188 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39189 CVec_u8Z_free(ret_var);
39193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39194 LDKu8slice ser_ref;
39195 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39196 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39197 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
39198 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
39199 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39200 return (int64_t)ret_conv;
39203 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) {
39204 LDKBuiltCommitmentTransaction this_arg_conv;
39205 this_arg_conv.inner = (void*)(this_arg & (~1));
39206 this_arg_conv.is_owned = false;
39207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39208 LDKu8slice funding_redeemscript_ref;
39209 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39210 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39211 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39212 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39213 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39217 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) {
39218 LDKBuiltCommitmentTransaction this_arg_conv;
39219 this_arg_conv.inner = (void*)(this_arg & (~1));
39220 this_arg_conv.is_owned = false;
39221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39222 unsigned char funding_key_arr[32];
39223 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39224 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39225 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39226 LDKu8slice funding_redeemscript_ref;
39227 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39228 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39229 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39230 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39231 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39236 LDKClosingTransaction this_obj_conv;
39237 this_obj_conv.inner = (void*)(this_obj & (~1));
39238 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39240 ClosingTransaction_free(this_obj_conv);
39243 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
39244 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
39245 int64_t ret_ref = 0;
39246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39249 ret_ref = (uintptr_t)ret_var.inner;
39250 if (ret_var.is_owned) {
39255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39256 LDKClosingTransaction arg_conv;
39257 arg_conv.inner = (void*)(arg & (~1));
39258 arg_conv.is_owned = false;
39259 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39260 int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
39264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39265 LDKClosingTransaction orig_conv;
39266 orig_conv.inner = (void*)(orig & (~1));
39267 orig_conv.is_owned = false;
39268 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39269 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39270 int64_t ret_ref = 0;
39271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39274 ret_ref = (uintptr_t)ret_var.inner;
39275 if (ret_var.is_owned) {
39281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
39282 LDKClosingTransaction o_conv;
39283 o_conv.inner = (void*)(o & (~1));
39284 o_conv.is_owned = false;
39285 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39286 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39290 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) {
39291 LDKCVec_u8Z to_holder_script_ref;
39292 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
39293 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39294 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
39295 LDKCVec_u8Z to_counterparty_script_ref;
39296 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
39297 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39298 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
39299 LDKOutPoint funding_outpoint_conv;
39300 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
39301 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
39302 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39303 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39304 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39305 int64_t ret_ref = 0;
39306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39309 ret_ref = (uintptr_t)ret_var.inner;
39310 if (ret_var.is_owned) {
39316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39317 LDKClosingTransaction this_arg_conv;
39318 this_arg_conv.inner = (void*)(this_arg & (~1));
39319 this_arg_conv.is_owned = false;
39320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39321 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39322 int64_t ret_ref = 0;
39323 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39324 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39325 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39326 ret_ref = (uintptr_t)ret_var.inner;
39327 if (ret_var.is_owned) {
39333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
39334 LDKClosingTransaction this_arg_conv;
39335 this_arg_conv.inner = (void*)(this_arg & (~1));
39336 this_arg_conv.is_owned = false;
39337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39338 LDKOutPoint funding_outpoint_conv;
39339 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
39340 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
39341 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39342 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39343 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39344 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39345 return (int64_t)ret_conv;
39348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39349 LDKClosingTransaction this_arg_conv;
39350 this_arg_conv.inner = (void*)(this_arg & (~1));
39351 this_arg_conv.is_owned = false;
39352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39353 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39358 LDKClosingTransaction this_arg_conv;
39359 this_arg_conv.inner = (void*)(this_arg & (~1));
39360 this_arg_conv.is_owned = false;
39361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39362 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39367 LDKClosingTransaction this_arg_conv;
39368 this_arg_conv.inner = (void*)(this_arg & (~1));
39369 this_arg_conv.is_owned = false;
39370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39371 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39372 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39373 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39377 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39378 LDKClosingTransaction this_arg_conv;
39379 this_arg_conv.inner = (void*)(this_arg & (~1));
39380 this_arg_conv.is_owned = false;
39381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39382 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39383 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39384 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39389 LDKTrustedClosingTransaction this_obj_conv;
39390 this_obj_conv.inner = (void*)(this_obj & (~1));
39391 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39393 TrustedClosingTransaction_free(this_obj_conv);
39396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39397 LDKTrustedClosingTransaction this_arg_conv;
39398 this_arg_conv.inner = (void*)(this_arg & (~1));
39399 this_arg_conv.is_owned = false;
39400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39401 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39402 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39403 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39404 Transaction_free(ret_var);
39408 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) {
39409 LDKTrustedClosingTransaction this_arg_conv;
39410 this_arg_conv.inner = (void*)(this_arg & (~1));
39411 this_arg_conv.is_owned = false;
39412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39413 LDKu8slice funding_redeemscript_ref;
39414 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39415 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39416 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39417 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39418 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39422 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) {
39423 LDKTrustedClosingTransaction this_arg_conv;
39424 this_arg_conv.inner = (void*)(this_arg & (~1));
39425 this_arg_conv.is_owned = false;
39426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39427 unsigned char funding_key_arr[32];
39428 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39429 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39430 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39431 LDKu8slice funding_redeemscript_ref;
39432 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39433 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39434 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39436 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39441 LDKCommitmentTransaction this_obj_conv;
39442 this_obj_conv.inner = (void*)(this_obj & (~1));
39443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39445 CommitmentTransaction_free(this_obj_conv);
39448 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39449 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39450 int64_t ret_ref = 0;
39451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39454 ret_ref = (uintptr_t)ret_var.inner;
39455 if (ret_var.is_owned) {
39460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39461 LDKCommitmentTransaction arg_conv;
39462 arg_conv.inner = (void*)(arg & (~1));
39463 arg_conv.is_owned = false;
39464 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39465 int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39470 LDKCommitmentTransaction orig_conv;
39471 orig_conv.inner = (void*)(orig & (~1));
39472 orig_conv.is_owned = false;
39473 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39474 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39475 int64_t ret_ref = 0;
39476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39479 ret_ref = (uintptr_t)ret_var.inner;
39480 if (ret_var.is_owned) {
39486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39487 LDKCommitmentTransaction obj_conv;
39488 obj_conv.inner = (void*)(obj & (~1));
39489 obj_conv.is_owned = false;
39490 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39491 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39492 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39493 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39494 CVec_u8Z_free(ret_var);
39498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39499 LDKu8slice ser_ref;
39500 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39501 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39502 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39503 *ret_conv = CommitmentTransaction_read(ser_ref);
39504 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39505 return (int64_t)ret_conv;
39508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
39509 LDKCommitmentTransaction this_arg_conv;
39510 this_arg_conv.inner = (void*)(this_arg & (~1));
39511 this_arg_conv.is_owned = false;
39512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39513 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39518 LDKCommitmentTransaction this_arg_conv;
39519 this_arg_conv.inner = (void*)(this_arg & (~1));
39520 this_arg_conv.is_owned = false;
39521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39522 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39527 LDKCommitmentTransaction this_arg_conv;
39528 this_arg_conv.inner = (void*)(this_arg & (~1));
39529 this_arg_conv.is_owned = false;
39530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39531 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39535 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
39536 LDKCommitmentTransaction this_arg_conv;
39537 this_arg_conv.inner = (void*)(this_arg & (~1));
39538 this_arg_conv.is_owned = false;
39539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39540 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39545 LDKCommitmentTransaction this_arg_conv;
39546 this_arg_conv.inner = (void*)(this_arg & (~1));
39547 this_arg_conv.is_owned = false;
39548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39549 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39550 int64_t ret_ref = 0;
39551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39554 ret_ref = (uintptr_t)ret_var.inner;
39555 if (ret_var.is_owned) {
39561 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) {
39562 LDKCommitmentTransaction this_arg_conv;
39563 this_arg_conv.inner = (void*)(this_arg & (~1));
39564 this_arg_conv.is_owned = false;
39565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39566 LDKDirectedChannelTransactionParameters channel_parameters_conv;
39567 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
39568 channel_parameters_conv.is_owned = false;
39569 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39570 LDKChannelPublicKeys broadcaster_keys_conv;
39571 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
39572 broadcaster_keys_conv.is_owned = false;
39573 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39574 LDKChannelPublicKeys countersignatory_keys_conv;
39575 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
39576 countersignatory_keys_conv.is_owned = false;
39577 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39578 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39579 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39580 return (int64_t)ret_conv;
39583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39584 LDKTrustedCommitmentTransaction this_obj_conv;
39585 this_obj_conv.inner = (void*)(this_obj & (~1));
39586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39588 TrustedCommitmentTransaction_free(this_obj_conv);
39591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
39592 LDKTrustedCommitmentTransaction this_arg_conv;
39593 this_arg_conv.inner = (void*)(this_arg & (~1));
39594 this_arg_conv.is_owned = false;
39595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39596 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
39601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39602 LDKTrustedCommitmentTransaction this_arg_conv;
39603 this_arg_conv.inner = (void*)(this_arg & (~1));
39604 this_arg_conv.is_owned = false;
39605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39606 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39607 int64_t ret_ref = 0;
39608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39611 ret_ref = (uintptr_t)ret_var.inner;
39612 if (ret_var.is_owned) {
39618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
39619 LDKTrustedCommitmentTransaction this_arg_conv;
39620 this_arg_conv.inner = (void*)(this_arg & (~1));
39621 this_arg_conv.is_owned = false;
39622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39623 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39624 int64_t ret_ref = 0;
39625 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39626 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39628 ret_ref = (uintptr_t)ret_var.inner;
39629 if (ret_var.is_owned) {
39635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
39636 LDKTrustedCommitmentTransaction this_arg_conv;
39637 this_arg_conv.inner = (void*)(this_arg & (~1));
39638 this_arg_conv.is_owned = false;
39639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39640 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39644 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) {
39645 LDKTrustedCommitmentTransaction this_arg_conv;
39646 this_arg_conv.inner = (void*)(this_arg & (~1));
39647 this_arg_conv.is_owned = false;
39648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39649 unsigned char htlc_base_key_arr[32];
39650 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
39651 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
39652 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39653 LDKDirectedChannelTransactionParameters channel_parameters_conv;
39654 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
39655 channel_parameters_conv.is_owned = false;
39656 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39657 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39658 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39659 return (int64_t)ret_conv;
39662 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) {
39663 LDKPublicKey broadcaster_payment_basepoint_ref;
39664 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
39665 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
39666 LDKPublicKey countersignatory_payment_basepoint_ref;
39667 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
39668 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
39669 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39674 LDKInitFeatures a_conv;
39675 a_conv.inner = (void*)(a & (~1));
39676 a_conv.is_owned = false;
39677 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39678 LDKInitFeatures b_conv;
39679 b_conv.inner = (void*)(b & (~1));
39680 b_conv.is_owned = false;
39681 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39682 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39687 LDKNodeFeatures a_conv;
39688 a_conv.inner = (void*)(a & (~1));
39689 a_conv.is_owned = false;
39690 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39691 LDKNodeFeatures b_conv;
39692 b_conv.inner = (void*)(b & (~1));
39693 b_conv.is_owned = false;
39694 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39695 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39700 LDKChannelFeatures a_conv;
39701 a_conv.inner = (void*)(a & (~1));
39702 a_conv.is_owned = false;
39703 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39704 LDKChannelFeatures b_conv;
39705 b_conv.inner = (void*)(b & (~1));
39706 b_conv.is_owned = false;
39707 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39708 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39713 LDKInvoiceFeatures a_conv;
39714 a_conv.inner = (void*)(a & (~1));
39715 a_conv.is_owned = false;
39716 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39717 LDKInvoiceFeatures b_conv;
39718 b_conv.inner = (void*)(b & (~1));
39719 b_conv.is_owned = false;
39720 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39721 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39726 LDKChannelTypeFeatures a_conv;
39727 a_conv.inner = (void*)(a & (~1));
39728 a_conv.is_owned = false;
39729 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39730 LDKChannelTypeFeatures b_conv;
39731 b_conv.inner = (void*)(b & (~1));
39732 b_conv.is_owned = false;
39733 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39734 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39738 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39739 LDKInitFeatures ret_var = InitFeatures_clone(arg);
39740 int64_t ret_ref = 0;
39741 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39742 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39744 ret_ref = (uintptr_t)ret_var.inner;
39745 if (ret_var.is_owned) {
39750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39751 LDKInitFeatures arg_conv;
39752 arg_conv.inner = (void*)(arg & (~1));
39753 arg_conv.is_owned = false;
39754 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39755 int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39760 LDKInitFeatures orig_conv;
39761 orig_conv.inner = (void*)(orig & (~1));
39762 orig_conv.is_owned = false;
39763 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39764 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39765 int64_t ret_ref = 0;
39766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39769 ret_ref = (uintptr_t)ret_var.inner;
39770 if (ret_var.is_owned) {
39776 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39777 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39778 int64_t ret_ref = 0;
39779 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39780 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39782 ret_ref = (uintptr_t)ret_var.inner;
39783 if (ret_var.is_owned) {
39788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39789 LDKNodeFeatures arg_conv;
39790 arg_conv.inner = (void*)(arg & (~1));
39791 arg_conv.is_owned = false;
39792 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39793 int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39798 LDKNodeFeatures orig_conv;
39799 orig_conv.inner = (void*)(orig & (~1));
39800 orig_conv.is_owned = false;
39801 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39802 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39803 int64_t ret_ref = 0;
39804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39807 ret_ref = (uintptr_t)ret_var.inner;
39808 if (ret_var.is_owned) {
39814 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39815 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39816 int64_t ret_ref = 0;
39817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39820 ret_ref = (uintptr_t)ret_var.inner;
39821 if (ret_var.is_owned) {
39826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39827 LDKChannelFeatures arg_conv;
39828 arg_conv.inner = (void*)(arg & (~1));
39829 arg_conv.is_owned = false;
39830 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39831 int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39836 LDKChannelFeatures orig_conv;
39837 orig_conv.inner = (void*)(orig & (~1));
39838 orig_conv.is_owned = false;
39839 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39840 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39841 int64_t ret_ref = 0;
39842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39845 ret_ref = (uintptr_t)ret_var.inner;
39846 if (ret_var.is_owned) {
39852 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39853 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39854 int64_t ret_ref = 0;
39855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39858 ret_ref = (uintptr_t)ret_var.inner;
39859 if (ret_var.is_owned) {
39864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39865 LDKInvoiceFeatures arg_conv;
39866 arg_conv.inner = (void*)(arg & (~1));
39867 arg_conv.is_owned = false;
39868 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39869 int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39874 LDKInvoiceFeatures orig_conv;
39875 orig_conv.inner = (void*)(orig & (~1));
39876 orig_conv.is_owned = false;
39877 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39878 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39879 int64_t ret_ref = 0;
39880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39883 ret_ref = (uintptr_t)ret_var.inner;
39884 if (ret_var.is_owned) {
39890 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39891 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39892 int64_t ret_ref = 0;
39893 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39894 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39896 ret_ref = (uintptr_t)ret_var.inner;
39897 if (ret_var.is_owned) {
39902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39903 LDKChannelTypeFeatures arg_conv;
39904 arg_conv.inner = (void*)(arg & (~1));
39905 arg_conv.is_owned = false;
39906 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39907 int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39912 LDKChannelTypeFeatures orig_conv;
39913 orig_conv.inner = (void*)(orig & (~1));
39914 orig_conv.is_owned = false;
39915 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39916 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39917 int64_t ret_ref = 0;
39918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39921 ret_ref = (uintptr_t)ret_var.inner;
39922 if (ret_var.is_owned) {
39928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39929 LDKInitFeatures this_obj_conv;
39930 this_obj_conv.inner = (void*)(this_obj & (~1));
39931 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39933 InitFeatures_free(this_obj_conv);
39936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39937 LDKNodeFeatures this_obj_conv;
39938 this_obj_conv.inner = (void*)(this_obj & (~1));
39939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39941 NodeFeatures_free(this_obj_conv);
39944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39945 LDKChannelFeatures this_obj_conv;
39946 this_obj_conv.inner = (void*)(this_obj & (~1));
39947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39949 ChannelFeatures_free(this_obj_conv);
39952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39953 LDKInvoiceFeatures this_obj_conv;
39954 this_obj_conv.inner = (void*)(this_obj & (~1));
39955 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39957 InvoiceFeatures_free(this_obj_conv);
39960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39961 LDKChannelTypeFeatures this_obj_conv;
39962 this_obj_conv.inner = (void*)(this_obj & (~1));
39963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39965 ChannelTypeFeatures_free(this_obj_conv);
39968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39969 LDKInitFeatures ret_var = InitFeatures_empty();
39970 int64_t ret_ref = 0;
39971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39974 ret_ref = (uintptr_t)ret_var.inner;
39975 if (ret_var.is_owned) {
39981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39982 LDKInitFeatures ret_var = InitFeatures_known();
39983 int64_t ret_ref = 0;
39984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39987 ret_ref = (uintptr_t)ret_var.inner;
39988 if (ret_var.is_owned) {
39994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39995 LDKInitFeatures this_arg_conv;
39996 this_arg_conv.inner = (void*)(this_arg & (~1));
39997 this_arg_conv.is_owned = false;
39998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39999 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
40003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
40004 LDKNodeFeatures ret_var = NodeFeatures_empty();
40005 int64_t ret_ref = 0;
40006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40009 ret_ref = (uintptr_t)ret_var.inner;
40010 if (ret_var.is_owned) {
40016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
40017 LDKNodeFeatures ret_var = NodeFeatures_known();
40018 int64_t ret_ref = 0;
40019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40022 ret_ref = (uintptr_t)ret_var.inner;
40023 if (ret_var.is_owned) {
40029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40030 LDKNodeFeatures this_arg_conv;
40031 this_arg_conv.inner = (void*)(this_arg & (~1));
40032 this_arg_conv.is_owned = false;
40033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40034 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
40038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
40039 LDKChannelFeatures ret_var = ChannelFeatures_empty();
40040 int64_t ret_ref = 0;
40041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40044 ret_ref = (uintptr_t)ret_var.inner;
40045 if (ret_var.is_owned) {
40051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
40052 LDKChannelFeatures ret_var = ChannelFeatures_known();
40053 int64_t ret_ref = 0;
40054 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40055 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40057 ret_ref = (uintptr_t)ret_var.inner;
40058 if (ret_var.is_owned) {
40064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40065 LDKChannelFeatures this_arg_conv;
40066 this_arg_conv.inner = (void*)(this_arg & (~1));
40067 this_arg_conv.is_owned = false;
40068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40069 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
40073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
40074 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
40075 int64_t ret_ref = 0;
40076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40079 ret_ref = (uintptr_t)ret_var.inner;
40080 if (ret_var.is_owned) {
40086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
40087 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
40088 int64_t ret_ref = 0;
40089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40092 ret_ref = (uintptr_t)ret_var.inner;
40093 if (ret_var.is_owned) {
40099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40100 LDKInvoiceFeatures this_arg_conv;
40101 this_arg_conv.inner = (void*)(this_arg & (~1));
40102 this_arg_conv.is_owned = false;
40103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40104 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
40108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
40109 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
40110 int64_t ret_ref = 0;
40111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40114 ret_ref = (uintptr_t)ret_var.inner;
40115 if (ret_var.is_owned) {
40121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
40122 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
40123 int64_t ret_ref = 0;
40124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40127 ret_ref = (uintptr_t)ret_var.inner;
40128 if (ret_var.is_owned) {
40134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
40135 LDKChannelTypeFeatures this_arg_conv;
40136 this_arg_conv.inner = (void*)(this_arg & (~1));
40137 this_arg_conv.is_owned = false;
40138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40139 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
40143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40144 LDKInitFeatures obj_conv;
40145 obj_conv.inner = (void*)(obj & (~1));
40146 obj_conv.is_owned = false;
40147 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40148 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
40149 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40150 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40151 CVec_u8Z_free(ret_var);
40155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40156 LDKu8slice ser_ref;
40157 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40158 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40159 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
40160 *ret_conv = InitFeatures_read(ser_ref);
40161 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40162 return (int64_t)ret_conv;
40165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40166 LDKChannelFeatures obj_conv;
40167 obj_conv.inner = (void*)(obj & (~1));
40168 obj_conv.is_owned = false;
40169 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40170 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
40171 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40172 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40173 CVec_u8Z_free(ret_var);
40177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40178 LDKu8slice ser_ref;
40179 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40180 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40181 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
40182 *ret_conv = ChannelFeatures_read(ser_ref);
40183 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40184 return (int64_t)ret_conv;
40187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40188 LDKNodeFeatures obj_conv;
40189 obj_conv.inner = (void*)(obj & (~1));
40190 obj_conv.is_owned = false;
40191 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40192 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
40193 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40194 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40195 CVec_u8Z_free(ret_var);
40199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40200 LDKu8slice ser_ref;
40201 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40202 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40203 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
40204 *ret_conv = NodeFeatures_read(ser_ref);
40205 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40206 return (int64_t)ret_conv;
40209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40210 LDKInvoiceFeatures obj_conv;
40211 obj_conv.inner = (void*)(obj & (~1));
40212 obj_conv.is_owned = false;
40213 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40214 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
40215 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40216 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40217 CVec_u8Z_free(ret_var);
40221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40222 LDKu8slice ser_ref;
40223 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40224 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40225 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
40226 *ret_conv = InvoiceFeatures_read(ser_ref);
40227 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40228 return (int64_t)ret_conv;
40231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40232 LDKChannelTypeFeatures obj_conv;
40233 obj_conv.inner = (void*)(obj & (~1));
40234 obj_conv.is_owned = false;
40235 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40236 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
40237 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40238 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40239 CVec_u8Z_free(ret_var);
40243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40244 LDKu8slice ser_ref;
40245 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40246 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40247 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
40248 *ret_conv = ChannelTypeFeatures_read(ser_ref);
40249 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40250 return (int64_t)ret_conv;
40253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40254 LDKInitFeatures this_arg_conv;
40255 this_arg_conv.inner = (void*)(this_arg & (~1));
40256 this_arg_conv.is_owned = false;
40257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40258 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
40261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40262 LDKInitFeatures this_arg_conv;
40263 this_arg_conv.inner = (void*)(this_arg & (~1));
40264 this_arg_conv.is_owned = false;
40265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40266 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
40269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40270 LDKInitFeatures this_arg_conv;
40271 this_arg_conv.inner = (void*)(this_arg & (~1));
40272 this_arg_conv.is_owned = false;
40273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40274 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
40278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40279 LDKNodeFeatures this_arg_conv;
40280 this_arg_conv.inner = (void*)(this_arg & (~1));
40281 this_arg_conv.is_owned = false;
40282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40283 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
40286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40287 LDKNodeFeatures this_arg_conv;
40288 this_arg_conv.inner = (void*)(this_arg & (~1));
40289 this_arg_conv.is_owned = false;
40290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40291 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
40294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40295 LDKNodeFeatures this_arg_conv;
40296 this_arg_conv.inner = (void*)(this_arg & (~1));
40297 this_arg_conv.is_owned = false;
40298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40299 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
40303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40304 LDKInitFeatures this_arg_conv;
40305 this_arg_conv.inner = (void*)(this_arg & (~1));
40306 this_arg_conv.is_owned = false;
40307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40308 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
40313 LDKNodeFeatures this_arg_conv;
40314 this_arg_conv.inner = (void*)(this_arg & (~1));
40315 this_arg_conv.is_owned = false;
40316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40317 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40322 LDKInitFeatures this_arg_conv;
40323 this_arg_conv.inner = (void*)(this_arg & (~1));
40324 this_arg_conv.is_owned = false;
40325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40326 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40330 LDKInitFeatures this_arg_conv;
40331 this_arg_conv.inner = (void*)(this_arg & (~1));
40332 this_arg_conv.is_owned = false;
40333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40334 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
40338 LDKInitFeatures this_arg_conv;
40339 this_arg_conv.inner = (void*)(this_arg & (~1));
40340 this_arg_conv.is_owned = false;
40341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40342 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40347 LDKInitFeatures this_arg_conv;
40348 this_arg_conv.inner = (void*)(this_arg & (~1));
40349 this_arg_conv.is_owned = false;
40350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40351 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40355 LDKInitFeatures this_arg_conv;
40356 this_arg_conv.inner = (void*)(this_arg & (~1));
40357 this_arg_conv.is_owned = false;
40358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40359 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40363 LDKInitFeatures this_arg_conv;
40364 this_arg_conv.inner = (void*)(this_arg & (~1));
40365 this_arg_conv.is_owned = false;
40366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40367 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40372 LDKNodeFeatures this_arg_conv;
40373 this_arg_conv.inner = (void*)(this_arg & (~1));
40374 this_arg_conv.is_owned = false;
40375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40376 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40380 LDKNodeFeatures this_arg_conv;
40381 this_arg_conv.inner = (void*)(this_arg & (~1));
40382 this_arg_conv.is_owned = false;
40383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40384 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40388 LDKNodeFeatures this_arg_conv;
40389 this_arg_conv.inner = (void*)(this_arg & (~1));
40390 this_arg_conv.is_owned = false;
40391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40392 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40397 LDKInitFeatures this_arg_conv;
40398 this_arg_conv.inner = (void*)(this_arg & (~1));
40399 this_arg_conv.is_owned = false;
40400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40401 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40406 LDKNodeFeatures this_arg_conv;
40407 this_arg_conv.inner = (void*)(this_arg & (~1));
40408 this_arg_conv.is_owned = false;
40409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40410 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40415 LDKInitFeatures this_arg_conv;
40416 this_arg_conv.inner = (void*)(this_arg & (~1));
40417 this_arg_conv.is_owned = false;
40418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40419 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40423 LDKInitFeatures this_arg_conv;
40424 this_arg_conv.inner = (void*)(this_arg & (~1));
40425 this_arg_conv.is_owned = false;
40426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40427 InitFeatures_set_gossip_queries_required(&this_arg_conv);
40430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40431 LDKInitFeatures this_arg_conv;
40432 this_arg_conv.inner = (void*)(this_arg & (~1));
40433 this_arg_conv.is_owned = false;
40434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40435 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40440 LDKNodeFeatures this_arg_conv;
40441 this_arg_conv.inner = (void*)(this_arg & (~1));
40442 this_arg_conv.is_owned = false;
40443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40444 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40448 LDKNodeFeatures this_arg_conv;
40449 this_arg_conv.inner = (void*)(this_arg & (~1));
40450 this_arg_conv.is_owned = false;
40451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40452 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40456 LDKNodeFeatures this_arg_conv;
40457 this_arg_conv.inner = (void*)(this_arg & (~1));
40458 this_arg_conv.is_owned = false;
40459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40460 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40465 LDKInitFeatures this_arg_conv;
40466 this_arg_conv.inner = (void*)(this_arg & (~1));
40467 this_arg_conv.is_owned = false;
40468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40469 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40474 LDKNodeFeatures this_arg_conv;
40475 this_arg_conv.inner = (void*)(this_arg & (~1));
40476 this_arg_conv.is_owned = false;
40477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40478 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40483 LDKInitFeatures this_arg_conv;
40484 this_arg_conv.inner = (void*)(this_arg & (~1));
40485 this_arg_conv.is_owned = false;
40486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40487 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40491 LDKInitFeatures this_arg_conv;
40492 this_arg_conv.inner = (void*)(this_arg & (~1));
40493 this_arg_conv.is_owned = false;
40494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40495 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40499 LDKInitFeatures 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 = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40508 LDKNodeFeatures this_arg_conv;
40509 this_arg_conv.inner = (void*)(this_arg & (~1));
40510 this_arg_conv.is_owned = false;
40511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40512 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40516 LDKNodeFeatures this_arg_conv;
40517 this_arg_conv.inner = (void*)(this_arg & (~1));
40518 this_arg_conv.is_owned = false;
40519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40520 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40524 LDKNodeFeatures this_arg_conv;
40525 this_arg_conv.inner = (void*)(this_arg & (~1));
40526 this_arg_conv.is_owned = false;
40527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40528 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40533 LDKInvoiceFeatures this_arg_conv;
40534 this_arg_conv.inner = (void*)(this_arg & (~1));
40535 this_arg_conv.is_owned = false;
40536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40537 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40541 LDKInvoiceFeatures this_arg_conv;
40542 this_arg_conv.inner = (void*)(this_arg & (~1));
40543 this_arg_conv.is_owned = false;
40544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40545 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40549 LDKInvoiceFeatures this_arg_conv;
40550 this_arg_conv.inner = (void*)(this_arg & (~1));
40551 this_arg_conv.is_owned = false;
40552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40553 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40558 LDKInitFeatures this_arg_conv;
40559 this_arg_conv.inner = (void*)(this_arg & (~1));
40560 this_arg_conv.is_owned = false;
40561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40562 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40567 LDKNodeFeatures this_arg_conv;
40568 this_arg_conv.inner = (void*)(this_arg & (~1));
40569 this_arg_conv.is_owned = false;
40570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40571 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40576 LDKInvoiceFeatures this_arg_conv;
40577 this_arg_conv.inner = (void*)(this_arg & (~1));
40578 this_arg_conv.is_owned = false;
40579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40580 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40585 LDKInitFeatures this_arg_conv;
40586 this_arg_conv.inner = (void*)(this_arg & (~1));
40587 this_arg_conv.is_owned = false;
40588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40589 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40593 LDKInitFeatures this_arg_conv;
40594 this_arg_conv.inner = (void*)(this_arg & (~1));
40595 this_arg_conv.is_owned = false;
40596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40597 InitFeatures_set_static_remote_key_required(&this_arg_conv);
40600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40601 LDKInitFeatures this_arg_conv;
40602 this_arg_conv.inner = (void*)(this_arg & (~1));
40603 this_arg_conv.is_owned = false;
40604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40605 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40610 LDKNodeFeatures this_arg_conv;
40611 this_arg_conv.inner = (void*)(this_arg & (~1));
40612 this_arg_conv.is_owned = false;
40613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40614 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40618 LDKNodeFeatures 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 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40626 LDKNodeFeatures 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 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40635 LDKChannelTypeFeatures this_arg_conv;
40636 this_arg_conv.inner = (void*)(this_arg & (~1));
40637 this_arg_conv.is_owned = false;
40638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40639 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40643 LDKChannelTypeFeatures 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 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40651 LDKChannelTypeFeatures 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 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40660 LDKInitFeatures this_arg_conv;
40661 this_arg_conv.inner = (void*)(this_arg & (~1));
40662 this_arg_conv.is_owned = false;
40663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40664 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40669 LDKNodeFeatures this_arg_conv;
40670 this_arg_conv.inner = (void*)(this_arg & (~1));
40671 this_arg_conv.is_owned = false;
40672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40673 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40678 LDKChannelTypeFeatures this_arg_conv;
40679 this_arg_conv.inner = (void*)(this_arg & (~1));
40680 this_arg_conv.is_owned = false;
40681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40682 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40687 LDKInitFeatures this_arg_conv;
40688 this_arg_conv.inner = (void*)(this_arg & (~1));
40689 this_arg_conv.is_owned = false;
40690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40691 InitFeatures_set_payment_secret_optional(&this_arg_conv);
40694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40695 LDKInitFeatures this_arg_conv;
40696 this_arg_conv.inner = (void*)(this_arg & (~1));
40697 this_arg_conv.is_owned = false;
40698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40699 InitFeatures_set_payment_secret_required(&this_arg_conv);
40702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40703 LDKInitFeatures this_arg_conv;
40704 this_arg_conv.inner = (void*)(this_arg & (~1));
40705 this_arg_conv.is_owned = false;
40706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40707 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40712 LDKNodeFeatures this_arg_conv;
40713 this_arg_conv.inner = (void*)(this_arg & (~1));
40714 this_arg_conv.is_owned = false;
40715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40716 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40720 LDKNodeFeatures this_arg_conv;
40721 this_arg_conv.inner = (void*)(this_arg & (~1));
40722 this_arg_conv.is_owned = false;
40723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40724 NodeFeatures_set_payment_secret_required(&this_arg_conv);
40727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40728 LDKNodeFeatures this_arg_conv;
40729 this_arg_conv.inner = (void*)(this_arg & (~1));
40730 this_arg_conv.is_owned = false;
40731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40732 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40737 LDKInvoiceFeatures this_arg_conv;
40738 this_arg_conv.inner = (void*)(this_arg & (~1));
40739 this_arg_conv.is_owned = false;
40740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40741 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40745 LDKInvoiceFeatures this_arg_conv;
40746 this_arg_conv.inner = (void*)(this_arg & (~1));
40747 this_arg_conv.is_owned = false;
40748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40749 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40753 LDKInvoiceFeatures this_arg_conv;
40754 this_arg_conv.inner = (void*)(this_arg & (~1));
40755 this_arg_conv.is_owned = false;
40756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40757 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40762 LDKInitFeatures this_arg_conv;
40763 this_arg_conv.inner = (void*)(this_arg & (~1));
40764 this_arg_conv.is_owned = false;
40765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40766 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40771 LDKNodeFeatures this_arg_conv;
40772 this_arg_conv.inner = (void*)(this_arg & (~1));
40773 this_arg_conv.is_owned = false;
40774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40775 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40780 LDKInvoiceFeatures this_arg_conv;
40781 this_arg_conv.inner = (void*)(this_arg & (~1));
40782 this_arg_conv.is_owned = false;
40783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40784 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40789 LDKInitFeatures this_arg_conv;
40790 this_arg_conv.inner = (void*)(this_arg & (~1));
40791 this_arg_conv.is_owned = false;
40792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40793 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40797 LDKInitFeatures this_arg_conv;
40798 this_arg_conv.inner = (void*)(this_arg & (~1));
40799 this_arg_conv.is_owned = false;
40800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40801 InitFeatures_set_basic_mpp_required(&this_arg_conv);
40804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40805 LDKInitFeatures this_arg_conv;
40806 this_arg_conv.inner = (void*)(this_arg & (~1));
40807 this_arg_conv.is_owned = false;
40808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40809 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40814 LDKNodeFeatures this_arg_conv;
40815 this_arg_conv.inner = (void*)(this_arg & (~1));
40816 this_arg_conv.is_owned = false;
40817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40818 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40822 LDKNodeFeatures this_arg_conv;
40823 this_arg_conv.inner = (void*)(this_arg & (~1));
40824 this_arg_conv.is_owned = false;
40825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40826 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40830 LDKNodeFeatures this_arg_conv;
40831 this_arg_conv.inner = (void*)(this_arg & (~1));
40832 this_arg_conv.is_owned = false;
40833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40834 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40839 LDKInvoiceFeatures this_arg_conv;
40840 this_arg_conv.inner = (void*)(this_arg & (~1));
40841 this_arg_conv.is_owned = false;
40842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40843 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40847 LDKInvoiceFeatures 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 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40855 LDKInvoiceFeatures 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 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40864 LDKInitFeatures this_arg_conv;
40865 this_arg_conv.inner = (void*)(this_arg & (~1));
40866 this_arg_conv.is_owned = false;
40867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40868 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40873 LDKNodeFeatures this_arg_conv;
40874 this_arg_conv.inner = (void*)(this_arg & (~1));
40875 this_arg_conv.is_owned = false;
40876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40877 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40882 LDKInvoiceFeatures this_arg_conv;
40883 this_arg_conv.inner = (void*)(this_arg & (~1));
40884 this_arg_conv.is_owned = false;
40885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40886 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40891 LDKInitFeatures this_arg_conv;
40892 this_arg_conv.inner = (void*)(this_arg & (~1));
40893 this_arg_conv.is_owned = false;
40894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40895 InitFeatures_set_wumbo_optional(&this_arg_conv);
40898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40899 LDKInitFeatures this_arg_conv;
40900 this_arg_conv.inner = (void*)(this_arg & (~1));
40901 this_arg_conv.is_owned = false;
40902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40903 InitFeatures_set_wumbo_required(&this_arg_conv);
40906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40907 LDKInitFeatures this_arg_conv;
40908 this_arg_conv.inner = (void*)(this_arg & (~1));
40909 this_arg_conv.is_owned = false;
40910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40911 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40916 LDKNodeFeatures this_arg_conv;
40917 this_arg_conv.inner = (void*)(this_arg & (~1));
40918 this_arg_conv.is_owned = false;
40919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40920 NodeFeatures_set_wumbo_optional(&this_arg_conv);
40923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40924 LDKNodeFeatures this_arg_conv;
40925 this_arg_conv.inner = (void*)(this_arg & (~1));
40926 this_arg_conv.is_owned = false;
40927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40928 NodeFeatures_set_wumbo_required(&this_arg_conv);
40931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40932 LDKNodeFeatures this_arg_conv;
40933 this_arg_conv.inner = (void*)(this_arg & (~1));
40934 this_arg_conv.is_owned = false;
40935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40941 LDKInitFeatures this_arg_conv;
40942 this_arg_conv.inner = (void*)(this_arg & (~1));
40943 this_arg_conv.is_owned = false;
40944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40945 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40950 LDKNodeFeatures this_arg_conv;
40951 this_arg_conv.inner = (void*)(this_arg & (~1));
40952 this_arg_conv.is_owned = false;
40953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40954 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40959 LDKInitFeatures this_arg_conv;
40960 this_arg_conv.inner = (void*)(this_arg & (~1));
40961 this_arg_conv.is_owned = false;
40962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40963 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40967 LDKInitFeatures this_arg_conv;
40968 this_arg_conv.inner = (void*)(this_arg & (~1));
40969 this_arg_conv.is_owned = false;
40970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40971 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40975 LDKInitFeatures this_arg_conv;
40976 this_arg_conv.inner = (void*)(this_arg & (~1));
40977 this_arg_conv.is_owned = false;
40978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40979 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40984 LDKNodeFeatures this_arg_conv;
40985 this_arg_conv.inner = (void*)(this_arg & (~1));
40986 this_arg_conv.is_owned = false;
40987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40988 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40992 LDKNodeFeatures this_arg_conv;
40993 this_arg_conv.inner = (void*)(this_arg & (~1));
40994 this_arg_conv.is_owned = false;
40995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40996 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41000 LDKNodeFeatures this_arg_conv;
41001 this_arg_conv.inner = (void*)(this_arg & (~1));
41002 this_arg_conv.is_owned = false;
41003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41004 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
41008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41009 LDKInitFeatures this_arg_conv;
41010 this_arg_conv.inner = (void*)(this_arg & (~1));
41011 this_arg_conv.is_owned = false;
41012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41013 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
41018 LDKNodeFeatures this_arg_conv;
41019 this_arg_conv.inner = (void*)(this_arg & (~1));
41020 this_arg_conv.is_owned = false;
41021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41022 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
41026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41027 LDKInitFeatures this_arg_conv;
41028 this_arg_conv.inner = (void*)(this_arg & (~1));
41029 this_arg_conv.is_owned = false;
41030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41031 InitFeatures_set_channel_type_optional(&this_arg_conv);
41034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41035 LDKInitFeatures this_arg_conv;
41036 this_arg_conv.inner = (void*)(this_arg & (~1));
41037 this_arg_conv.is_owned = false;
41038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41039 InitFeatures_set_channel_type_required(&this_arg_conv);
41042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41043 LDKInitFeatures this_arg_conv;
41044 this_arg_conv.inner = (void*)(this_arg & (~1));
41045 this_arg_conv.is_owned = false;
41046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41047 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
41051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41052 LDKNodeFeatures this_arg_conv;
41053 this_arg_conv.inner = (void*)(this_arg & (~1));
41054 this_arg_conv.is_owned = false;
41055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41056 NodeFeatures_set_channel_type_optional(&this_arg_conv);
41059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41060 LDKNodeFeatures this_arg_conv;
41061 this_arg_conv.inner = (void*)(this_arg & (~1));
41062 this_arg_conv.is_owned = false;
41063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41064 NodeFeatures_set_channel_type_required(&this_arg_conv);
41067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41068 LDKNodeFeatures this_arg_conv;
41069 this_arg_conv.inner = (void*)(this_arg & (~1));
41070 this_arg_conv.is_owned = false;
41071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41072 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
41076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41077 LDKInitFeatures this_arg_conv;
41078 this_arg_conv.inner = (void*)(this_arg & (~1));
41079 this_arg_conv.is_owned = false;
41080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41081 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
41085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
41086 LDKNodeFeatures this_arg_conv;
41087 this_arg_conv.inner = (void*)(this_arg & (~1));
41088 this_arg_conv.is_owned = false;
41089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41090 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
41094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41095 LDKInitFeatures this_arg_conv;
41096 this_arg_conv.inner = (void*)(this_arg & (~1));
41097 this_arg_conv.is_owned = false;
41098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41099 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
41102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41103 LDKInitFeatures this_arg_conv;
41104 this_arg_conv.inner = (void*)(this_arg & (~1));
41105 this_arg_conv.is_owned = false;
41106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41107 InitFeatures_set_scid_privacy_required(&this_arg_conv);
41110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41111 LDKInitFeatures this_arg_conv;
41112 this_arg_conv.inner = (void*)(this_arg & (~1));
41113 this_arg_conv.is_owned = false;
41114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41115 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
41119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41120 LDKNodeFeatures this_arg_conv;
41121 this_arg_conv.inner = (void*)(this_arg & (~1));
41122 this_arg_conv.is_owned = false;
41123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41124 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
41127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41128 LDKNodeFeatures this_arg_conv;
41129 this_arg_conv.inner = (void*)(this_arg & (~1));
41130 this_arg_conv.is_owned = false;
41131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41132 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
41135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41136 LDKNodeFeatures this_arg_conv;
41137 this_arg_conv.inner = (void*)(this_arg & (~1));
41138 this_arg_conv.is_owned = false;
41139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41140 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
41144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41145 LDKChannelTypeFeatures this_arg_conv;
41146 this_arg_conv.inner = (void*)(this_arg & (~1));
41147 this_arg_conv.is_owned = false;
41148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41149 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
41152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41153 LDKChannelTypeFeatures 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 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
41160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41161 LDKChannelTypeFeatures 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 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
41169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41170 LDKInitFeatures this_arg_conv;
41171 this_arg_conv.inner = (void*)(this_arg & (~1));
41172 this_arg_conv.is_owned = false;
41173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
41178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41179 LDKNodeFeatures this_arg_conv;
41180 this_arg_conv.inner = (void*)(this_arg & (~1));
41181 this_arg_conv.is_owned = false;
41182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41183 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
41187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
41188 LDKChannelTypeFeatures this_arg_conv;
41189 this_arg_conv.inner = (void*)(this_arg & (~1));
41190 this_arg_conv.is_owned = false;
41191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41192 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
41196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41197 LDKInitFeatures this_arg_conv;
41198 this_arg_conv.inner = (void*)(this_arg & (~1));
41199 this_arg_conv.is_owned = false;
41200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41201 InitFeatures_set_zero_conf_optional(&this_arg_conv);
41204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41205 LDKInitFeatures this_arg_conv;
41206 this_arg_conv.inner = (void*)(this_arg & (~1));
41207 this_arg_conv.is_owned = false;
41208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41209 InitFeatures_set_zero_conf_required(&this_arg_conv);
41212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41213 LDKInitFeatures this_arg_conv;
41214 this_arg_conv.inner = (void*)(this_arg & (~1));
41215 this_arg_conv.is_owned = false;
41216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41217 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
41221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41222 LDKNodeFeatures this_arg_conv;
41223 this_arg_conv.inner = (void*)(this_arg & (~1));
41224 this_arg_conv.is_owned = false;
41225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41226 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
41229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41230 LDKNodeFeatures this_arg_conv;
41231 this_arg_conv.inner = (void*)(this_arg & (~1));
41232 this_arg_conv.is_owned = false;
41233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41234 NodeFeatures_set_zero_conf_required(&this_arg_conv);
41237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41238 LDKNodeFeatures this_arg_conv;
41239 this_arg_conv.inner = (void*)(this_arg & (~1));
41240 this_arg_conv.is_owned = false;
41241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41242 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41247 LDKChannelTypeFeatures this_arg_conv;
41248 this_arg_conv.inner = (void*)(this_arg & (~1));
41249 this_arg_conv.is_owned = false;
41250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41251 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41255 LDKChannelTypeFeatures 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 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41263 LDKChannelTypeFeatures 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 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41272 LDKInitFeatures this_arg_conv;
41273 this_arg_conv.inner = (void*)(this_arg & (~1));
41274 this_arg_conv.is_owned = false;
41275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41276 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41281 LDKNodeFeatures this_arg_conv;
41282 this_arg_conv.inner = (void*)(this_arg & (~1));
41283 this_arg_conv.is_owned = false;
41284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41285 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41290 LDKChannelTypeFeatures this_arg_conv;
41291 this_arg_conv.inner = (void*)(this_arg & (~1));
41292 this_arg_conv.is_owned = false;
41293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41294 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41299 LDKNodeFeatures this_arg_conv;
41300 this_arg_conv.inner = (void*)(this_arg & (~1));
41301 this_arg_conv.is_owned = false;
41302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41303 NodeFeatures_set_keysend_optional(&this_arg_conv);
41306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41307 LDKNodeFeatures this_arg_conv;
41308 this_arg_conv.inner = (void*)(this_arg & (~1));
41309 this_arg_conv.is_owned = false;
41310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41311 NodeFeatures_set_keysend_required(&this_arg_conv);
41314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41315 LDKNodeFeatures this_arg_conv;
41316 this_arg_conv.inner = (void*)(this_arg & (~1));
41317 this_arg_conv.is_owned = false;
41318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41319 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41324 LDKNodeFeatures this_arg_conv;
41325 this_arg_conv.inner = (void*)(this_arg & (~1));
41326 this_arg_conv.is_owned = false;
41327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41328 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41333 LDKShutdownScript this_obj_conv;
41334 this_obj_conv.inner = (void*)(this_obj & (~1));
41335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41337 ShutdownScript_free(this_obj_conv);
41340 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41341 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41342 int64_t ret_ref = 0;
41343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41346 ret_ref = (uintptr_t)ret_var.inner;
41347 if (ret_var.is_owned) {
41352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41353 LDKShutdownScript arg_conv;
41354 arg_conv.inner = (void*)(arg & (~1));
41355 arg_conv.is_owned = false;
41356 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41357 int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41362 LDKShutdownScript orig_conv;
41363 orig_conv.inner = (void*)(orig & (~1));
41364 orig_conv.is_owned = false;
41365 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41366 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41367 int64_t ret_ref = 0;
41368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41371 ret_ref = (uintptr_t)ret_var.inner;
41372 if (ret_var.is_owned) {
41378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41379 LDKInvalidShutdownScript this_obj_conv;
41380 this_obj_conv.inner = (void*)(this_obj & (~1));
41381 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41383 InvalidShutdownScript_free(this_obj_conv);
41386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
41387 LDKInvalidShutdownScript this_ptr_conv;
41388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41389 this_ptr_conv.is_owned = false;
41390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41391 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41392 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41393 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41398 LDKInvalidShutdownScript this_ptr_conv;
41399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41400 this_ptr_conv.is_owned = false;
41401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41402 LDKCVec_u8Z val_ref;
41403 val_ref.datalen = (*env)->GetArrayLength(env, val);
41404 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41405 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41406 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
41410 LDKCVec_u8Z script_arg_ref;
41411 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
41412 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41413 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
41414 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41415 int64_t ret_ref = 0;
41416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41419 ret_ref = (uintptr_t)ret_var.inner;
41420 if (ret_var.is_owned) {
41426 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41427 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41428 int64_t ret_ref = 0;
41429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41432 ret_ref = (uintptr_t)ret_var.inner;
41433 if (ret_var.is_owned) {
41438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41439 LDKInvalidShutdownScript arg_conv;
41440 arg_conv.inner = (void*)(arg & (~1));
41441 arg_conv.is_owned = false;
41442 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41443 int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41448 LDKInvalidShutdownScript orig_conv;
41449 orig_conv.inner = (void*)(orig & (~1));
41450 orig_conv.is_owned = false;
41451 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41452 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41453 int64_t ret_ref = 0;
41454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41457 ret_ref = (uintptr_t)ret_var.inner;
41458 if (ret_var.is_owned) {
41464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
41465 LDKShutdownScript obj_conv;
41466 obj_conv.inner = (void*)(obj & (~1));
41467 obj_conv.is_owned = false;
41468 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41469 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41470 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41471 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41472 CVec_u8Z_free(ret_var);
41476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41477 LDKu8slice ser_ref;
41478 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41479 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41480 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41481 *ret_conv = ShutdownScript_read(ser_ref);
41482 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41483 return (int64_t)ret_conv;
41486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
41487 unsigned char pubkey_hash_arr[20];
41488 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
41489 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
41490 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41491 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41492 int64_t ret_ref = 0;
41493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41496 ret_ref = (uintptr_t)ret_var.inner;
41497 if (ret_var.is_owned) {
41503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
41504 unsigned char script_hash_arr[32];
41505 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
41506 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
41507 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41508 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41509 int64_t ret_ref = 0;
41510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41513 ret_ref = (uintptr_t)ret_var.inner;
41514 if (ret_var.is_owned) {
41520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41522 LDKu8slice program_ref;
41523 program_ref.datalen = (*env)->GetArrayLength(env, program);
41524 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
41525 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41526 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41527 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
41528 return (int64_t)ret_conv;
41531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
41532 LDKShutdownScript this_arg_conv;
41533 this_arg_conv.inner = (void*)(this_arg & (~1));
41534 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
41535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41536 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41537 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41538 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41539 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41540 CVec_u8Z_free(ret_var);
41544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
41545 LDKShutdownScript this_arg_conv;
41546 this_arg_conv.inner = (void*)(this_arg & (~1));
41547 this_arg_conv.is_owned = false;
41548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41549 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41550 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
41554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
41555 LDKShutdownScript this_arg_conv;
41556 this_arg_conv.inner = (void*)(this_arg & (~1));
41557 this_arg_conv.is_owned = false;
41558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41559 LDKInitFeatures features_conv;
41560 features_conv.inner = (void*)(features & (~1));
41561 features_conv.is_owned = false;
41562 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41563 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41568 if ((this_ptr & 1) != 0) return;
41569 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41570 CHECK_ACCESS(this_ptr_ptr);
41571 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41572 FREE((void*)this_ptr);
41573 CustomMessageReader_free(this_ptr_conv);
41576 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41577 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41578 *ret_ret = Type_clone(arg);
41579 return (int64_t)ret_ret;
41581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41582 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
41583 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
41584 LDKType* arg_conv = (LDKType*)arg_ptr;
41585 int64_t ret_conv = Type_clone_ptr(arg_conv);
41589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41590 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
41591 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
41592 LDKType* orig_conv = (LDKType*)orig_ptr;
41593 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41594 *ret_ret = Type_clone(orig_conv);
41595 return (int64_t)ret_ret;
41598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41599 if ((this_ptr & 1) != 0) return;
41600 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41601 CHECK_ACCESS(this_ptr_ptr);
41602 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41603 FREE((void*)this_ptr);
41604 Type_free(this_ptr_conv);
41607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41608 LDKNodeId this_obj_conv;
41609 this_obj_conv.inner = (void*)(this_obj & (~1));
41610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41612 NodeId_free(this_obj_conv);
41615 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41616 LDKNodeId ret_var = NodeId_clone(arg);
41617 int64_t ret_ref = 0;
41618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41621 ret_ref = (uintptr_t)ret_var.inner;
41622 if (ret_var.is_owned) {
41627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41628 LDKNodeId arg_conv;
41629 arg_conv.inner = (void*)(arg & (~1));
41630 arg_conv.is_owned = false;
41631 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41632 int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41637 LDKNodeId orig_conv;
41638 orig_conv.inner = (void*)(orig & (~1));
41639 orig_conv.is_owned = false;
41640 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41641 LDKNodeId ret_var = NodeId_clone(&orig_conv);
41642 int64_t ret_ref = 0;
41643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41646 ret_ref = (uintptr_t)ret_var.inner;
41647 if (ret_var.is_owned) {
41653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
41654 LDKPublicKey pubkey_ref;
41655 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41656 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41657 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41658 int64_t ret_ref = 0;
41659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41662 ret_ref = (uintptr_t)ret_var.inner;
41663 if (ret_var.is_owned) {
41669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
41670 LDKNodeId this_arg_conv;
41671 this_arg_conv.inner = (void*)(this_arg & (~1));
41672 this_arg_conv.is_owned = false;
41673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41674 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41675 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41676 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
41682 o_conv.inner = (void*)(o & (~1));
41683 o_conv.is_owned = false;
41684 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41685 int64_t ret_conv = NodeId_hash(&o_conv);
41689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
41690 LDKNodeId obj_conv;
41691 obj_conv.inner = (void*)(obj & (~1));
41692 obj_conv.is_owned = false;
41693 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41694 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41695 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41696 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41697 CVec_u8Z_free(ret_var);
41701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41702 LDKu8slice ser_ref;
41703 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41704 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41705 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41706 *ret_conv = NodeId_read(ser_ref);
41707 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41708 return (int64_t)ret_conv;
41711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41712 LDKNetworkGraph this_obj_conv;
41713 this_obj_conv.inner = (void*)(this_obj & (~1));
41714 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41716 NetworkGraph_free(this_obj_conv);
41719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41720 LDKReadOnlyNetworkGraph this_obj_conv;
41721 this_obj_conv.inner = (void*)(this_obj & (~1));
41722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41724 ReadOnlyNetworkGraph_free(this_obj_conv);
41727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41728 if ((this_ptr & 1) != 0) return;
41729 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41730 CHECK_ACCESS(this_ptr_ptr);
41731 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41732 FREE((void*)this_ptr);
41733 NetworkUpdate_free(this_ptr_conv);
41736 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41737 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41738 *ret_copy = NetworkUpdate_clone(arg);
41739 int64_t ret_ref = (uintptr_t)ret_copy;
41742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41743 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
41744 int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41749 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
41750 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41751 *ret_copy = NetworkUpdate_clone(orig_conv);
41752 int64_t ret_ref = (uintptr_t)ret_copy;
41756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
41757 LDKChannelUpdate msg_conv;
41758 msg_conv.inner = (void*)(msg & (~1));
41759 msg_conv.is_owned = (msg & 1) || (msg == 0);
41760 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41761 msg_conv = ChannelUpdate_clone(&msg_conv);
41762 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41763 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41764 int64_t ret_ref = (uintptr_t)ret_copy;
41768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
41769 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41770 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41771 int64_t ret_ref = (uintptr_t)ret_copy;
41775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
41776 LDKPublicKey node_id_ref;
41777 CHECK((*env)->GetArrayLength(env, node_id) == 33);
41778 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41779 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41780 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41781 int64_t ret_ref = (uintptr_t)ret_copy;
41785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41786 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
41787 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41788 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41789 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41790 CVec_u8Z_free(ret_var);
41794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41795 LDKu8slice ser_ref;
41796 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41797 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41798 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41799 *ret_conv = NetworkUpdate_read(ser_ref);
41800 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41801 return (int64_t)ret_conv;
41804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41805 LDKP2PGossipSync this_obj_conv;
41806 this_obj_conv.inner = (void*)(this_obj & (~1));
41807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41809 P2PGossipSync_free(this_obj_conv);
41812 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) {
41813 LDKNetworkGraph network_graph_conv;
41814 network_graph_conv.inner = (void*)(network_graph & (~1));
41815 network_graph_conv.is_owned = false;
41816 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41817 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41818 CHECK_ACCESS(chain_access_ptr);
41819 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41820 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41821 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41822 // Manually implement clone for Java trait instances
41823 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41824 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41825 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41828 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41829 CHECK_ACCESS(logger_ptr);
41830 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41831 if (logger_conv.free == LDKLogger_JCalls_free) {
41832 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41833 LDKLogger_JCalls_cloned(&logger_conv);
41835 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41836 int64_t ret_ref = 0;
41837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41840 ret_ref = (uintptr_t)ret_var.inner;
41841 if (ret_var.is_owned) {
41847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
41848 LDKP2PGossipSync this_arg_conv;
41849 this_arg_conv.inner = (void*)(this_arg & (~1));
41850 this_arg_conv.is_owned = false;
41851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41852 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41853 CHECK_ACCESS(chain_access_ptr);
41854 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41855 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41856 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41857 // Manually implement clone for Java trait instances
41858 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41859 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41860 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41863 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41867 LDKNetworkGraph this_arg_conv;
41868 this_arg_conv.inner = (void*)(this_arg & (~1));
41869 this_arg_conv.is_owned = false;
41870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41871 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41872 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
41873 return (int64_t)ret_ret;
41876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41877 LDKP2PGossipSync this_arg_conv;
41878 this_arg_conv.inner = (void*)(this_arg & (~1));
41879 this_arg_conv.is_owned = false;
41880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41881 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41882 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41883 return (int64_t)ret_ret;
41886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41887 LDKP2PGossipSync this_arg_conv;
41888 this_arg_conv.inner = (void*)(this_arg & (~1));
41889 this_arg_conv.is_owned = false;
41890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41891 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41892 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41893 return (int64_t)ret_ret;
41896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41897 LDKChannelUpdateInfo this_obj_conv;
41898 this_obj_conv.inner = (void*)(this_obj & (~1));
41899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41901 ChannelUpdateInfo_free(this_obj_conv);
41904 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
41905 LDKChannelUpdateInfo this_ptr_conv;
41906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41907 this_ptr_conv.is_owned = false;
41908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41909 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41914 LDKChannelUpdateInfo this_ptr_conv;
41915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41916 this_ptr_conv.is_owned = false;
41917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41918 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
41922 LDKChannelUpdateInfo this_ptr_conv;
41923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41924 this_ptr_conv.is_owned = false;
41925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41926 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
41931 LDKChannelUpdateInfo this_ptr_conv;
41932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41933 this_ptr_conv.is_owned = false;
41934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41935 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41938 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41939 LDKChannelUpdateInfo this_ptr_conv;
41940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41941 this_ptr_conv.is_owned = false;
41942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41943 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41948 LDKChannelUpdateInfo this_ptr_conv;
41949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41950 this_ptr_conv.is_owned = false;
41951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41952 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41956 LDKChannelUpdateInfo this_ptr_conv;
41957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41958 this_ptr_conv.is_owned = false;
41959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41965 LDKChannelUpdateInfo this_ptr_conv;
41966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41967 this_ptr_conv.is_owned = false;
41968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41969 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41973 LDKChannelUpdateInfo this_ptr_conv;
41974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41975 this_ptr_conv.is_owned = false;
41976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41977 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41978 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41979 int64_t ret_ref = (uintptr_t)ret_copy;
41983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41984 LDKChannelUpdateInfo this_ptr_conv;
41985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41986 this_ptr_conv.is_owned = false;
41987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41988 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41989 CHECK_ACCESS(val_ptr);
41990 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41991 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41992 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
41995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41996 LDKChannelUpdateInfo this_ptr_conv;
41997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41998 this_ptr_conv.is_owned = false;
41999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42000 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
42001 int64_t ret_ref = 0;
42002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42005 ret_ref = (uintptr_t)ret_var.inner;
42006 if (ret_var.is_owned) {
42012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42013 LDKChannelUpdateInfo this_ptr_conv;
42014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42015 this_ptr_conv.is_owned = false;
42016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42017 LDKRoutingFees val_conv;
42018 val_conv.inner = (void*)(val & (~1));
42019 val_conv.is_owned = (val & 1) || (val == 0);
42020 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42021 val_conv = RoutingFees_clone(&val_conv);
42022 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
42025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42026 LDKChannelUpdateInfo this_ptr_conv;
42027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42028 this_ptr_conv.is_owned = false;
42029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42030 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
42031 int64_t ret_ref = 0;
42032 if ((uintptr_t)ret_var.inner > 4096) {
42033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42036 ret_ref = (uintptr_t)ret_var.inner;
42037 if (ret_var.is_owned) {
42044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42045 LDKChannelUpdateInfo this_ptr_conv;
42046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42047 this_ptr_conv.is_owned = false;
42048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42049 LDKChannelUpdate val_conv;
42050 val_conv.inner = (void*)(val & (~1));
42051 val_conv.is_owned = (val & 1) || (val == 0);
42052 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42053 val_conv = ChannelUpdate_clone(&val_conv);
42054 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
42057 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) {
42058 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42059 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42060 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42061 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42062 LDKRoutingFees fees_arg_conv;
42063 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42064 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42065 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42066 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42067 LDKChannelUpdate last_update_message_arg_conv;
42068 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
42069 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
42070 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
42071 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
42072 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);
42073 int64_t ret_ref = 0;
42074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42077 ret_ref = (uintptr_t)ret_var.inner;
42078 if (ret_var.is_owned) {
42084 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
42085 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
42086 int64_t ret_ref = 0;
42087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42090 ret_ref = (uintptr_t)ret_var.inner;
42091 if (ret_var.is_owned) {
42096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42097 LDKChannelUpdateInfo arg_conv;
42098 arg_conv.inner = (void*)(arg & (~1));
42099 arg_conv.is_owned = false;
42100 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42101 int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
42105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42106 LDKChannelUpdateInfo orig_conv;
42107 orig_conv.inner = (void*)(orig & (~1));
42108 orig_conv.is_owned = false;
42109 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42110 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
42111 int64_t ret_ref = 0;
42112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42115 ret_ref = (uintptr_t)ret_var.inner;
42116 if (ret_var.is_owned) {
42122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42123 LDKChannelUpdateInfo obj_conv;
42124 obj_conv.inner = (void*)(obj & (~1));
42125 obj_conv.is_owned = false;
42126 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42127 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
42128 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42129 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42130 CVec_u8Z_free(ret_var);
42134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42135 LDKu8slice ser_ref;
42136 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42137 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42138 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
42139 *ret_conv = ChannelUpdateInfo_read(ser_ref);
42140 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42141 return (int64_t)ret_conv;
42144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42145 LDKChannelInfo this_obj_conv;
42146 this_obj_conv.inner = (void*)(this_obj & (~1));
42147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42149 ChannelInfo_free(this_obj_conv);
42152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42153 LDKChannelInfo this_ptr_conv;
42154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42155 this_ptr_conv.is_owned = false;
42156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42157 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
42158 int64_t ret_ref = 0;
42159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42162 ret_ref = (uintptr_t)ret_var.inner;
42163 if (ret_var.is_owned) {
42169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42170 LDKChannelInfo this_ptr_conv;
42171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42172 this_ptr_conv.is_owned = false;
42173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42174 LDKChannelFeatures val_conv;
42175 val_conv.inner = (void*)(val & (~1));
42176 val_conv.is_owned = (val & 1) || (val == 0);
42177 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42178 val_conv = ChannelFeatures_clone(&val_conv);
42179 ChannelInfo_set_features(&this_ptr_conv, val_conv);
42182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
42183 LDKChannelInfo this_ptr_conv;
42184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42185 this_ptr_conv.is_owned = false;
42186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42187 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
42188 int64_t ret_ref = 0;
42189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42192 ret_ref = (uintptr_t)ret_var.inner;
42193 if (ret_var.is_owned) {
42199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42200 LDKChannelInfo this_ptr_conv;
42201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42202 this_ptr_conv.is_owned = false;
42203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42204 LDKNodeId val_conv;
42205 val_conv.inner = (void*)(val & (~1));
42206 val_conv.is_owned = (val & 1) || (val == 0);
42207 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42208 val_conv = NodeId_clone(&val_conv);
42209 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
42212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
42213 LDKChannelInfo this_ptr_conv;
42214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42215 this_ptr_conv.is_owned = false;
42216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42217 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
42218 int64_t ret_ref = 0;
42219 if ((uintptr_t)ret_var.inner > 4096) {
42220 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42221 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42223 ret_ref = (uintptr_t)ret_var.inner;
42224 if (ret_var.is_owned) {
42231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42232 LDKChannelInfo this_ptr_conv;
42233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42234 this_ptr_conv.is_owned = false;
42235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42236 LDKChannelUpdateInfo val_conv;
42237 val_conv.inner = (void*)(val & (~1));
42238 val_conv.is_owned = (val & 1) || (val == 0);
42239 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42240 val_conv = ChannelUpdateInfo_clone(&val_conv);
42241 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
42244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
42245 LDKChannelInfo this_ptr_conv;
42246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42247 this_ptr_conv.is_owned = false;
42248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42249 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
42250 int64_t ret_ref = 0;
42251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42254 ret_ref = (uintptr_t)ret_var.inner;
42255 if (ret_var.is_owned) {
42261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42262 LDKChannelInfo this_ptr_conv;
42263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42264 this_ptr_conv.is_owned = false;
42265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42266 LDKNodeId val_conv;
42267 val_conv.inner = (void*)(val & (~1));
42268 val_conv.is_owned = (val & 1) || (val == 0);
42269 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42270 val_conv = NodeId_clone(&val_conv);
42271 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
42274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
42275 LDKChannelInfo this_ptr_conv;
42276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42277 this_ptr_conv.is_owned = false;
42278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42279 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
42280 int64_t ret_ref = 0;
42281 if ((uintptr_t)ret_var.inner > 4096) {
42282 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42283 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42285 ret_ref = (uintptr_t)ret_var.inner;
42286 if (ret_var.is_owned) {
42293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42294 LDKChannelInfo this_ptr_conv;
42295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42296 this_ptr_conv.is_owned = false;
42297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42298 LDKChannelUpdateInfo val_conv;
42299 val_conv.inner = (void*)(val & (~1));
42300 val_conv.is_owned = (val & 1) || (val == 0);
42301 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42302 val_conv = ChannelUpdateInfo_clone(&val_conv);
42303 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42307 LDKChannelInfo this_ptr_conv;
42308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42309 this_ptr_conv.is_owned = false;
42310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42311 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42312 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42313 int64_t ret_ref = (uintptr_t)ret_copy;
42317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42318 LDKChannelInfo this_ptr_conv;
42319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42320 this_ptr_conv.is_owned = false;
42321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42322 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42323 CHECK_ACCESS(val_ptr);
42324 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42325 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42326 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42330 LDKChannelInfo this_ptr_conv;
42331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42332 this_ptr_conv.is_owned = false;
42333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42334 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42335 int64_t ret_ref = 0;
42336 if ((uintptr_t)ret_var.inner > 4096) {
42337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42340 ret_ref = (uintptr_t)ret_var.inner;
42341 if (ret_var.is_owned) {
42348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42349 LDKChannelInfo this_ptr_conv;
42350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42351 this_ptr_conv.is_owned = false;
42352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42353 LDKChannelAnnouncement val_conv;
42354 val_conv.inner = (void*)(val & (~1));
42355 val_conv.is_owned = (val & 1) || (val == 0);
42356 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42357 val_conv = ChannelAnnouncement_clone(&val_conv);
42358 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42361 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42362 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42363 int64_t ret_ref = 0;
42364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42367 ret_ref = (uintptr_t)ret_var.inner;
42368 if (ret_var.is_owned) {
42373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42374 LDKChannelInfo arg_conv;
42375 arg_conv.inner = (void*)(arg & (~1));
42376 arg_conv.is_owned = false;
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42378 int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42383 LDKChannelInfo orig_conv;
42384 orig_conv.inner = (void*)(orig & (~1));
42385 orig_conv.is_owned = false;
42386 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42387 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42388 int64_t ret_ref = 0;
42389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42392 ret_ref = (uintptr_t)ret_var.inner;
42393 if (ret_var.is_owned) {
42399 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) {
42400 LDKChannelInfo this_arg_conv;
42401 this_arg_conv.inner = (void*)(this_arg & (~1));
42402 this_arg_conv.is_owned = false;
42403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42404 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42405 int64_t ret_ref = 0;
42406 if ((uintptr_t)ret_var.inner > 4096) {
42407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42410 ret_ref = (uintptr_t)ret_var.inner;
42411 if (ret_var.is_owned) {
42418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42419 LDKChannelInfo obj_conv;
42420 obj_conv.inner = (void*)(obj & (~1));
42421 obj_conv.is_owned = false;
42422 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42423 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42424 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42425 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42426 CVec_u8Z_free(ret_var);
42430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42431 LDKu8slice ser_ref;
42432 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42433 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42434 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42435 *ret_conv = ChannelInfo_read(ser_ref);
42436 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42437 return (int64_t)ret_conv;
42440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42441 LDKDirectedChannelInfo this_obj_conv;
42442 this_obj_conv.inner = (void*)(this_obj & (~1));
42443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42445 DirectedChannelInfo_free(this_obj_conv);
42448 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42449 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_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_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42461 LDKDirectedChannelInfo 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 = DirectedChannelInfo_clone_ptr(&arg_conv);
42469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42470 LDKDirectedChannelInfo 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 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_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 int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
42487 LDKDirectedChannelInfo this_arg_conv;
42488 this_arg_conv.inner = (void*)(this_arg & (~1));
42489 this_arg_conv.is_owned = false;
42490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42491 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42492 int64_t ret_ref = 0;
42493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42496 ret_ref = (uintptr_t)ret_var.inner;
42497 if (ret_var.is_owned) {
42503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
42504 LDKDirectedChannelInfo this_arg_conv;
42505 this_arg_conv.inner = (void*)(this_arg & (~1));
42506 this_arg_conv.is_owned = false;
42507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42508 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
42509 int64_t ret_ref = 0;
42510 if ((uintptr_t)ret_var.inner > 4096) {
42511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42514 ret_ref = (uintptr_t)ret_var.inner;
42515 if (ret_var.is_owned) {
42522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42523 LDKDirectedChannelInfo this_arg_conv;
42524 this_arg_conv.inner = (void*)(this_arg & (~1));
42525 this_arg_conv.is_owned = false;
42526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42527 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
42532 LDKDirectedChannelInfo this_arg_conv;
42533 this_arg_conv.inner = (void*)(this_arg & (~1));
42534 this_arg_conv.is_owned = false;
42535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42536 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42537 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42538 int64_t ret_ref = (uintptr_t)ret_copy;
42542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42543 if ((this_ptr & 1) != 0) return;
42544 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42545 CHECK_ACCESS(this_ptr_ptr);
42546 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42547 FREE((void*)this_ptr);
42548 EffectiveCapacity_free(this_ptr_conv);
42551 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42552 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42553 *ret_copy = EffectiveCapacity_clone(arg);
42554 int64_t ret_ref = (uintptr_t)ret_copy;
42557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42558 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
42559 int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42564 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
42565 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42566 *ret_copy = EffectiveCapacity_clone(orig_conv);
42567 int64_t ret_ref = (uintptr_t)ret_copy;
42571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
42572 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42573 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42574 int64_t ret_ref = (uintptr_t)ret_copy;
42578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
42579 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42580 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42581 int64_t ret_ref = (uintptr_t)ret_copy;
42585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) {
42586 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42587 *ret_copy = EffectiveCapacity_total(capacity_msat);
42588 int64_t ret_ref = (uintptr_t)ret_copy;
42592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
42593 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42594 *ret_copy = EffectiveCapacity_infinite();
42595 int64_t ret_ref = (uintptr_t)ret_copy;
42599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
42600 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42601 *ret_copy = EffectiveCapacity_unknown();
42602 int64_t ret_ref = (uintptr_t)ret_copy;
42606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42607 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
42608 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42613 LDKRoutingFees this_obj_conv;
42614 this_obj_conv.inner = (void*)(this_obj & (~1));
42615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42617 RoutingFees_free(this_obj_conv);
42620 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42621 LDKRoutingFees this_ptr_conv;
42622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42623 this_ptr_conv.is_owned = false;
42624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42625 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42630 LDKRoutingFees this_ptr_conv;
42631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42632 this_ptr_conv.is_owned = false;
42633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42634 RoutingFees_set_base_msat(&this_ptr_conv, val);
42637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42638 LDKRoutingFees this_ptr_conv;
42639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42640 this_ptr_conv.is_owned = false;
42641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42642 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42647 LDKRoutingFees this_ptr_conv;
42648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42649 this_ptr_conv.is_owned = false;
42650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42651 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42654 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) {
42655 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42656 int64_t ret_ref = 0;
42657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42660 ret_ref = (uintptr_t)ret_var.inner;
42661 if (ret_var.is_owned) {
42667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42668 LDKRoutingFees a_conv;
42669 a_conv.inner = (void*)(a & (~1));
42670 a_conv.is_owned = false;
42671 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42672 LDKRoutingFees b_conv;
42673 b_conv.inner = (void*)(b & (~1));
42674 b_conv.is_owned = false;
42675 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42676 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42680 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42681 LDKRoutingFees ret_var = RoutingFees_clone(arg);
42682 int64_t ret_ref = 0;
42683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42686 ret_ref = (uintptr_t)ret_var.inner;
42687 if (ret_var.is_owned) {
42692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42693 LDKRoutingFees arg_conv;
42694 arg_conv.inner = (void*)(arg & (~1));
42695 arg_conv.is_owned = false;
42696 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42697 int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42702 LDKRoutingFees orig_conv;
42703 orig_conv.inner = (void*)(orig & (~1));
42704 orig_conv.is_owned = false;
42705 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42706 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42707 int64_t ret_ref = 0;
42708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42711 ret_ref = (uintptr_t)ret_var.inner;
42712 if (ret_var.is_owned) {
42718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
42719 LDKRoutingFees o_conv;
42720 o_conv.inner = (void*)(o & (~1));
42721 o_conv.is_owned = false;
42722 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42723 int64_t ret_conv = RoutingFees_hash(&o_conv);
42727 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
42728 LDKRoutingFees obj_conv;
42729 obj_conv.inner = (void*)(obj & (~1));
42730 obj_conv.is_owned = false;
42731 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42732 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42735 CVec_u8Z_free(ret_var);
42739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42740 LDKu8slice ser_ref;
42741 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42742 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42743 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42744 *ret_conv = RoutingFees_read(ser_ref);
42745 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42746 return (int64_t)ret_conv;
42749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42750 LDKNodeAnnouncementInfo this_obj_conv;
42751 this_obj_conv.inner = (void*)(this_obj & (~1));
42752 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42754 NodeAnnouncementInfo_free(this_obj_conv);
42757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42758 LDKNodeAnnouncementInfo this_ptr_conv;
42759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42760 this_ptr_conv.is_owned = false;
42761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42762 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42763 int64_t ret_ref = 0;
42764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42767 ret_ref = (uintptr_t)ret_var.inner;
42768 if (ret_var.is_owned) {
42774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42775 LDKNodeAnnouncementInfo this_ptr_conv;
42776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42777 this_ptr_conv.is_owned = false;
42778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42779 LDKNodeFeatures val_conv;
42780 val_conv.inner = (void*)(val & (~1));
42781 val_conv.is_owned = (val & 1) || (val == 0);
42782 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42783 val_conv = NodeFeatures_clone(&val_conv);
42784 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42787 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
42788 LDKNodeAnnouncementInfo this_ptr_conv;
42789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42790 this_ptr_conv.is_owned = false;
42791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42792 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42797 LDKNodeAnnouncementInfo this_ptr_conv;
42798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42799 this_ptr_conv.is_owned = false;
42800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42801 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
42805 LDKNodeAnnouncementInfo this_ptr_conv;
42806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42807 this_ptr_conv.is_owned = false;
42808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42809 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
42810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
42814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42815 LDKNodeAnnouncementInfo this_ptr_conv;
42816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42817 this_ptr_conv.is_owned = false;
42818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42819 LDKThreeBytes val_ref;
42820 CHECK((*env)->GetArrayLength(env, val) == 3);
42821 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
42822 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42826 LDKNodeAnnouncementInfo this_ptr_conv;
42827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42828 this_ptr_conv.is_owned = false;
42829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42830 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42831 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
42835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42836 LDKNodeAnnouncementInfo this_ptr_conv;
42837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42838 this_ptr_conv.is_owned = false;
42839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42840 LDKThirtyTwoBytes val_ref;
42841 CHECK((*env)->GetArrayLength(env, val) == 32);
42842 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42843 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
42846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42847 LDKNodeAnnouncementInfo this_ptr_conv;
42848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42849 this_ptr_conv.is_owned = false;
42850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42851 LDKCVec_NetAddressZ val_constr;
42852 val_constr.datalen = (*env)->GetArrayLength(env, val);
42853 if (val_constr.datalen > 0)
42854 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42856 val_constr.data = NULL;
42857 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42858 for (size_t m = 0; m < val_constr.datalen; m++) {
42859 int64_t val_conv_12 = val_vals[m];
42860 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
42861 CHECK_ACCESS(val_conv_12_ptr);
42862 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42863 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
42864 val_constr.data[m] = val_conv_12_conv;
42866 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42867 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42871 LDKNodeAnnouncementInfo this_ptr_conv;
42872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42873 this_ptr_conv.is_owned = false;
42874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42875 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42876 int64_t ret_ref = 0;
42877 if ((uintptr_t)ret_var.inner > 4096) {
42878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42881 ret_ref = (uintptr_t)ret_var.inner;
42882 if (ret_var.is_owned) {
42889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42890 LDKNodeAnnouncementInfo this_ptr_conv;
42891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42892 this_ptr_conv.is_owned = false;
42893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894 LDKNodeAnnouncement val_conv;
42895 val_conv.inner = (void*)(val & (~1));
42896 val_conv.is_owned = (val & 1) || (val == 0);
42897 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42898 val_conv = NodeAnnouncement_clone(&val_conv);
42899 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
42903 LDKNodeFeatures features_arg_conv;
42904 features_arg_conv.inner = (void*)(features_arg & (~1));
42905 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
42906 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42907 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42908 LDKThreeBytes rgb_arg_ref;
42909 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
42910 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
42911 LDKThirtyTwoBytes alias_arg_ref;
42912 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
42913 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
42914 LDKCVec_NetAddressZ addresses_arg_constr;
42915 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
42916 if (addresses_arg_constr.datalen > 0)
42917 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42919 addresses_arg_constr.data = NULL;
42920 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
42921 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42922 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42923 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
42924 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42925 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42926 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42928 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
42929 LDKNodeAnnouncement announcement_message_arg_conv;
42930 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
42931 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
42932 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42933 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42934 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
42935 int64_t ret_ref = 0;
42936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42939 ret_ref = (uintptr_t)ret_var.inner;
42940 if (ret_var.is_owned) {
42946 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42947 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
42948 int64_t ret_ref = 0;
42949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42952 ret_ref = (uintptr_t)ret_var.inner;
42953 if (ret_var.is_owned) {
42958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42959 LDKNodeAnnouncementInfo arg_conv;
42960 arg_conv.inner = (void*)(arg & (~1));
42961 arg_conv.is_owned = false;
42962 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42963 int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42968 LDKNodeAnnouncementInfo orig_conv;
42969 orig_conv.inner = (void*)(orig & (~1));
42970 orig_conv.is_owned = false;
42971 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42972 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42973 int64_t ret_ref = 0;
42974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42977 ret_ref = (uintptr_t)ret_var.inner;
42978 if (ret_var.is_owned) {
42984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42985 LDKNodeAnnouncementInfo obj_conv;
42986 obj_conv.inner = (void*)(obj & (~1));
42987 obj_conv.is_owned = false;
42988 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42989 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42992 CVec_u8Z_free(ret_var);
42996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42997 LDKu8slice ser_ref;
42998 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42999 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43000 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
43001 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
43002 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43003 return (int64_t)ret_conv;
43006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43007 LDKNodeInfo this_obj_conv;
43008 this_obj_conv.inner = (void*)(this_obj & (~1));
43009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43011 NodeInfo_free(this_obj_conv);
43014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43015 LDKNodeInfo 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 LDKCVec_u64Z val_constr;
43020 val_constr.datalen = (*env)->GetArrayLength(env, val);
43021 if (val_constr.datalen > 0)
43022 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43024 val_constr.data = NULL;
43025 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43026 for (size_t g = 0; g < val_constr.datalen; g++) {
43027 int64_t val_conv_6 = val_vals[g];
43028 val_constr.data[g] = val_conv_6;
43030 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43031 NodeInfo_set_channels(&this_ptr_conv, val_constr);
43034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
43035 LDKNodeInfo this_ptr_conv;
43036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43037 this_ptr_conv.is_owned = false;
43038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43039 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
43040 int64_t ret_ref = 0;
43041 if ((uintptr_t)ret_var.inner > 4096) {
43042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43045 ret_ref = (uintptr_t)ret_var.inner;
43046 if (ret_var.is_owned) {
43053 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) {
43054 LDKNodeInfo this_ptr_conv;
43055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43056 this_ptr_conv.is_owned = false;
43057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43058 LDKRoutingFees val_conv;
43059 val_conv.inner = (void*)(val & (~1));
43060 val_conv.is_owned = (val & 1) || (val == 0);
43061 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43062 val_conv = RoutingFees_clone(&val_conv);
43063 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
43066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
43067 LDKNodeInfo this_ptr_conv;
43068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43069 this_ptr_conv.is_owned = false;
43070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43071 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
43072 int64_t ret_ref = 0;
43073 if ((uintptr_t)ret_var.inner > 4096) {
43074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43077 ret_ref = (uintptr_t)ret_var.inner;
43078 if (ret_var.is_owned) {
43085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43086 LDKNodeInfo this_ptr_conv;
43087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43088 this_ptr_conv.is_owned = false;
43089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43090 LDKNodeAnnouncementInfo val_conv;
43091 val_conv.inner = (void*)(val & (~1));
43092 val_conv.is_owned = (val & 1) || (val == 0);
43093 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43094 val_conv = NodeAnnouncementInfo_clone(&val_conv);
43095 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
43098 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) {
43099 LDKCVec_u64Z channels_arg_constr;
43100 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
43101 if (channels_arg_constr.datalen > 0)
43102 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43104 channels_arg_constr.data = NULL;
43105 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
43106 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
43107 int64_t channels_arg_conv_6 = channels_arg_vals[g];
43108 channels_arg_constr.data[g] = channels_arg_conv_6;
43110 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
43111 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
43112 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
43113 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
43114 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
43115 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
43116 LDKNodeAnnouncementInfo announcement_info_arg_conv;
43117 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
43118 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
43119 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
43120 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
43121 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
43122 int64_t ret_ref = 0;
43123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43126 ret_ref = (uintptr_t)ret_var.inner;
43127 if (ret_var.is_owned) {
43133 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
43134 LDKNodeInfo ret_var = NodeInfo_clone(arg);
43135 int64_t ret_ref = 0;
43136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43139 ret_ref = (uintptr_t)ret_var.inner;
43140 if (ret_var.is_owned) {
43145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43146 LDKNodeInfo arg_conv;
43147 arg_conv.inner = (void*)(arg & (~1));
43148 arg_conv.is_owned = false;
43149 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43150 int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
43154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43155 LDKNodeInfo orig_conv;
43156 orig_conv.inner = (void*)(orig & (~1));
43157 orig_conv.is_owned = false;
43158 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43159 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
43160 int64_t ret_ref = 0;
43161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43164 ret_ref = (uintptr_t)ret_var.inner;
43165 if (ret_var.is_owned) {
43171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43172 LDKNodeInfo obj_conv;
43173 obj_conv.inner = (void*)(obj & (~1));
43174 obj_conv.is_owned = false;
43175 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43176 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
43177 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43178 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43179 CVec_u8Z_free(ret_var);
43183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43184 LDKu8slice ser_ref;
43185 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43186 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43187 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
43188 *ret_conv = NodeInfo_read(ser_ref);
43189 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43190 return (int64_t)ret_conv;
43193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
43194 LDKNetworkGraph obj_conv;
43195 obj_conv.inner = (void*)(obj & (~1));
43196 obj_conv.is_owned = false;
43197 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43198 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
43199 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43200 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43201 CVec_u8Z_free(ret_var);
43205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
43206 LDKu8slice ser_ref;
43207 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43208 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43209 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
43210 CHECK_ACCESS(arg_ptr);
43211 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
43212 if (arg_conv.free == LDKLogger_JCalls_free) {
43213 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43214 LDKLogger_JCalls_cloned(&arg_conv);
43216 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
43217 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
43218 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43219 return (int64_t)ret_conv;
43222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
43223 LDKThirtyTwoBytes genesis_hash_ref;
43224 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
43225 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
43226 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43227 CHECK_ACCESS(logger_ptr);
43228 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43229 if (logger_conv.free == LDKLogger_JCalls_free) {
43230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43231 LDKLogger_JCalls_cloned(&logger_conv);
43233 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43234 int64_t ret_ref = 0;
43235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43238 ret_ref = (uintptr_t)ret_var.inner;
43239 if (ret_var.is_owned) {
43245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
43246 LDKNetworkGraph this_arg_conv;
43247 this_arg_conv.inner = (void*)(this_arg & (~1));
43248 this_arg_conv.is_owned = false;
43249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43250 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43251 int64_t ret_ref = 0;
43252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43255 ret_ref = (uintptr_t)ret_var.inner;
43256 if (ret_var.is_owned) {
43262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
43263 LDKNetworkGraph this_arg_conv;
43264 this_arg_conv.inner = (void*)(this_arg & (~1));
43265 this_arg_conv.is_owned = false;
43266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43267 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43268 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43269 int64_t ret_ref = (uintptr_t)ret_copy;
43273 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) {
43274 LDKNetworkGraph this_arg_conv;
43275 this_arg_conv.inner = (void*)(this_arg & (~1));
43276 this_arg_conv.is_owned = false;
43277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43278 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43281 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) {
43282 LDKNetworkGraph this_arg_conv;
43283 this_arg_conv.inner = (void*)(this_arg & (~1));
43284 this_arg_conv.is_owned = false;
43285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43286 LDKNodeAnnouncement msg_conv;
43287 msg_conv.inner = (void*)(msg & (~1));
43288 msg_conv.is_owned = false;
43289 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43290 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43291 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43292 return (int64_t)ret_conv;
43295 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) {
43296 LDKNetworkGraph this_arg_conv;
43297 this_arg_conv.inner = (void*)(this_arg & (~1));
43298 this_arg_conv.is_owned = false;
43299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43300 LDKUnsignedNodeAnnouncement msg_conv;
43301 msg_conv.inner = (void*)(msg & (~1));
43302 msg_conv.is_owned = false;
43303 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43304 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43305 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43306 return (int64_t)ret_conv;
43309 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) {
43310 LDKNetworkGraph this_arg_conv;
43311 this_arg_conv.inner = (void*)(this_arg & (~1));
43312 this_arg_conv.is_owned = false;
43313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43314 LDKChannelAnnouncement msg_conv;
43315 msg_conv.inner = (void*)(msg & (~1));
43316 msg_conv.is_owned = false;
43317 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43318 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43319 CHECK_ACCESS(chain_access_ptr);
43320 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43321 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43322 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43323 // Manually implement clone for Java trait instances
43324 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43326 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43329 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43330 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43331 return (int64_t)ret_conv;
43334 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) {
43335 LDKNetworkGraph this_arg_conv;
43336 this_arg_conv.inner = (void*)(this_arg & (~1));
43337 this_arg_conv.is_owned = false;
43338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43339 LDKUnsignedChannelAnnouncement msg_conv;
43340 msg_conv.inner = (void*)(msg & (~1));
43341 msg_conv.is_owned = false;
43342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43343 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43344 CHECK_ACCESS(chain_access_ptr);
43345 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43346 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43347 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43348 // Manually implement clone for Java trait instances
43349 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43350 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43351 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43354 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43355 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43356 return (int64_t)ret_conv;
43359 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) {
43360 LDKNetworkGraph this_arg_conv;
43361 this_arg_conv.inner = (void*)(this_arg & (~1));
43362 this_arg_conv.is_owned = false;
43363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43364 LDKChannelFeatures features_conv;
43365 features_conv.inner = (void*)(features & (~1));
43366 features_conv.is_owned = (features & 1) || (features == 0);
43367 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43368 features_conv = ChannelFeatures_clone(&features_conv);
43369 LDKPublicKey node_id_1_ref;
43370 CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
43371 (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
43372 LDKPublicKey node_id_2_ref;
43373 CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
43374 (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
43375 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43376 *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);
43377 return (int64_t)ret_conv;
43380 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) {
43381 LDKNetworkGraph this_arg_conv;
43382 this_arg_conv.inner = (void*)(this_arg & (~1));
43383 this_arg_conv.is_owned = false;
43384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43385 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43388 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) {
43389 LDKNetworkGraph this_arg_conv;
43390 this_arg_conv.inner = (void*)(this_arg & (~1));
43391 this_arg_conv.is_owned = false;
43392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43393 LDKPublicKey _node_id_ref;
43394 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
43395 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
43396 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
43399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43400 LDKNetworkGraph this_arg_conv;
43401 this_arg_conv.inner = (void*)(this_arg & (~1));
43402 this_arg_conv.is_owned = false;
43403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43404 NetworkGraph_remove_stale_channels(&this_arg_conv);
43407 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) {
43408 LDKNetworkGraph this_arg_conv;
43409 this_arg_conv.inner = (void*)(this_arg & (~1));
43410 this_arg_conv.is_owned = false;
43411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43412 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
43415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43416 LDKNetworkGraph this_arg_conv;
43417 this_arg_conv.inner = (void*)(this_arg & (~1));
43418 this_arg_conv.is_owned = false;
43419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43420 LDKChannelUpdate msg_conv;
43421 msg_conv.inner = (void*)(msg & (~1));
43422 msg_conv.is_owned = false;
43423 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43424 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43425 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43426 return (int64_t)ret_conv;
43429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43430 LDKNetworkGraph this_arg_conv;
43431 this_arg_conv.inner = (void*)(this_arg & (~1));
43432 this_arg_conv.is_owned = false;
43433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43434 LDKUnsignedChannelUpdate msg_conv;
43435 msg_conv.inner = (void*)(msg & (~1));
43436 msg_conv.is_owned = false;
43437 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43438 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43439 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43440 return (int64_t)ret_conv;
43443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
43444 LDKReadOnlyNetworkGraph this_arg_conv;
43445 this_arg_conv.inner = (void*)(this_arg & (~1));
43446 this_arg_conv.is_owned = false;
43447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43448 LDKPublicKey pubkey_ref;
43449 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43450 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43451 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43452 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43453 int64_t ret_ref = (uintptr_t)ret_copy;
43457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43458 LDKRouteHop this_obj_conv;
43459 this_obj_conv.inner = (void*)(this_obj & (~1));
43460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43462 RouteHop_free(this_obj_conv);
43465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43466 LDKRouteHop this_ptr_conv;
43467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43468 this_ptr_conv.is_owned = false;
43469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43470 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
43475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43476 LDKRouteHop this_ptr_conv;
43477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43478 this_ptr_conv.is_owned = false;
43479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43480 LDKPublicKey val_ref;
43481 CHECK((*env)->GetArrayLength(env, val) == 33);
43482 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43483 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43487 LDKRouteHop this_ptr_conv;
43488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43489 this_ptr_conv.is_owned = false;
43490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43491 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43492 int64_t ret_ref = 0;
43493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43496 ret_ref = (uintptr_t)ret_var.inner;
43497 if (ret_var.is_owned) {
43503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43504 LDKRouteHop this_ptr_conv;
43505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43506 this_ptr_conv.is_owned = false;
43507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43508 LDKNodeFeatures val_conv;
43509 val_conv.inner = (void*)(val & (~1));
43510 val_conv.is_owned = (val & 1) || (val == 0);
43511 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43512 val_conv = NodeFeatures_clone(&val_conv);
43513 RouteHop_set_node_features(&this_ptr_conv, val_conv);
43516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43517 LDKRouteHop this_ptr_conv;
43518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43519 this_ptr_conv.is_owned = false;
43520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43521 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43526 LDKRouteHop this_ptr_conv;
43527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43528 this_ptr_conv.is_owned = false;
43529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43530 RouteHop_set_short_channel_id(&this_ptr_conv, val);
43533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43534 LDKRouteHop this_ptr_conv;
43535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43536 this_ptr_conv.is_owned = false;
43537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43538 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43539 int64_t ret_ref = 0;
43540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43543 ret_ref = (uintptr_t)ret_var.inner;
43544 if (ret_var.is_owned) {
43550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43551 LDKRouteHop 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 LDKChannelFeatures val_conv;
43556 val_conv.inner = (void*)(val & (~1));
43557 val_conv.is_owned = (val & 1) || (val == 0);
43558 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43559 val_conv = ChannelFeatures_clone(&val_conv);
43560 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43564 LDKRouteHop this_ptr_conv;
43565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43566 this_ptr_conv.is_owned = false;
43567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43568 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43573 LDKRouteHop this_ptr_conv;
43574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43575 this_ptr_conv.is_owned = false;
43576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43577 RouteHop_set_fee_msat(&this_ptr_conv, val);
43580 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43581 LDKRouteHop this_ptr_conv;
43582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43583 this_ptr_conv.is_owned = false;
43584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43585 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43590 LDKRouteHop this_ptr_conv;
43591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43592 this_ptr_conv.is_owned = false;
43593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43594 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43597 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) {
43598 LDKPublicKey pubkey_arg_ref;
43599 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
43600 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
43601 LDKNodeFeatures node_features_arg_conv;
43602 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
43603 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
43604 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43605 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43606 LDKChannelFeatures channel_features_arg_conv;
43607 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
43608 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
43609 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43610 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43611 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);
43612 int64_t ret_ref = 0;
43613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43616 ret_ref = (uintptr_t)ret_var.inner;
43617 if (ret_var.is_owned) {
43623 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43624 LDKRouteHop ret_var = RouteHop_clone(arg);
43625 int64_t ret_ref = 0;
43626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43629 ret_ref = (uintptr_t)ret_var.inner;
43630 if (ret_var.is_owned) {
43635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43636 LDKRouteHop arg_conv;
43637 arg_conv.inner = (void*)(arg & (~1));
43638 arg_conv.is_owned = false;
43639 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43640 int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43645 LDKRouteHop orig_conv;
43646 orig_conv.inner = (void*)(orig & (~1));
43647 orig_conv.is_owned = false;
43648 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43649 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43650 int64_t ret_ref = 0;
43651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43654 ret_ref = (uintptr_t)ret_var.inner;
43655 if (ret_var.is_owned) {
43661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
43662 LDKRouteHop o_conv;
43663 o_conv.inner = (void*)(o & (~1));
43664 o_conv.is_owned = false;
43665 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43666 int64_t ret_conv = RouteHop_hash(&o_conv);
43670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43671 LDKRouteHop a_conv;
43672 a_conv.inner = (void*)(a & (~1));
43673 a_conv.is_owned = false;
43674 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43675 LDKRouteHop b_conv;
43676 b_conv.inner = (void*)(b & (~1));
43677 b_conv.is_owned = false;
43678 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43679 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
43684 LDKRouteHop obj_conv;
43685 obj_conv.inner = (void*)(obj & (~1));
43686 obj_conv.is_owned = false;
43687 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43688 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43689 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43690 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43691 CVec_u8Z_free(ret_var);
43695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43696 LDKu8slice ser_ref;
43697 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43698 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43699 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43700 *ret_conv = RouteHop_read(ser_ref);
43701 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43702 return (int64_t)ret_conv;
43705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43706 LDKRoute this_obj_conv;
43707 this_obj_conv.inner = (void*)(this_obj & (~1));
43708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43710 Route_free(this_obj_conv);
43713 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43714 LDKRoute this_ptr_conv;
43715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43716 this_ptr_conv.is_owned = false;
43717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43718 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43719 jobjectArray ret_arr = NULL;
43720 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
43722 for (size_t m = 0; m < ret_var.datalen; m++) {
43723 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43724 int64_tArray ret_conv_12_arr = NULL;
43725 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
43726 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
43727 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43728 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43729 int64_t ret_conv_12_conv_10_ref = 0;
43730 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43731 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43733 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
43734 if (ret_conv_12_conv_10_var.is_owned) {
43735 ret_conv_12_conv_10_ref |= 1;
43737 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43739 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
43740 FREE(ret_conv_12_var.data);
43741 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
43744 FREE(ret_var.data);
43748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43749 LDKRoute this_ptr_conv;
43750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43751 this_ptr_conv.is_owned = false;
43752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43753 LDKCVec_CVec_RouteHopZZ val_constr;
43754 val_constr.datalen = (*env)->GetArrayLength(env, val);
43755 if (val_constr.datalen > 0)
43756 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43758 val_constr.data = NULL;
43759 for (size_t m = 0; m < val_constr.datalen; m++) {
43760 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
43761 LDKCVec_RouteHopZ val_conv_12_constr;
43762 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
43763 if (val_conv_12_constr.datalen > 0)
43764 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43766 val_conv_12_constr.data = NULL;
43767 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
43768 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
43769 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
43770 LDKRouteHop val_conv_12_conv_10_conv;
43771 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
43772 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
43773 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
43774 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
43775 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
43777 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
43778 val_constr.data[m] = val_conv_12_constr;
43780 Route_set_paths(&this_ptr_conv, val_constr);
43783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43784 LDKRoute this_ptr_conv;
43785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43786 this_ptr_conv.is_owned = false;
43787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43788 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
43789 int64_t ret_ref = 0;
43790 if ((uintptr_t)ret_var.inner > 4096) {
43791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43794 ret_ref = (uintptr_t)ret_var.inner;
43795 if (ret_var.is_owned) {
43802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43803 LDKRoute this_ptr_conv;
43804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43805 this_ptr_conv.is_owned = false;
43806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43807 LDKPaymentParameters val_conv;
43808 val_conv.inner = (void*)(val & (~1));
43809 val_conv.is_owned = (val & 1) || (val == 0);
43810 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43811 val_conv = PaymentParameters_clone(&val_conv);
43812 Route_set_payment_params(&this_ptr_conv, val_conv);
43815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
43816 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
43817 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
43818 if (paths_arg_constr.datalen > 0)
43819 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43821 paths_arg_constr.data = NULL;
43822 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
43823 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
43824 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
43825 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
43826 if (paths_arg_conv_12_constr.datalen > 0)
43827 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43829 paths_arg_conv_12_constr.data = NULL;
43830 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
43831 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
43832 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
43833 LDKRouteHop paths_arg_conv_12_conv_10_conv;
43834 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
43835 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
43836 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
43837 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
43838 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
43840 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
43841 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
43843 LDKPaymentParameters payment_params_arg_conv;
43844 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
43845 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
43846 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43847 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43848 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
43849 int64_t ret_ref = 0;
43850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43853 ret_ref = (uintptr_t)ret_var.inner;
43854 if (ret_var.is_owned) {
43860 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
43861 LDKRoute ret_var = Route_clone(arg);
43862 int64_t ret_ref = 0;
43863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43866 ret_ref = (uintptr_t)ret_var.inner;
43867 if (ret_var.is_owned) {
43872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43874 arg_conv.inner = (void*)(arg & (~1));
43875 arg_conv.is_owned = false;
43876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43877 int64_t ret_conv = Route_clone_ptr(&arg_conv);
43881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43882 LDKRoute orig_conv;
43883 orig_conv.inner = (void*)(orig & (~1));
43884 orig_conv.is_owned = false;
43885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43886 LDKRoute ret_var = Route_clone(&orig_conv);
43887 int64_t ret_ref = 0;
43888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43891 ret_ref = (uintptr_t)ret_var.inner;
43892 if (ret_var.is_owned) {
43898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
43900 o_conv.inner = (void*)(o & (~1));
43901 o_conv.is_owned = false;
43902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43903 int64_t ret_conv = Route_hash(&o_conv);
43907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43909 a_conv.inner = (void*)(a & (~1));
43910 a_conv.is_owned = false;
43911 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43913 b_conv.inner = (void*)(b & (~1));
43914 b_conv.is_owned = false;
43915 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43916 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
43920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
43921 LDKRoute this_arg_conv;
43922 this_arg_conv.inner = (void*)(this_arg & (~1));
43923 this_arg_conv.is_owned = false;
43924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43925 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
43929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
43930 LDKRoute this_arg_conv;
43931 this_arg_conv.inner = (void*)(this_arg & (~1));
43932 this_arg_conv.is_owned = false;
43933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43934 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
43938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
43940 obj_conv.inner = (void*)(obj & (~1));
43941 obj_conv.is_owned = false;
43942 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43943 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
43944 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43945 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43946 CVec_u8Z_free(ret_var);
43950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43951 LDKu8slice ser_ref;
43952 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43953 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43954 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
43955 *ret_conv = Route_read(ser_ref);
43956 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43957 return (int64_t)ret_conv;
43960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43961 LDKRouteParameters this_obj_conv;
43962 this_obj_conv.inner = (void*)(this_obj & (~1));
43963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43965 RouteParameters_free(this_obj_conv);
43968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43969 LDKRouteParameters this_ptr_conv;
43970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43971 this_ptr_conv.is_owned = false;
43972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43973 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
43974 int64_t ret_ref = 0;
43975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43978 ret_ref = (uintptr_t)ret_var.inner;
43979 if (ret_var.is_owned) {
43985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43986 LDKRouteParameters this_ptr_conv;
43987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43988 this_ptr_conv.is_owned = false;
43989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43990 LDKPaymentParameters val_conv;
43991 val_conv.inner = (void*)(val & (~1));
43992 val_conv.is_owned = (val & 1) || (val == 0);
43993 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43994 val_conv = PaymentParameters_clone(&val_conv);
43995 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
43998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43999 LDKRouteParameters this_ptr_conv;
44000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44001 this_ptr_conv.is_owned = false;
44002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44003 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
44007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44008 LDKRouteParameters this_ptr_conv;
44009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44010 this_ptr_conv.is_owned = false;
44011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44012 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
44015 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44016 LDKRouteParameters this_ptr_conv;
44017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44018 this_ptr_conv.is_owned = false;
44019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44020 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
44024 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) {
44025 LDKRouteParameters this_ptr_conv;
44026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44027 this_ptr_conv.is_owned = false;
44028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44029 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
44032 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) {
44033 LDKPaymentParameters payment_params_arg_conv;
44034 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
44035 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
44036 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44037 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44038 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
44039 int64_t ret_ref = 0;
44040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44043 ret_ref = (uintptr_t)ret_var.inner;
44044 if (ret_var.is_owned) {
44050 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
44051 LDKRouteParameters ret_var = RouteParameters_clone(arg);
44052 int64_t ret_ref = 0;
44053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44056 ret_ref = (uintptr_t)ret_var.inner;
44057 if (ret_var.is_owned) {
44062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44063 LDKRouteParameters arg_conv;
44064 arg_conv.inner = (void*)(arg & (~1));
44065 arg_conv.is_owned = false;
44066 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44067 int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
44071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44072 LDKRouteParameters orig_conv;
44073 orig_conv.inner = (void*)(orig & (~1));
44074 orig_conv.is_owned = false;
44075 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44076 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
44077 int64_t ret_ref = 0;
44078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44081 ret_ref = (uintptr_t)ret_var.inner;
44082 if (ret_var.is_owned) {
44088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44089 LDKRouteParameters obj_conv;
44090 obj_conv.inner = (void*)(obj & (~1));
44091 obj_conv.is_owned = false;
44092 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44093 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
44094 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44095 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44096 CVec_u8Z_free(ret_var);
44100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44101 LDKu8slice ser_ref;
44102 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44103 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44104 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
44105 *ret_conv = RouteParameters_read(ser_ref);
44106 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44107 return (int64_t)ret_conv;
44110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44111 LDKPaymentParameters this_obj_conv;
44112 this_obj_conv.inner = (void*)(this_obj & (~1));
44113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44115 PaymentParameters_free(this_obj_conv);
44118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44119 LDKPaymentParameters this_ptr_conv;
44120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44121 this_ptr_conv.is_owned = false;
44122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44123 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
44128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44129 LDKPaymentParameters this_ptr_conv;
44130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44131 this_ptr_conv.is_owned = false;
44132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44133 LDKPublicKey val_ref;
44134 CHECK((*env)->GetArrayLength(env, val) == 33);
44135 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44136 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
44139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44140 LDKPaymentParameters this_ptr_conv;
44141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44142 this_ptr_conv.is_owned = false;
44143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44144 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
44145 int64_t ret_ref = 0;
44146 if ((uintptr_t)ret_var.inner > 4096) {
44147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44150 ret_ref = (uintptr_t)ret_var.inner;
44151 if (ret_var.is_owned) {
44158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44159 LDKPaymentParameters this_ptr_conv;
44160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44161 this_ptr_conv.is_owned = false;
44162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44163 LDKInvoiceFeatures val_conv;
44164 val_conv.inner = (void*)(val & (~1));
44165 val_conv.is_owned = (val & 1) || (val == 0);
44166 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44167 val_conv = InvoiceFeatures_clone(&val_conv);
44168 PaymentParameters_set_features(&this_ptr_conv, val_conv);
44171 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
44172 LDKPaymentParameters this_ptr_conv;
44173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44174 this_ptr_conv.is_owned = false;
44175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44176 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44177 int64_tArray ret_arr = NULL;
44178 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44179 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44180 for (size_t l = 0; l < ret_var.datalen; l++) {
44181 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44182 int64_t ret_conv_11_ref = 0;
44183 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44184 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44186 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
44187 if (ret_conv_11_var.is_owned) {
44188 ret_conv_11_ref |= 1;
44190 ret_arr_ptr[l] = ret_conv_11_ref;
44192 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44193 FREE(ret_var.data);
44197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44198 LDKPaymentParameters 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_RouteHintZ val_constr;
44203 val_constr.datalen = (*env)->GetArrayLength(env, val);
44204 if (val_constr.datalen > 0)
44205 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44207 val_constr.data = NULL;
44208 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44209 for (size_t l = 0; l < val_constr.datalen; l++) {
44210 int64_t val_conv_11 = val_vals[l];
44211 LDKRouteHint val_conv_11_conv;
44212 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
44213 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
44214 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44215 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44216 val_constr.data[l] = val_conv_11_conv;
44218 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44219 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
44223 LDKPaymentParameters this_ptr_conv;
44224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44225 this_ptr_conv.is_owned = false;
44226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44227 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44228 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44229 int64_t ret_ref = (uintptr_t)ret_copy;
44233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44234 LDKPaymentParameters this_ptr_conv;
44235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44236 this_ptr_conv.is_owned = false;
44237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44238 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
44239 CHECK_ACCESS(val_ptr);
44240 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44241 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
44242 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44245 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44246 LDKPaymentParameters this_ptr_conv;
44247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44248 this_ptr_conv.is_owned = false;
44249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44250 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44254 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) {
44255 LDKPaymentParameters this_ptr_conv;
44256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44257 this_ptr_conv.is_owned = false;
44258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44259 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44262 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) {
44263 LDKPublicKey payee_pubkey_arg_ref;
44264 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
44265 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
44266 LDKInvoiceFeatures features_arg_conv;
44267 features_arg_conv.inner = (void*)(features_arg & (~1));
44268 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
44269 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44270 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44271 LDKCVec_RouteHintZ route_hints_arg_constr;
44272 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
44273 if (route_hints_arg_constr.datalen > 0)
44274 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44276 route_hints_arg_constr.data = NULL;
44277 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
44278 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44279 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44280 LDKRouteHint route_hints_arg_conv_11_conv;
44281 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
44282 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
44283 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44284 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44285 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44287 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
44288 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
44289 CHECK_ACCESS(expiry_time_arg_ptr);
44290 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44291 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
44292 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);
44293 int64_t ret_ref = 0;
44294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44297 ret_ref = (uintptr_t)ret_var.inner;
44298 if (ret_var.is_owned) {
44304 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44305 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44306 int64_t ret_ref = 0;
44307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44310 ret_ref = (uintptr_t)ret_var.inner;
44311 if (ret_var.is_owned) {
44316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44317 LDKPaymentParameters arg_conv;
44318 arg_conv.inner = (void*)(arg & (~1));
44319 arg_conv.is_owned = false;
44320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44321 int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44326 LDKPaymentParameters orig_conv;
44327 orig_conv.inner = (void*)(orig & (~1));
44328 orig_conv.is_owned = false;
44329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44330 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44331 int64_t ret_ref = 0;
44332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44335 ret_ref = (uintptr_t)ret_var.inner;
44336 if (ret_var.is_owned) {
44342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
44343 LDKPaymentParameters o_conv;
44344 o_conv.inner = (void*)(o & (~1));
44345 o_conv.is_owned = false;
44346 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44347 int64_t ret_conv = PaymentParameters_hash(&o_conv);
44351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44352 LDKPaymentParameters a_conv;
44353 a_conv.inner = (void*)(a & (~1));
44354 a_conv.is_owned = false;
44355 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44356 LDKPaymentParameters b_conv;
44357 b_conv.inner = (void*)(b & (~1));
44358 b_conv.is_owned = false;
44359 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44360 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44365 LDKPaymentParameters obj_conv;
44366 obj_conv.inner = (void*)(obj & (~1));
44367 obj_conv.is_owned = false;
44368 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44369 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44372 CVec_u8Z_free(ret_var);
44376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44377 LDKu8slice ser_ref;
44378 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44379 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44380 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44381 *ret_conv = PaymentParameters_read(ser_ref);
44382 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44383 return (int64_t)ret_conv;
44386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44387 LDKPublicKey payee_pubkey_ref;
44388 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44389 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44390 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44391 int64_t ret_ref = 0;
44392 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44393 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44395 ret_ref = (uintptr_t)ret_var.inner;
44396 if (ret_var.is_owned) {
44402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44403 LDKPublicKey payee_pubkey_ref;
44404 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44405 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44406 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44407 int64_t ret_ref = 0;
44408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44411 ret_ref = (uintptr_t)ret_var.inner;
44412 if (ret_var.is_owned) {
44418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44419 LDKRouteHint this_obj_conv;
44420 this_obj_conv.inner = (void*)(this_obj & (~1));
44421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44423 RouteHint_free(this_obj_conv);
44426 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44427 LDKRouteHint this_ptr_conv;
44428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44429 this_ptr_conv.is_owned = false;
44430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44431 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44432 int64_tArray ret_arr = NULL;
44433 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44434 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44435 for (size_t o = 0; o < ret_var.datalen; o++) {
44436 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44437 int64_t ret_conv_14_ref = 0;
44438 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44439 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44441 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44442 if (ret_conv_14_var.is_owned) {
44443 ret_conv_14_ref |= 1;
44445 ret_arr_ptr[o] = ret_conv_14_ref;
44447 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44448 FREE(ret_var.data);
44452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44453 LDKRouteHint 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 LDKCVec_RouteHintHopZ val_constr;
44458 val_constr.datalen = (*env)->GetArrayLength(env, val);
44459 if (val_constr.datalen > 0)
44460 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44462 val_constr.data = NULL;
44463 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44464 for (size_t o = 0; o < val_constr.datalen; o++) {
44465 int64_t val_conv_14 = val_vals[o];
44466 LDKRouteHintHop val_conv_14_conv;
44467 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
44468 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
44469 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44470 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44471 val_constr.data[o] = val_conv_14_conv;
44473 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44474 RouteHint_set_a(&this_ptr_conv, val_constr);
44477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
44478 LDKCVec_RouteHintHopZ a_arg_constr;
44479 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
44480 if (a_arg_constr.datalen > 0)
44481 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44483 a_arg_constr.data = NULL;
44484 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
44485 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44486 int64_t a_arg_conv_14 = a_arg_vals[o];
44487 LDKRouteHintHop a_arg_conv_14_conv;
44488 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
44489 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
44490 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44491 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44492 a_arg_constr.data[o] = a_arg_conv_14_conv;
44494 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
44495 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44496 int64_t ret_ref = 0;
44497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44500 ret_ref = (uintptr_t)ret_var.inner;
44501 if (ret_var.is_owned) {
44507 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44508 LDKRouteHint ret_var = RouteHint_clone(arg);
44509 int64_t ret_ref = 0;
44510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44513 ret_ref = (uintptr_t)ret_var.inner;
44514 if (ret_var.is_owned) {
44519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44520 LDKRouteHint arg_conv;
44521 arg_conv.inner = (void*)(arg & (~1));
44522 arg_conv.is_owned = false;
44523 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44524 int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44529 LDKRouteHint orig_conv;
44530 orig_conv.inner = (void*)(orig & (~1));
44531 orig_conv.is_owned = false;
44532 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44533 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44534 int64_t ret_ref = 0;
44535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44538 ret_ref = (uintptr_t)ret_var.inner;
44539 if (ret_var.is_owned) {
44545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
44546 LDKRouteHint o_conv;
44547 o_conv.inner = (void*)(o & (~1));
44548 o_conv.is_owned = false;
44549 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44550 int64_t ret_conv = RouteHint_hash(&o_conv);
44554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44555 LDKRouteHint a_conv;
44556 a_conv.inner = (void*)(a & (~1));
44557 a_conv.is_owned = false;
44558 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44559 LDKRouteHint b_conv;
44560 b_conv.inner = (void*)(b & (~1));
44561 b_conv.is_owned = false;
44562 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44563 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
44568 LDKRouteHint obj_conv;
44569 obj_conv.inner = (void*)(obj & (~1));
44570 obj_conv.is_owned = false;
44571 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44572 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44573 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44574 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44575 CVec_u8Z_free(ret_var);
44579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44580 LDKu8slice ser_ref;
44581 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44582 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44583 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44584 *ret_conv = RouteHint_read(ser_ref);
44585 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44586 return (int64_t)ret_conv;
44589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44590 LDKRouteHintHop this_obj_conv;
44591 this_obj_conv.inner = (void*)(this_obj & (~1));
44592 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44594 RouteHintHop_free(this_obj_conv);
44597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44598 LDKRouteHintHop this_ptr_conv;
44599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44600 this_ptr_conv.is_owned = false;
44601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44602 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44603 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
44607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44608 LDKRouteHintHop this_ptr_conv;
44609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44610 this_ptr_conv.is_owned = false;
44611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44612 LDKPublicKey val_ref;
44613 CHECK((*env)->GetArrayLength(env, val) == 33);
44614 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44615 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44619 LDKRouteHintHop this_ptr_conv;
44620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44621 this_ptr_conv.is_owned = false;
44622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44623 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44628 LDKRouteHintHop this_ptr_conv;
44629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44630 this_ptr_conv.is_owned = false;
44631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44632 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44636 LDKRouteHintHop this_ptr_conv;
44637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44638 this_ptr_conv.is_owned = false;
44639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44640 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44641 int64_t ret_ref = 0;
44642 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44643 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44645 ret_ref = (uintptr_t)ret_var.inner;
44646 if (ret_var.is_owned) {
44652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44653 LDKRouteHintHop this_ptr_conv;
44654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44655 this_ptr_conv.is_owned = false;
44656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44657 LDKRoutingFees val_conv;
44658 val_conv.inner = (void*)(val & (~1));
44659 val_conv.is_owned = (val & 1) || (val == 0);
44660 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44661 val_conv = RoutingFees_clone(&val_conv);
44662 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44665 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44666 LDKRouteHintHop this_ptr_conv;
44667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44668 this_ptr_conv.is_owned = false;
44669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44670 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44675 LDKRouteHintHop this_ptr_conv;
44676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44677 this_ptr_conv.is_owned = false;
44678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44679 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44683 LDKRouteHintHop this_ptr_conv;
44684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44685 this_ptr_conv.is_owned = false;
44686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44687 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44688 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44689 int64_t ret_ref = (uintptr_t)ret_copy;
44693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44694 LDKRouteHintHop this_ptr_conv;
44695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44696 this_ptr_conv.is_owned = false;
44697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44698 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
44699 CHECK_ACCESS(val_ptr);
44700 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44701 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
44702 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44706 LDKRouteHintHop this_ptr_conv;
44707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44708 this_ptr_conv.is_owned = false;
44709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44710 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44711 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44712 int64_t ret_ref = (uintptr_t)ret_copy;
44716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44717 LDKRouteHintHop this_ptr_conv;
44718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44719 this_ptr_conv.is_owned = false;
44720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44721 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
44722 CHECK_ACCESS(val_ptr);
44723 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44724 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
44725 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
44728 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) {
44729 LDKPublicKey src_node_id_arg_ref;
44730 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
44731 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
44732 LDKRoutingFees fees_arg_conv;
44733 fees_arg_conv.inner = (void*)(fees_arg & (~1));
44734 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
44735 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44736 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44737 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
44738 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
44739 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
44740 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
44741 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
44742 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
44743 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
44744 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
44745 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);
44746 int64_t ret_ref = 0;
44747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44750 ret_ref = (uintptr_t)ret_var.inner;
44751 if (ret_var.is_owned) {
44757 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
44758 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
44759 int64_t ret_ref = 0;
44760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44763 ret_ref = (uintptr_t)ret_var.inner;
44764 if (ret_var.is_owned) {
44769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44770 LDKRouteHintHop arg_conv;
44771 arg_conv.inner = (void*)(arg & (~1));
44772 arg_conv.is_owned = false;
44773 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44774 int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
44778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44779 LDKRouteHintHop orig_conv;
44780 orig_conv.inner = (void*)(orig & (~1));
44781 orig_conv.is_owned = false;
44782 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44783 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
44784 int64_t ret_ref = 0;
44785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44788 ret_ref = (uintptr_t)ret_var.inner;
44789 if (ret_var.is_owned) {
44795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
44796 LDKRouteHintHop o_conv;
44797 o_conv.inner = (void*)(o & (~1));
44798 o_conv.is_owned = false;
44799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44800 int64_t ret_conv = RouteHintHop_hash(&o_conv);
44804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44805 LDKRouteHintHop a_conv;
44806 a_conv.inner = (void*)(a & (~1));
44807 a_conv.is_owned = false;
44808 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44809 LDKRouteHintHop b_conv;
44810 b_conv.inner = (void*)(b & (~1));
44811 b_conv.is_owned = false;
44812 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44813 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
44817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
44818 LDKRouteHintHop obj_conv;
44819 obj_conv.inner = (void*)(obj & (~1));
44820 obj_conv.is_owned = false;
44821 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44822 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
44823 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44824 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44825 CVec_u8Z_free(ret_var);
44829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44830 LDKu8slice ser_ref;
44831 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44832 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44833 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
44834 *ret_conv = RouteHintHop_read(ser_ref);
44835 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44836 return (int64_t)ret_conv;
44839 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) {
44840 LDKPublicKey our_node_pubkey_ref;
44841 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44842 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44843 LDKRouteParameters route_params_conv;
44844 route_params_conv.inner = (void*)(route_params & (~1));
44845 route_params_conv.is_owned = false;
44846 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44847 LDKNetworkGraph network_graph_conv;
44848 network_graph_conv.inner = (void*)(network_graph & (~1));
44849 network_graph_conv.is_owned = false;
44850 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44851 LDKCVec_ChannelDetailsZ first_hops_constr;
44852 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
44853 if (first_hops != NULL) {
44854 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
44855 if (first_hops_constr.datalen > 0)
44856 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44858 first_hops_constr.data = NULL;
44859 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
44860 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
44861 int64_t first_hops_conv_16 = first_hops_vals[q];
44862 LDKChannelDetails first_hops_conv_16_conv;
44863 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
44864 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
44865 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
44866 first_hops_constr.data[q] = first_hops_conv_16_conv;
44868 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
44869 first_hops_ptr = &first_hops_constr;
44871 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44872 CHECK_ACCESS(logger_ptr);
44873 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44874 if (logger_conv.free == LDKLogger_JCalls_free) {
44875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44876 LDKLogger_JCalls_cloned(&logger_conv);
44878 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
44879 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
44880 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
44881 unsigned char random_seed_bytes_arr[32];
44882 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44883 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44884 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44885 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44886 *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);
44887 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
44888 return (int64_t)ret_conv;
44891 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) {
44892 LDKPublicKey our_node_pubkey_ref;
44893 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44894 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44895 LDKCVec_PublicKeyZ hops_constr;
44896 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
44897 if (hops_constr.datalen > 0)
44898 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44900 hops_constr.data = NULL;
44901 for (size_t i = 0; i < hops_constr.datalen; i++) {
44902 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
44903 LDKPublicKey hops_conv_8_ref;
44904 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
44905 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
44906 hops_constr.data[i] = hops_conv_8_ref;
44908 LDKRouteParameters route_params_conv;
44909 route_params_conv.inner = (void*)(route_params & (~1));
44910 route_params_conv.is_owned = false;
44911 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44912 LDKNetworkGraph network_graph_conv;
44913 network_graph_conv.inner = (void*)(network_graph & (~1));
44914 network_graph_conv.is_owned = false;
44915 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44916 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44917 CHECK_ACCESS(logger_ptr);
44918 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44919 if (logger_conv.free == LDKLogger_JCalls_free) {
44920 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44921 LDKLogger_JCalls_cloned(&logger_conv);
44923 unsigned char random_seed_bytes_arr[32];
44924 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44925 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44926 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44927 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44928 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
44929 return (int64_t)ret_conv;
44932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44933 if ((this_ptr & 1) != 0) return;
44934 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44935 CHECK_ACCESS(this_ptr_ptr);
44936 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
44937 FREE((void*)this_ptr);
44938 Score_free(this_ptr_conv);
44941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44942 if ((this_ptr & 1) != 0) return;
44943 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44944 CHECK_ACCESS(this_ptr_ptr);
44945 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
44946 FREE((void*)this_ptr);
44947 LockableScore_free(this_ptr_conv);
44950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44951 LDKMultiThreadedLockableScore this_obj_conv;
44952 this_obj_conv.inner = (void*)(this_obj & (~1));
44953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44955 MultiThreadedLockableScore_free(this_obj_conv);
44958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
44959 LDKMultiThreadedLockableScore obj_conv;
44960 obj_conv.inner = (void*)(obj & (~1));
44961 obj_conv.is_owned = false;
44962 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44963 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
44964 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44965 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44966 CVec_u8Z_free(ret_var);
44970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
44971 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
44972 CHECK_ACCESS(score_ptr);
44973 LDKScore score_conv = *(LDKScore*)(score_ptr);
44974 if (score_conv.free == LDKScore_JCalls_free) {
44975 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44976 LDKScore_JCalls_cloned(&score_conv);
44978 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
44979 int64_t ret_ref = 0;
44980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44983 ret_ref = (uintptr_t)ret_var.inner;
44984 if (ret_var.is_owned) {
44990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44991 LDKChannelUsage this_obj_conv;
44992 this_obj_conv.inner = (void*)(this_obj & (~1));
44993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44995 ChannelUsage_free(this_obj_conv);
44998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44999 LDKChannelUsage this_ptr_conv;
45000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45001 this_ptr_conv.is_owned = false;
45002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45003 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
45007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45008 LDKChannelUsage this_ptr_conv;
45009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45010 this_ptr_conv.is_owned = false;
45011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45012 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
45015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45016 LDKChannelUsage this_ptr_conv;
45017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45018 this_ptr_conv.is_owned = false;
45019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45020 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
45024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45025 LDKChannelUsage this_ptr_conv;
45026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45027 this_ptr_conv.is_owned = false;
45028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45029 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
45032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
45033 LDKChannelUsage this_ptr_conv;
45034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45035 this_ptr_conv.is_owned = false;
45036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45037 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
45038 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
45039 int64_t ret_ref = (uintptr_t)ret_copy;
45043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45044 LDKChannelUsage this_ptr_conv;
45045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45046 this_ptr_conv.is_owned = false;
45047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45048 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45049 CHECK_ACCESS(val_ptr);
45050 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
45051 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
45052 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
45055 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) {
45056 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
45057 CHECK_ACCESS(effective_capacity_arg_ptr);
45058 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
45059 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
45060 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
45061 int64_t ret_ref = 0;
45062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45065 ret_ref = (uintptr_t)ret_var.inner;
45066 if (ret_var.is_owned) {
45072 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
45073 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
45074 int64_t ret_ref = 0;
45075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45078 ret_ref = (uintptr_t)ret_var.inner;
45079 if (ret_var.is_owned) {
45084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45085 LDKChannelUsage arg_conv;
45086 arg_conv.inner = (void*)(arg & (~1));
45087 arg_conv.is_owned = false;
45088 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45089 int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
45093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45094 LDKChannelUsage orig_conv;
45095 orig_conv.inner = (void*)(orig & (~1));
45096 orig_conv.is_owned = false;
45097 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45098 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
45099 int64_t ret_ref = 0;
45100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45103 ret_ref = (uintptr_t)ret_var.inner;
45104 if (ret_var.is_owned) {
45110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45111 LDKFixedPenaltyScorer this_obj_conv;
45112 this_obj_conv.inner = (void*)(this_obj & (~1));
45113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45115 FixedPenaltyScorer_free(this_obj_conv);
45118 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
45119 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
45120 int64_t ret_ref = 0;
45121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45124 ret_ref = (uintptr_t)ret_var.inner;
45125 if (ret_var.is_owned) {
45130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45131 LDKFixedPenaltyScorer arg_conv;
45132 arg_conv.inner = (void*)(arg & (~1));
45133 arg_conv.is_owned = false;
45134 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45135 int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45140 LDKFixedPenaltyScorer orig_conv;
45141 orig_conv.inner = (void*)(orig & (~1));
45142 orig_conv.is_owned = false;
45143 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45144 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45145 int64_t ret_ref = 0;
45146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45149 ret_ref = (uintptr_t)ret_var.inner;
45150 if (ret_var.is_owned) {
45156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
45157 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45158 int64_t ret_ref = 0;
45159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45162 ret_ref = (uintptr_t)ret_var.inner;
45163 if (ret_var.is_owned) {
45169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45170 LDKFixedPenaltyScorer this_arg_conv;
45171 this_arg_conv.inner = (void*)(this_arg & (~1));
45172 this_arg_conv.is_owned = false;
45173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45174 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45175 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45176 return (int64_t)ret_ret;
45179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45180 LDKFixedPenaltyScorer obj_conv;
45181 obj_conv.inner = (void*)(obj & (~1));
45182 obj_conv.is_owned = false;
45183 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45184 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45185 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45186 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45187 CVec_u8Z_free(ret_var);
45191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45192 LDKu8slice ser_ref;
45193 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45194 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45195 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45196 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45197 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45198 return (int64_t)ret_conv;
45201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45202 LDKProbabilisticScorer this_obj_conv;
45203 this_obj_conv.inner = (void*)(this_obj & (~1));
45204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45206 ProbabilisticScorer_free(this_obj_conv);
45209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45210 LDKProbabilisticScoringParameters this_obj_conv;
45211 this_obj_conv.inner = (void*)(this_obj & (~1));
45212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45214 ProbabilisticScoringParameters_free(this_obj_conv);
45217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45218 LDKProbabilisticScoringParameters 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 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45227 LDKProbabilisticScoringParameters this_ptr_conv;
45228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45229 this_ptr_conv.is_owned = false;
45230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45231 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45235 LDKProbabilisticScoringParameters this_ptr_conv;
45236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45237 this_ptr_conv.is_owned = false;
45238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45239 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45243 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) {
45244 LDKProbabilisticScoringParameters this_ptr_conv;
45245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45246 this_ptr_conv.is_owned = false;
45247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45248 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
45252 LDKProbabilisticScoringParameters this_ptr_conv;
45253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45254 this_ptr_conv.is_owned = false;
45255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45256 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45260 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) {
45261 LDKProbabilisticScoringParameters this_ptr_conv;
45262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45263 this_ptr_conv.is_owned = false;
45264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45265 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45269 LDKProbabilisticScoringParameters this_ptr_conv;
45270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45271 this_ptr_conv.is_owned = false;
45272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45273 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
45277 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) {
45278 LDKProbabilisticScoringParameters this_ptr_conv;
45279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45280 this_ptr_conv.is_owned = false;
45281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45282 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
45285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) {
45286 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
45287 int64_t ret_ref = 0;
45288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45291 ret_ref = (uintptr_t)ret_var.inner;
45292 if (ret_var.is_owned) {
45298 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45299 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45300 int64_t ret_ref = 0;
45301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45304 ret_ref = (uintptr_t)ret_var.inner;
45305 if (ret_var.is_owned) {
45310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45311 LDKProbabilisticScoringParameters arg_conv;
45312 arg_conv.inner = (void*)(arg & (~1));
45313 arg_conv.is_owned = false;
45314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45315 int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45320 LDKProbabilisticScoringParameters orig_conv;
45321 orig_conv.inner = (void*)(orig & (~1));
45322 orig_conv.is_owned = false;
45323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45324 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45325 int64_t ret_ref = 0;
45326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45329 ret_ref = (uintptr_t)ret_var.inner;
45330 if (ret_var.is_owned) {
45336 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) {
45337 LDKProbabilisticScoringParameters params_conv;
45338 params_conv.inner = (void*)(params & (~1));
45339 params_conv.is_owned = (params & 1) || (params == 0);
45340 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45341 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
45342 LDKNetworkGraph network_graph_conv;
45343 network_graph_conv.inner = (void*)(network_graph & (~1));
45344 network_graph_conv.is_owned = false;
45345 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45346 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45347 CHECK_ACCESS(logger_ptr);
45348 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45349 if (logger_conv.free == LDKLogger_JCalls_free) {
45350 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45351 LDKLogger_JCalls_cloned(&logger_conv);
45353 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45354 int64_t ret_ref = 0;
45355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45358 ret_ref = (uintptr_t)ret_var.inner;
45359 if (ret_var.is_owned) {
45365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
45366 LDKProbabilisticScorer this_arg_conv;
45367 this_arg_conv.inner = (void*)(this_arg & (~1));
45368 this_arg_conv.is_owned = false;
45369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45370 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
45374 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45375 int64_t ret_ref = 0;
45376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45379 ret_ref = (uintptr_t)ret_var.inner;
45380 if (ret_var.is_owned) {
45386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45387 LDKProbabilisticScorer this_arg_conv;
45388 this_arg_conv.inner = (void*)(this_arg & (~1));
45389 this_arg_conv.is_owned = false;
45390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45391 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45392 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45393 return (int64_t)ret_ret;
45396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45397 LDKProbabilisticScorer obj_conv;
45398 obj_conv.inner = (void*)(obj & (~1));
45399 obj_conv.is_owned = false;
45400 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45401 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45402 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45403 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45404 CVec_u8Z_free(ret_var);
45408 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) {
45409 LDKu8slice ser_ref;
45410 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45411 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45412 LDKProbabilisticScoringParameters arg_a_conv;
45413 arg_a_conv.inner = (void*)(arg_a & (~1));
45414 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
45415 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45416 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45417 LDKNetworkGraph arg_b_conv;
45418 arg_b_conv.inner = (void*)(arg_b & (~1));
45419 arg_b_conv.is_owned = false;
45420 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45421 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
45422 CHECK_ACCESS(arg_c_ptr);
45423 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45424 if (arg_c_conv.free == LDKLogger_JCalls_free) {
45425 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45426 LDKLogger_JCalls_cloned(&arg_c_conv);
45428 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45429 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45430 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45431 return (int64_t)ret_conv;
45434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45435 LDKFilesystemPersister this_obj_conv;
45436 this_obj_conv.inner = (void*)(this_obj & (~1));
45437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45439 FilesystemPersister_free(this_obj_conv);
45442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
45443 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
45444 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
45445 int64_t ret_ref = 0;
45446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45449 ret_ref = (uintptr_t)ret_var.inner;
45450 if (ret_var.is_owned) {
45456 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
45457 LDKFilesystemPersister this_arg_conv;
45458 this_arg_conv.inner = (void*)(this_arg & (~1));
45459 this_arg_conv.is_owned = false;
45460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45461 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
45462 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
45468 LDKFilesystemPersister this_arg_conv;
45469 this_arg_conv.inner = (void*)(this_arg & (~1));
45470 this_arg_conv.is_owned = false;
45471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45472 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45473 CHECK_ACCESS(keys_manager_ptr);
45474 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45475 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45476 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45477 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45479 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
45480 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
45481 return (int64_t)ret_conv;
45484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45485 LDKBackgroundProcessor this_obj_conv;
45486 this_obj_conv.inner = (void*)(this_obj & (~1));
45487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45489 BackgroundProcessor_free(this_obj_conv);
45492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45493 if ((this_ptr & 1) != 0) return;
45494 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45495 CHECK_ACCESS(this_ptr_ptr);
45496 LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
45497 FREE((void*)this_ptr);
45498 GossipSync_free(this_ptr_conv);
45501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
45502 LDKP2PGossipSync a_conv;
45503 a_conv.inner = (void*)(a & (~1));
45504 a_conv.is_owned = false;
45505 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45506 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45507 *ret_copy = GossipSync_p2_p(&a_conv);
45508 int64_t ret_ref = (uintptr_t)ret_copy;
45512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
45513 LDKRapidGossipSync a_conv;
45514 a_conv.inner = (void*)(a & (~1));
45515 a_conv.is_owned = false;
45516 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45517 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45518 *ret_copy = GossipSync_rapid(&a_conv);
45519 int64_t ret_ref = (uintptr_t)ret_copy;
45523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
45524 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45525 *ret_copy = GossipSync_none();
45526 int64_t ret_ref = (uintptr_t)ret_copy;
45530 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) {
45531 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
45532 CHECK_ACCESS(persister_ptr);
45533 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
45534 if (persister_conv.free == LDKPersister_JCalls_free) {
45535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45536 LDKPersister_JCalls_cloned(&persister_conv);
45538 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
45539 CHECK_ACCESS(event_handler_ptr);
45540 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45541 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45542 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45543 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45545 LDKChainMonitor chain_monitor_conv;
45546 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
45547 chain_monitor_conv.is_owned = false;
45548 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
45549 LDKChannelManager channel_manager_conv;
45550 channel_manager_conv.inner = (void*)(channel_manager & (~1));
45551 channel_manager_conv.is_owned = false;
45552 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
45553 void* gossip_sync_ptr = (void*)(((uintptr_t)gossip_sync) & ~1);
45554 CHECK_ACCESS(gossip_sync_ptr);
45555 LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
45556 // WARNING: we may need a move here but no clone is available for LDKGossipSync
45557 LDKPeerManager peer_manager_conv;
45558 peer_manager_conv.inner = (void*)(peer_manager & (~1));
45559 peer_manager_conv.is_owned = false;
45560 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
45561 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45562 CHECK_ACCESS(logger_ptr);
45563 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45564 if (logger_conv.free == LDKLogger_JCalls_free) {
45565 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45566 LDKLogger_JCalls_cloned(&logger_conv);
45568 LDKMultiThreadedLockableScore scorer_conv;
45569 scorer_conv.inner = (void*)(scorer & (~1));
45570 scorer_conv.is_owned = (scorer & 1) || (scorer == 0);
45571 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45572 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);
45573 int64_t ret_ref = 0;
45574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45577 ret_ref = (uintptr_t)ret_var.inner;
45578 if (ret_var.is_owned) {
45584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
45585 LDKBackgroundProcessor this_arg_conv;
45586 this_arg_conv.inner = (void*)(this_arg & (~1));
45587 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45589 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45590 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45591 *ret_conv = BackgroundProcessor_join(this_arg_conv);
45592 return (int64_t)ret_conv;
45595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
45596 LDKBackgroundProcessor this_arg_conv;
45597 this_arg_conv.inner = (void*)(this_arg & (~1));
45598 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45600 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45601 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45602 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
45603 return (int64_t)ret_conv;
45606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45607 if ((this_ptr & 1) != 0) return;
45608 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45609 CHECK_ACCESS(this_ptr_ptr);
45610 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
45611 FREE((void*)this_ptr);
45612 ParseError_free(this_ptr_conv);
45615 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
45616 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45617 *ret_copy = ParseError_clone(arg);
45618 int64_t ret_ref = (uintptr_t)ret_copy;
45621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45622 LDKParseError* arg_conv = (LDKParseError*)arg;
45623 int64_t ret_conv = ParseError_clone_ptr(arg_conv);
45627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45628 LDKParseError* orig_conv = (LDKParseError*)orig;
45629 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45630 *ret_copy = ParseError_clone(orig_conv);
45631 int64_t ret_ref = (uintptr_t)ret_copy;
45635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
45636 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45637 CHECK_ACCESS(a_ptr);
45638 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
45639 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
45640 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45641 *ret_copy = ParseError_bech32_error(a_conv);
45642 int64_t ret_ref = (uintptr_t)ret_copy;
45646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
45648 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45649 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
45650 int64_t ret_ref = (uintptr_t)ret_copy;
45654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
45655 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
45656 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45657 *ret_copy = ParseError_malformed_signature(a_conv);
45658 int64_t ret_ref = (uintptr_t)ret_copy;
45662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
45663 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45664 *ret_copy = ParseError_bad_prefix();
45665 int64_t ret_ref = (uintptr_t)ret_copy;
45669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
45670 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45671 *ret_copy = ParseError_unknown_currency();
45672 int64_t ret_ref = (uintptr_t)ret_copy;
45676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
45677 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45678 *ret_copy = ParseError_unknown_si_prefix();
45679 int64_t ret_ref = (uintptr_t)ret_copy;
45683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
45684 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45685 *ret_copy = ParseError_malformed_hrp();
45686 int64_t ret_ref = (uintptr_t)ret_copy;
45690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
45691 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45692 *ret_copy = ParseError_too_short_data_part();
45693 int64_t ret_ref = (uintptr_t)ret_copy;
45697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
45698 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45699 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
45700 int64_t ret_ref = (uintptr_t)ret_copy;
45704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
45706 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45707 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
45708 int64_t ret_ref = (uintptr_t)ret_copy;
45712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
45713 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45714 *ret_copy = ParseError_padding_error();
45715 int64_t ret_ref = (uintptr_t)ret_copy;
45719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
45720 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45721 *ret_copy = ParseError_integer_overflow_error();
45722 int64_t ret_ref = (uintptr_t)ret_copy;
45726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
45727 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45728 *ret_copy = ParseError_invalid_seg_wit_program_length();
45729 int64_t ret_ref = (uintptr_t)ret_copy;
45733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
45734 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45735 *ret_copy = ParseError_invalid_pub_key_hash_length();
45736 int64_t ret_ref = (uintptr_t)ret_copy;
45740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
45741 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45742 *ret_copy = ParseError_invalid_script_hash_length();
45743 int64_t ret_ref = (uintptr_t)ret_copy;
45747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45748 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45749 *ret_copy = ParseError_invalid_recovery_id();
45750 int64_t ret_ref = (uintptr_t)ret_copy;
45754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
45755 LDKStr a_conv = java_to_owned_str(env, a);
45756 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45757 *ret_copy = ParseError_invalid_slice_length(a_conv);
45758 int64_t ret_ref = (uintptr_t)ret_copy;
45762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
45763 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45764 *ret_copy = ParseError_skip();
45765 int64_t ret_ref = (uintptr_t)ret_copy;
45769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45770 if ((this_ptr & 1) != 0) return;
45771 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45772 CHECK_ACCESS(this_ptr_ptr);
45773 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45774 FREE((void*)this_ptr);
45775 ParseOrSemanticError_free(this_ptr_conv);
45778 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45779 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45780 *ret_copy = ParseOrSemanticError_clone(arg);
45781 int64_t ret_ref = (uintptr_t)ret_copy;
45784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45785 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
45786 int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45791 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
45792 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45793 *ret_copy = ParseOrSemanticError_clone(orig_conv);
45794 int64_t ret_ref = (uintptr_t)ret_copy;
45798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
45799 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45800 CHECK_ACCESS(a_ptr);
45801 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45802 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
45803 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45804 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45805 int64_t ret_ref = (uintptr_t)ret_copy;
45809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
45810 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
45811 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45812 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45813 int64_t ret_ref = (uintptr_t)ret_copy;
45817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45818 LDKInvoice this_obj_conv;
45819 this_obj_conv.inner = (void*)(this_obj & (~1));
45820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45822 Invoice_free(this_obj_conv);
45825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45827 a_conv.inner = (void*)(a & (~1));
45828 a_conv.is_owned = false;
45829 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45831 b_conv.inner = (void*)(b & (~1));
45832 b_conv.is_owned = false;
45833 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45834 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45838 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45839 LDKInvoice ret_var = Invoice_clone(arg);
45840 int64_t ret_ref = 0;
45841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45844 ret_ref = (uintptr_t)ret_var.inner;
45845 if (ret_var.is_owned) {
45850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45851 LDKInvoice arg_conv;
45852 arg_conv.inner = (void*)(arg & (~1));
45853 arg_conv.is_owned = false;
45854 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45855 int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45860 LDKInvoice orig_conv;
45861 orig_conv.inner = (void*)(orig & (~1));
45862 orig_conv.is_owned = false;
45863 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45864 LDKInvoice ret_var = Invoice_clone(&orig_conv);
45865 int64_t ret_ref = 0;
45866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45869 ret_ref = (uintptr_t)ret_var.inner;
45870 if (ret_var.is_owned) {
45876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45877 LDKSignedRawInvoice this_obj_conv;
45878 this_obj_conv.inner = (void*)(this_obj & (~1));
45879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45881 SignedRawInvoice_free(this_obj_conv);
45884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45885 LDKSignedRawInvoice a_conv;
45886 a_conv.inner = (void*)(a & (~1));
45887 a_conv.is_owned = false;
45888 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45889 LDKSignedRawInvoice b_conv;
45890 b_conv.inner = (void*)(b & (~1));
45891 b_conv.is_owned = false;
45892 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45893 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45897 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45898 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45899 int64_t ret_ref = 0;
45900 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45901 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45903 ret_ref = (uintptr_t)ret_var.inner;
45904 if (ret_var.is_owned) {
45909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45910 LDKSignedRawInvoice arg_conv;
45911 arg_conv.inner = (void*)(arg & (~1));
45912 arg_conv.is_owned = false;
45913 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45914 int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45919 LDKSignedRawInvoice orig_conv;
45920 orig_conv.inner = (void*)(orig & (~1));
45921 orig_conv.is_owned = false;
45922 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45923 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45924 int64_t ret_ref = 0;
45925 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45926 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45927 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45928 ret_ref = (uintptr_t)ret_var.inner;
45929 if (ret_var.is_owned) {
45935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45936 LDKRawInvoice this_obj_conv;
45937 this_obj_conv.inner = (void*)(this_obj & (~1));
45938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45940 RawInvoice_free(this_obj_conv);
45943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45944 LDKRawInvoice this_ptr_conv;
45945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45946 this_ptr_conv.is_owned = false;
45947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45948 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45949 int64_t ret_ref = 0;
45950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45953 ret_ref = (uintptr_t)ret_var.inner;
45954 if (ret_var.is_owned) {
45960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45961 LDKRawInvoice this_ptr_conv;
45962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45963 this_ptr_conv.is_owned = false;
45964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45965 LDKRawDataPart val_conv;
45966 val_conv.inner = (void*)(val & (~1));
45967 val_conv.is_owned = (val & 1) || (val == 0);
45968 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45969 val_conv = RawDataPart_clone(&val_conv);
45970 RawInvoice_set_data(&this_ptr_conv, val_conv);
45973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45974 LDKRawInvoice a_conv;
45975 a_conv.inner = (void*)(a & (~1));
45976 a_conv.is_owned = false;
45977 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45978 LDKRawInvoice b_conv;
45979 b_conv.inner = (void*)(b & (~1));
45980 b_conv.is_owned = false;
45981 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45982 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45986 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45987 LDKRawInvoice ret_var = RawInvoice_clone(arg);
45988 int64_t ret_ref = 0;
45989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45992 ret_ref = (uintptr_t)ret_var.inner;
45993 if (ret_var.is_owned) {
45998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45999 LDKRawInvoice arg_conv;
46000 arg_conv.inner = (void*)(arg & (~1));
46001 arg_conv.is_owned = false;
46002 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46003 int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
46007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46008 LDKRawInvoice orig_conv;
46009 orig_conv.inner = (void*)(orig & (~1));
46010 orig_conv.is_owned = false;
46011 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46012 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46013 int64_t ret_ref = 0;
46014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46017 ret_ref = (uintptr_t)ret_var.inner;
46018 if (ret_var.is_owned) {
46024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46025 LDKRawDataPart this_obj_conv;
46026 this_obj_conv.inner = (void*)(this_obj & (~1));
46027 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46029 RawDataPart_free(this_obj_conv);
46032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46033 LDKRawDataPart this_ptr_conv;
46034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46035 this_ptr_conv.is_owned = false;
46036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46037 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46038 int64_t ret_ref = 0;
46039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46042 ret_ref = (uintptr_t)ret_var.inner;
46043 if (ret_var.is_owned) {
46049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46050 LDKRawDataPart this_ptr_conv;
46051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46052 this_ptr_conv.is_owned = false;
46053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46054 LDKPositiveTimestamp val_conv;
46055 val_conv.inner = (void*)(val & (~1));
46056 val_conv.is_owned = (val & 1) || (val == 0);
46057 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46058 val_conv = PositiveTimestamp_clone(&val_conv);
46059 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46063 LDKRawDataPart a_conv;
46064 a_conv.inner = (void*)(a & (~1));
46065 a_conv.is_owned = false;
46066 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46067 LDKRawDataPart b_conv;
46068 b_conv.inner = (void*)(b & (~1));
46069 b_conv.is_owned = false;
46070 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46071 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
46075 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
46076 LDKRawDataPart ret_var = RawDataPart_clone(arg);
46077 int64_t ret_ref = 0;
46078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46081 ret_ref = (uintptr_t)ret_var.inner;
46082 if (ret_var.is_owned) {
46087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46088 LDKRawDataPart arg_conv;
46089 arg_conv.inner = (void*)(arg & (~1));
46090 arg_conv.is_owned = false;
46091 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46092 int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
46096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46097 LDKRawDataPart orig_conv;
46098 orig_conv.inner = (void*)(orig & (~1));
46099 orig_conv.is_owned = false;
46100 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46101 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
46102 int64_t ret_ref = 0;
46103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46106 ret_ref = (uintptr_t)ret_var.inner;
46107 if (ret_var.is_owned) {
46113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46114 LDKPositiveTimestamp this_obj_conv;
46115 this_obj_conv.inner = (void*)(this_obj & (~1));
46116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46118 PositiveTimestamp_free(this_obj_conv);
46121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46122 LDKPositiveTimestamp a_conv;
46123 a_conv.inner = (void*)(a & (~1));
46124 a_conv.is_owned = false;
46125 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46126 LDKPositiveTimestamp b_conv;
46127 b_conv.inner = (void*)(b & (~1));
46128 b_conv.is_owned = false;
46129 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46130 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
46134 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
46135 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
46136 int64_t ret_ref = 0;
46137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46140 ret_ref = (uintptr_t)ret_var.inner;
46141 if (ret_var.is_owned) {
46146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46147 LDKPositiveTimestamp arg_conv;
46148 arg_conv.inner = (void*)(arg & (~1));
46149 arg_conv.is_owned = false;
46150 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46151 int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
46155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46156 LDKPositiveTimestamp orig_conv;
46157 orig_conv.inner = (void*)(orig & (~1));
46158 orig_conv.is_owned = false;
46159 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46160 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
46161 int64_t ret_ref = 0;
46162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46165 ret_ref = (uintptr_t)ret_var.inner;
46166 if (ret_var.is_owned) {
46172 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46173 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
46174 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
46178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
46179 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
46183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
46184 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
46188 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
46189 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
46193 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
46194 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
46198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46199 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
46200 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
46201 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
46205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
46206 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
46207 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
46211 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46212 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
46213 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
46217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
46218 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
46222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
46223 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
46227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
46228 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
46232 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
46233 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
46237 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
46238 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
46242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
46243 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
46244 int64_t ret_conv = Currency_hash(o_conv);
46248 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46249 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
46250 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
46251 jboolean ret_conv = Currency_eq(a_conv, b_conv);
46255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46256 LDKSha256 this_obj_conv;
46257 this_obj_conv.inner = (void*)(this_obj & (~1));
46258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46260 Sha256_free(this_obj_conv);
46263 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
46264 LDKSha256 ret_var = Sha256_clone(arg);
46265 int64_t ret_ref = 0;
46266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46269 ret_ref = (uintptr_t)ret_var.inner;
46270 if (ret_var.is_owned) {
46275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46276 LDKSha256 arg_conv;
46277 arg_conv.inner = (void*)(arg & (~1));
46278 arg_conv.is_owned = false;
46279 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46280 int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
46284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46285 LDKSha256 orig_conv;
46286 orig_conv.inner = (void*)(orig & (~1));
46287 orig_conv.is_owned = false;
46288 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46289 LDKSha256 ret_var = Sha256_clone(&orig_conv);
46290 int64_t ret_ref = 0;
46291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46294 ret_ref = (uintptr_t)ret_var.inner;
46295 if (ret_var.is_owned) {
46301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
46303 o_conv.inner = (void*)(o & (~1));
46304 o_conv.is_owned = false;
46305 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46306 int64_t ret_conv = Sha256_hash(&o_conv);
46310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46312 a_conv.inner = (void*)(a & (~1));
46313 a_conv.is_owned = false;
46314 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46316 b_conv.inner = (void*)(b & (~1));
46317 b_conv.is_owned = false;
46318 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46319 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
46323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46324 LDKDescription this_obj_conv;
46325 this_obj_conv.inner = (void*)(this_obj & (~1));
46326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46328 Description_free(this_obj_conv);
46331 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
46332 LDKDescription ret_var = Description_clone(arg);
46333 int64_t ret_ref = 0;
46334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46337 ret_ref = (uintptr_t)ret_var.inner;
46338 if (ret_var.is_owned) {
46343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46344 LDKDescription arg_conv;
46345 arg_conv.inner = (void*)(arg & (~1));
46346 arg_conv.is_owned = false;
46347 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46348 int64_t ret_conv = Description_clone_ptr(&arg_conv);
46352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46353 LDKDescription orig_conv;
46354 orig_conv.inner = (void*)(orig & (~1));
46355 orig_conv.is_owned = false;
46356 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46357 LDKDescription ret_var = Description_clone(&orig_conv);
46358 int64_t ret_ref = 0;
46359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46362 ret_ref = (uintptr_t)ret_var.inner;
46363 if (ret_var.is_owned) {
46369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
46370 LDKDescription o_conv;
46371 o_conv.inner = (void*)(o & (~1));
46372 o_conv.is_owned = false;
46373 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46374 int64_t ret_conv = Description_hash(&o_conv);
46378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46379 LDKDescription a_conv;
46380 a_conv.inner = (void*)(a & (~1));
46381 a_conv.is_owned = false;
46382 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46383 LDKDescription b_conv;
46384 b_conv.inner = (void*)(b & (~1));
46385 b_conv.is_owned = false;
46386 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46387 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
46391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46392 LDKPayeePubKey this_obj_conv;
46393 this_obj_conv.inner = (void*)(this_obj & (~1));
46394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46396 PayeePubKey_free(this_obj_conv);
46399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46400 LDKPayeePubKey this_ptr_conv;
46401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46402 this_ptr_conv.is_owned = false;
46403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46404 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46405 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
46409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46410 LDKPayeePubKey this_ptr_conv;
46411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46412 this_ptr_conv.is_owned = false;
46413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46414 LDKPublicKey val_ref;
46415 CHECK((*env)->GetArrayLength(env, val) == 33);
46416 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46417 PayeePubKey_set_a(&this_ptr_conv, val_ref);
46420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
46421 LDKPublicKey a_arg_ref;
46422 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
46423 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
46424 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
46425 int64_t ret_ref = 0;
46426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46429 ret_ref = (uintptr_t)ret_var.inner;
46430 if (ret_var.is_owned) {
46436 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
46437 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
46438 int64_t ret_ref = 0;
46439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46442 ret_ref = (uintptr_t)ret_var.inner;
46443 if (ret_var.is_owned) {
46448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46449 LDKPayeePubKey arg_conv;
46450 arg_conv.inner = (void*)(arg & (~1));
46451 arg_conv.is_owned = false;
46452 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46453 int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
46457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46458 LDKPayeePubKey orig_conv;
46459 orig_conv.inner = (void*)(orig & (~1));
46460 orig_conv.is_owned = false;
46461 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46462 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
46463 int64_t ret_ref = 0;
46464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46467 ret_ref = (uintptr_t)ret_var.inner;
46468 if (ret_var.is_owned) {
46474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46475 LDKPayeePubKey o_conv;
46476 o_conv.inner = (void*)(o & (~1));
46477 o_conv.is_owned = false;
46478 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46479 int64_t ret_conv = PayeePubKey_hash(&o_conv);
46483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46484 LDKPayeePubKey a_conv;
46485 a_conv.inner = (void*)(a & (~1));
46486 a_conv.is_owned = false;
46487 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46488 LDKPayeePubKey b_conv;
46489 b_conv.inner = (void*)(b & (~1));
46490 b_conv.is_owned = false;
46491 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46492 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
46496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46497 LDKExpiryTime this_obj_conv;
46498 this_obj_conv.inner = (void*)(this_obj & (~1));
46499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46501 ExpiryTime_free(this_obj_conv);
46504 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
46505 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
46506 int64_t ret_ref = 0;
46507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46510 ret_ref = (uintptr_t)ret_var.inner;
46511 if (ret_var.is_owned) {
46516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46517 LDKExpiryTime arg_conv;
46518 arg_conv.inner = (void*)(arg & (~1));
46519 arg_conv.is_owned = false;
46520 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46521 int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
46525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46526 LDKExpiryTime orig_conv;
46527 orig_conv.inner = (void*)(orig & (~1));
46528 orig_conv.is_owned = false;
46529 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46530 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
46531 int64_t ret_ref = 0;
46532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46535 ret_ref = (uintptr_t)ret_var.inner;
46536 if (ret_var.is_owned) {
46542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
46543 LDKExpiryTime o_conv;
46544 o_conv.inner = (void*)(o & (~1));
46545 o_conv.is_owned = false;
46546 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46547 int64_t ret_conv = ExpiryTime_hash(&o_conv);
46551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46552 LDKExpiryTime a_conv;
46553 a_conv.inner = (void*)(a & (~1));
46554 a_conv.is_owned = false;
46555 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46556 LDKExpiryTime b_conv;
46557 b_conv.inner = (void*)(b & (~1));
46558 b_conv.is_owned = false;
46559 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46560 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
46564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46565 LDKMinFinalCltvExpiry this_obj_conv;
46566 this_obj_conv.inner = (void*)(this_obj & (~1));
46567 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46569 MinFinalCltvExpiry_free(this_obj_conv);
46572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46573 LDKMinFinalCltvExpiry this_ptr_conv;
46574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46575 this_ptr_conv.is_owned = false;
46576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46577 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
46581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46582 LDKMinFinalCltvExpiry this_ptr_conv;
46583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46584 this_ptr_conv.is_owned = false;
46585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46586 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
46589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
46590 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
46591 int64_t ret_ref = 0;
46592 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46593 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46595 ret_ref = (uintptr_t)ret_var.inner;
46596 if (ret_var.is_owned) {
46602 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
46603 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
46604 int64_t ret_ref = 0;
46605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46608 ret_ref = (uintptr_t)ret_var.inner;
46609 if (ret_var.is_owned) {
46614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46615 LDKMinFinalCltvExpiry arg_conv;
46616 arg_conv.inner = (void*)(arg & (~1));
46617 arg_conv.is_owned = false;
46618 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46619 int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
46623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46624 LDKMinFinalCltvExpiry orig_conv;
46625 orig_conv.inner = (void*)(orig & (~1));
46626 orig_conv.is_owned = false;
46627 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46628 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
46629 int64_t ret_ref = 0;
46630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46633 ret_ref = (uintptr_t)ret_var.inner;
46634 if (ret_var.is_owned) {
46640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
46641 LDKMinFinalCltvExpiry o_conv;
46642 o_conv.inner = (void*)(o & (~1));
46643 o_conv.is_owned = false;
46644 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46645 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
46649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46650 LDKMinFinalCltvExpiry a_conv;
46651 a_conv.inner = (void*)(a & (~1));
46652 a_conv.is_owned = false;
46653 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46654 LDKMinFinalCltvExpiry b_conv;
46655 b_conv.inner = (void*)(b & (~1));
46656 b_conv.is_owned = false;
46657 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46658 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
46662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46663 if ((this_ptr & 1) != 0) return;
46664 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46665 CHECK_ACCESS(this_ptr_ptr);
46666 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
46667 FREE((void*)this_ptr);
46668 Fallback_free(this_ptr_conv);
46671 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
46672 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46673 *ret_copy = Fallback_clone(arg);
46674 int64_t ret_ref = (uintptr_t)ret_copy;
46677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46678 LDKFallback* arg_conv = (LDKFallback*)arg;
46679 int64_t ret_conv = Fallback_clone_ptr(arg_conv);
46683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46684 LDKFallback* orig_conv = (LDKFallback*)orig;
46685 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46686 *ret_copy = Fallback_clone(orig_conv);
46687 int64_t ret_ref = (uintptr_t)ret_copy;
46691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
46693 LDKCVec_u8Z program_ref;
46694 program_ref.datalen = (*env)->GetArrayLength(env, program);
46695 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
46696 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
46697 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46698 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
46699 int64_t ret_ref = (uintptr_t)ret_copy;
46703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46704 LDKTwentyBytes a_ref;
46705 CHECK((*env)->GetArrayLength(env, a) == 20);
46706 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46707 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46708 *ret_copy = Fallback_pub_key_hash(a_ref);
46709 int64_t ret_ref = (uintptr_t)ret_copy;
46713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46714 LDKTwentyBytes a_ref;
46715 CHECK((*env)->GetArrayLength(env, a) == 20);
46716 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46717 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46718 *ret_copy = Fallback_script_hash(a_ref);
46719 int64_t ret_ref = (uintptr_t)ret_copy;
46723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
46724 LDKFallback* o_conv = (LDKFallback*)o;
46725 int64_t ret_conv = Fallback_hash(o_conv);
46729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46730 LDKFallback* a_conv = (LDKFallback*)a;
46731 LDKFallback* b_conv = (LDKFallback*)b;
46732 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
46736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46737 LDKInvoiceSignature this_obj_conv;
46738 this_obj_conv.inner = (void*)(this_obj & (~1));
46739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46741 InvoiceSignature_free(this_obj_conv);
46744 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46745 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46746 int64_t ret_ref = 0;
46747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46750 ret_ref = (uintptr_t)ret_var.inner;
46751 if (ret_var.is_owned) {
46756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46757 LDKInvoiceSignature arg_conv;
46758 arg_conv.inner = (void*)(arg & (~1));
46759 arg_conv.is_owned = false;
46760 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46761 int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46766 LDKInvoiceSignature orig_conv;
46767 orig_conv.inner = (void*)(orig & (~1));
46768 orig_conv.is_owned = false;
46769 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46770 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46771 int64_t ret_ref = 0;
46772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46775 ret_ref = (uintptr_t)ret_var.inner;
46776 if (ret_var.is_owned) {
46782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46783 LDKInvoiceSignature a_conv;
46784 a_conv.inner = (void*)(a & (~1));
46785 a_conv.is_owned = false;
46786 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46787 LDKInvoiceSignature b_conv;
46788 b_conv.inner = (void*)(b & (~1));
46789 b_conv.is_owned = false;
46790 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46791 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46796 LDKPrivateRoute this_obj_conv;
46797 this_obj_conv.inner = (void*)(this_obj & (~1));
46798 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46800 PrivateRoute_free(this_obj_conv);
46803 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46804 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46805 int64_t ret_ref = 0;
46806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46809 ret_ref = (uintptr_t)ret_var.inner;
46810 if (ret_var.is_owned) {
46815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46816 LDKPrivateRoute arg_conv;
46817 arg_conv.inner = (void*)(arg & (~1));
46818 arg_conv.is_owned = false;
46819 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46820 int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46825 LDKPrivateRoute orig_conv;
46826 orig_conv.inner = (void*)(orig & (~1));
46827 orig_conv.is_owned = false;
46828 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46829 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46830 int64_t ret_ref = 0;
46831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46834 ret_ref = (uintptr_t)ret_var.inner;
46835 if (ret_var.is_owned) {
46841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
46842 LDKPrivateRoute o_conv;
46843 o_conv.inner = (void*)(o & (~1));
46844 o_conv.is_owned = false;
46845 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46846 int64_t ret_conv = PrivateRoute_hash(&o_conv);
46850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46851 LDKPrivateRoute a_conv;
46852 a_conv.inner = (void*)(a & (~1));
46853 a_conv.is_owned = false;
46854 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46855 LDKPrivateRoute b_conv;
46856 b_conv.inner = (void*)(b & (~1));
46857 b_conv.is_owned = false;
46858 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46859 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
46864 LDKSignedRawInvoice this_arg_conv;
46865 this_arg_conv.inner = (void*)(this_arg & (~1));
46866 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
46867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46868 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46869 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46870 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46871 return ((int64_t)ret_conv);
46874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
46875 LDKSignedRawInvoice this_arg_conv;
46876 this_arg_conv.inner = (void*)(this_arg & (~1));
46877 this_arg_conv.is_owned = false;
46878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46879 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46880 int64_t ret_ref = 0;
46881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46884 ret_ref = (uintptr_t)ret_var.inner;
46885 if (ret_var.is_owned) {
46891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46892 LDKSignedRawInvoice this_arg_conv;
46893 this_arg_conv.inner = (void*)(this_arg & (~1));
46894 this_arg_conv.is_owned = false;
46895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46896 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
46901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46902 LDKSignedRawInvoice this_arg_conv;
46903 this_arg_conv.inner = (void*)(this_arg & (~1));
46904 this_arg_conv.is_owned = false;
46905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46906 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46907 int64_t ret_ref = 0;
46908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46911 ret_ref = (uintptr_t)ret_var.inner;
46912 if (ret_var.is_owned) {
46918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46919 LDKSignedRawInvoice this_arg_conv;
46920 this_arg_conv.inner = (void*)(this_arg & (~1));
46921 this_arg_conv.is_owned = false;
46922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46923 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46924 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46925 return (int64_t)ret_conv;
46928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46929 LDKSignedRawInvoice this_arg_conv;
46930 this_arg_conv.inner = (void*)(this_arg & (~1));
46931 this_arg_conv.is_owned = false;
46932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46933 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46938 LDKRawInvoice this_arg_conv;
46939 this_arg_conv.inner = (void*)(this_arg & (~1));
46940 this_arg_conv.is_owned = false;
46941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46942 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46943 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
46947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46948 LDKRawInvoice this_arg_conv;
46949 this_arg_conv.inner = (void*)(this_arg & (~1));
46950 this_arg_conv.is_owned = false;
46951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46952 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46953 int64_t ret_ref = 0;
46954 if ((uintptr_t)ret_var.inner > 4096) {
46955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46958 ret_ref = (uintptr_t)ret_var.inner;
46959 if (ret_var.is_owned) {
46966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
46967 LDKRawInvoice this_arg_conv;
46968 this_arg_conv.inner = (void*)(this_arg & (~1));
46969 this_arg_conv.is_owned = false;
46970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46971 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46972 int64_t ret_ref = 0;
46973 if ((uintptr_t)ret_var.inner > 4096) {
46974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46977 ret_ref = (uintptr_t)ret_var.inner;
46978 if (ret_var.is_owned) {
46985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46986 LDKRawInvoice this_arg_conv;
46987 this_arg_conv.inner = (void*)(this_arg & (~1));
46988 this_arg_conv.is_owned = false;
46989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46990 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46991 int64_t ret_ref = 0;
46992 if ((uintptr_t)ret_var.inner > 4096) {
46993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46996 ret_ref = (uintptr_t)ret_var.inner;
46997 if (ret_var.is_owned) {
47004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47005 LDKRawInvoice this_arg_conv;
47006 this_arg_conv.inner = (void*)(this_arg & (~1));
47007 this_arg_conv.is_owned = false;
47008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47009 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
47010 int64_t ret_ref = 0;
47011 if ((uintptr_t)ret_var.inner > 4096) {
47012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47015 ret_ref = (uintptr_t)ret_var.inner;
47016 if (ret_var.is_owned) {
47023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47024 LDKRawInvoice this_arg_conv;
47025 this_arg_conv.inner = (void*)(this_arg & (~1));
47026 this_arg_conv.is_owned = false;
47027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47028 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
47029 int64_t ret_ref = 0;
47030 if ((uintptr_t)ret_var.inner > 4096) {
47031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47034 ret_ref = (uintptr_t)ret_var.inner;
47035 if (ret_var.is_owned) {
47042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47043 LDKRawInvoice this_arg_conv;
47044 this_arg_conv.inner = (void*)(this_arg & (~1));
47045 this_arg_conv.is_owned = false;
47046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47047 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
47048 int64_t ret_ref = 0;
47049 if ((uintptr_t)ret_var.inner > 4096) {
47050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47053 ret_ref = (uintptr_t)ret_var.inner;
47054 if (ret_var.is_owned) {
47061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47062 LDKRawInvoice this_arg_conv;
47063 this_arg_conv.inner = (void*)(this_arg & (~1));
47064 this_arg_conv.is_owned = false;
47065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47066 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47067 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
47071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47072 LDKRawInvoice this_arg_conv;
47073 this_arg_conv.inner = (void*)(this_arg & (~1));
47074 this_arg_conv.is_owned = false;
47075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47076 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
47077 int64_t ret_ref = 0;
47078 if ((uintptr_t)ret_var.inner > 4096) {
47079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47082 ret_ref = (uintptr_t)ret_var.inner;
47083 if (ret_var.is_owned) {
47090 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47091 LDKRawInvoice this_arg_conv;
47092 this_arg_conv.inner = (void*)(this_arg & (~1));
47093 this_arg_conv.is_owned = false;
47094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47095 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
47096 int64_tArray ret_arr = NULL;
47097 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47098 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47099 for (size_t o = 0; o < ret_var.datalen; o++) {
47100 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47101 int64_t ret_conv_14_ref = 0;
47102 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47103 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47105 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
47106 if (ret_conv_14_var.is_owned) {
47107 ret_conv_14_ref |= 1;
47109 ret_arr_ptr[o] = ret_conv_14_ref;
47111 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47112 FREE(ret_var.data);
47116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
47117 LDKRawInvoice this_arg_conv;
47118 this_arg_conv.inner = (void*)(this_arg & (~1));
47119 this_arg_conv.is_owned = false;
47120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47121 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47122 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47123 int64_t ret_ref = (uintptr_t)ret_copy;
47127 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47128 LDKRawInvoice this_arg_conv;
47129 this_arg_conv.inner = (void*)(this_arg & (~1));
47130 this_arg_conv.is_owned = false;
47131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47132 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
47136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
47137 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47138 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
47139 return (int64_t)ret_conv;
47142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
47143 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47144 *ret_conv = PositiveTimestamp_from_system_time(time);
47145 return (int64_t)ret_conv;
47148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
47149 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47150 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
47151 return (int64_t)ret_conv;
47154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47155 LDKPositiveTimestamp this_arg_conv;
47156 this_arg_conv.inner = (void*)(this_arg & (~1));
47157 this_arg_conv.is_owned = false;
47158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47159 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
47163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47164 LDKPositiveTimestamp this_arg_conv;
47165 this_arg_conv.inner = (void*)(this_arg & (~1));
47166 this_arg_conv.is_owned = false;
47167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47168 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
47172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47173 LDKPositiveTimestamp this_arg_conv;
47174 this_arg_conv.inner = (void*)(this_arg & (~1));
47175 this_arg_conv.is_owned = false;
47176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47177 int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
47181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
47182 LDKInvoice this_arg_conv;
47183 this_arg_conv.inner = (void*)(this_arg & (~1));
47184 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47186 this_arg_conv = Invoice_clone(&this_arg_conv);
47187 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
47188 int64_t ret_ref = 0;
47189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47192 ret_ref = (uintptr_t)ret_var.inner;
47193 if (ret_var.is_owned) {
47199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47200 LDKInvoice this_arg_conv;
47201 this_arg_conv.inner = (void*)(this_arg & (~1));
47202 this_arg_conv.is_owned = false;
47203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47204 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
47205 *ret_conv = Invoice_check_signature(&this_arg_conv);
47206 return (int64_t)ret_conv;
47209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
47210 LDKSignedRawInvoice signed_invoice_conv;
47211 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
47212 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
47213 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
47214 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
47215 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
47216 *ret_conv = Invoice_from_signed(signed_invoice_conv);
47217 return (int64_t)ret_conv;
47220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47221 LDKInvoice this_arg_conv;
47222 this_arg_conv.inner = (void*)(this_arg & (~1));
47223 this_arg_conv.is_owned = false;
47224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47225 int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
47229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47230 LDKInvoice this_arg_conv;
47231 this_arg_conv.inner = (void*)(this_arg & (~1));
47232 this_arg_conv.is_owned = false;
47233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47234 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
47238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47239 LDKInvoice this_arg_conv;
47240 this_arg_conv.inner = (void*)(this_arg & (~1));
47241 this_arg_conv.is_owned = false;
47242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47243 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47244 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
47248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47249 LDKInvoice this_arg_conv;
47250 this_arg_conv.inner = (void*)(this_arg & (~1));
47251 this_arg_conv.is_owned = false;
47252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47253 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47254 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
47258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47259 LDKInvoice this_arg_conv;
47260 this_arg_conv.inner = (void*)(this_arg & (~1));
47261 this_arg_conv.is_owned = false;
47262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47263 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47264 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
47268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47269 LDKInvoice this_arg_conv;
47270 this_arg_conv.inner = (void*)(this_arg & (~1));
47271 this_arg_conv.is_owned = false;
47272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47273 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
47274 int64_t ret_ref = 0;
47275 if ((uintptr_t)ret_var.inner > 4096) {
47276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47279 ret_ref = (uintptr_t)ret_var.inner;
47280 if (ret_var.is_owned) {
47287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47288 LDKInvoice this_arg_conv;
47289 this_arg_conv.inner = (void*)(this_arg & (~1));
47290 this_arg_conv.is_owned = false;
47291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47292 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
47297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47298 LDKInvoice this_arg_conv;
47299 this_arg_conv.inner = (void*)(this_arg & (~1));
47300 this_arg_conv.is_owned = false;
47301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47302 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
47306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
47307 LDKInvoice this_arg_conv;
47308 this_arg_conv.inner = (void*)(this_arg & (~1));
47309 this_arg_conv.is_owned = false;
47310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47311 jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
47315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
47316 LDKInvoice this_arg_conv;
47317 this_arg_conv.inner = (void*)(this_arg & (~1));
47318 this_arg_conv.is_owned = false;
47319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47320 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
47324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47325 LDKInvoice this_arg_conv;
47326 this_arg_conv.inner = (void*)(this_arg & (~1));
47327 this_arg_conv.is_owned = false;
47328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47329 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
47333 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47334 LDKInvoice this_arg_conv;
47335 this_arg_conv.inner = (void*)(this_arg & (~1));
47336 this_arg_conv.is_owned = false;
47337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47338 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
47339 int64_tArray ret_arr = NULL;
47340 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47341 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47342 for (size_t o = 0; o < ret_var.datalen; o++) {
47343 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47344 int64_t ret_conv_14_ref = 0;
47345 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47346 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47348 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
47349 if (ret_conv_14_var.is_owned) {
47350 ret_conv_14_ref |= 1;
47352 ret_arr_ptr[o] = ret_conv_14_ref;
47354 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47355 FREE(ret_var.data);
47359 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
47360 LDKInvoice this_arg_conv;
47361 this_arg_conv.inner = (void*)(this_arg & (~1));
47362 this_arg_conv.is_owned = false;
47363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47364 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
47365 int64_tArray ret_arr = NULL;
47366 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47367 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47368 for (size_t l = 0; l < ret_var.datalen; l++) {
47369 LDKRouteHint ret_conv_11_var = ret_var.data[l];
47370 int64_t ret_conv_11_ref = 0;
47371 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47372 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
47374 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
47375 if (ret_conv_11_var.is_owned) {
47376 ret_conv_11_ref |= 1;
47378 ret_arr_ptr[l] = ret_conv_11_ref;
47380 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47381 FREE(ret_var.data);
47385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47386 LDKInvoice this_arg_conv;
47387 this_arg_conv.inner = (void*)(this_arg & (~1));
47388 this_arg_conv.is_owned = false;
47389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47390 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
47394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
47395 LDKInvoice this_arg_conv;
47396 this_arg_conv.inner = (void*)(this_arg & (~1));
47397 this_arg_conv.is_owned = false;
47398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47399 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47400 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
47401 int64_t ret_ref = (uintptr_t)ret_copy;
47405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
47406 LDKStr description_conv = java_to_owned_str(env, description);
47407 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
47408 *ret_conv = Description_new(description_conv);
47409 return (int64_t)ret_conv;
47412 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47413 LDKDescription this_arg_conv;
47414 this_arg_conv.inner = (void*)(this_arg & (~1));
47415 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47417 this_arg_conv = Description_clone(&this_arg_conv);
47418 LDKStr ret_str = Description_into_inner(this_arg_conv);
47419 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
47425 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
47426 int64_t ret_ref = 0;
47427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47430 ret_ref = (uintptr_t)ret_var.inner;
47431 if (ret_var.is_owned) {
47437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
47438 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
47439 int64_t ret_ref = 0;
47440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47443 ret_ref = (uintptr_t)ret_var.inner;
47444 if (ret_var.is_owned) {
47450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
47451 LDKExpiryTime this_arg_conv;
47452 this_arg_conv.inner = (void*)(this_arg & (~1));
47453 this_arg_conv.is_owned = false;
47454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47455 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
47459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
47460 LDKExpiryTime this_arg_conv;
47461 this_arg_conv.inner = (void*)(this_arg & (~1));
47462 this_arg_conv.is_owned = false;
47463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47464 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
47468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
47469 LDKRouteHint hops_conv;
47470 hops_conv.inner = (void*)(hops & (~1));
47471 hops_conv.is_owned = (hops & 1) || (hops == 0);
47472 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
47473 hops_conv = RouteHint_clone(&hops_conv);
47474 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
47475 *ret_conv = PrivateRoute_new(hops_conv);
47476 return (int64_t)ret_conv;
47479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47480 LDKPrivateRoute this_arg_conv;
47481 this_arg_conv.inner = (void*)(this_arg & (~1));
47482 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47484 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
47485 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
47486 int64_t ret_ref = 0;
47487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47490 ret_ref = (uintptr_t)ret_var.inner;
47491 if (ret_var.is_owned) {
47497 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47498 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
47499 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
47503 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
47504 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
47508 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
47509 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
47513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
47514 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
47518 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
47519 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
47523 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
47524 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
47528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47529 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
47530 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
47531 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
47535 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47536 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
47537 LDKStr ret_str = CreationError_to_str(o_conv);
47538 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47543 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47544 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
47545 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
47549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
47550 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
47554 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
47555 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
47559 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
47560 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
47564 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
47565 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
47569 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
47570 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
47574 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
47575 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
47579 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
47580 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
47584 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47585 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
47589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
47590 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
47594 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
47595 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
47599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47600 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
47601 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
47602 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
47606 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47607 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
47608 LDKStr ret_str = SemanticError_to_str(o_conv);
47609 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47615 if ((this_ptr & 1) != 0) return;
47616 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47617 CHECK_ACCESS(this_ptr_ptr);
47618 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
47619 FREE((void*)this_ptr);
47620 SignOrCreationError_free(this_ptr_conv);
47623 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
47624 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47625 *ret_copy = SignOrCreationError_clone(arg);
47626 int64_t ret_ref = (uintptr_t)ret_copy;
47629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47630 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
47631 int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
47635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47636 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
47637 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47638 *ret_copy = SignOrCreationError_clone(orig_conv);
47639 int64_t ret_ref = (uintptr_t)ret_copy;
47643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
47644 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47645 *ret_copy = SignOrCreationError_sign_error();
47646 int64_t ret_ref = (uintptr_t)ret_copy;
47650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
47651 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
47652 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47653 *ret_copy = SignOrCreationError_creation_error(a_conv);
47654 int64_t ret_ref = (uintptr_t)ret_copy;
47658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47659 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
47660 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
47661 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
47665 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47666 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
47667 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
47668 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47674 LDKInvoicePayer this_obj_conv;
47675 this_obj_conv.inner = (void*)(this_obj & (~1));
47676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47678 InvoicePayer_free(this_obj_conv);
47681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47682 if ((this_ptr & 1) != 0) return;
47683 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47684 CHECK_ACCESS(this_ptr_ptr);
47685 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
47686 FREE((void*)this_ptr);
47687 Payer_free(this_ptr_conv);
47690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47691 if ((this_ptr & 1) != 0) return;
47692 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47693 CHECK_ACCESS(this_ptr_ptr);
47694 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
47695 FREE((void*)this_ptr);
47696 Router_free(this_ptr_conv);
47699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47700 if ((this_ptr & 1) != 0) return;
47701 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47702 CHECK_ACCESS(this_ptr_ptr);
47703 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
47704 FREE((void*)this_ptr);
47705 Retry_free(this_ptr_conv);
47708 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
47709 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47710 *ret_copy = Retry_clone(arg);
47711 int64_t ret_ref = (uintptr_t)ret_copy;
47714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47715 LDKRetry* arg_conv = (LDKRetry*)arg;
47716 int64_t ret_conv = Retry_clone_ptr(arg_conv);
47720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47721 LDKRetry* orig_conv = (LDKRetry*)orig;
47722 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47723 *ret_copy = Retry_clone(orig_conv);
47724 int64_t ret_ref = (uintptr_t)ret_copy;
47728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
47729 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47730 *ret_copy = Retry_attempts(a);
47731 int64_t ret_ref = (uintptr_t)ret_copy;
47735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
47736 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47737 *ret_copy = Retry_timeout(a);
47738 int64_t ret_ref = (uintptr_t)ret_copy;
47742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47743 LDKRetry* a_conv = (LDKRetry*)a;
47744 LDKRetry* b_conv = (LDKRetry*)b;
47745 jboolean ret_conv = Retry_eq(a_conv, b_conv);
47749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
47750 LDKRetry* o_conv = (LDKRetry*)o;
47751 int64_t ret_conv = Retry_hash(o_conv);
47755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47756 if ((this_ptr & 1) != 0) return;
47757 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47758 CHECK_ACCESS(this_ptr_ptr);
47759 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
47760 FREE((void*)this_ptr);
47761 PaymentError_free(this_ptr_conv);
47764 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
47765 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47766 *ret_copy = PaymentError_clone(arg);
47767 int64_t ret_ref = (uintptr_t)ret_copy;
47770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47771 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
47772 int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
47776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47777 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
47778 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47779 *ret_copy = PaymentError_clone(orig_conv);
47780 int64_t ret_ref = (uintptr_t)ret_copy;
47784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
47785 LDKStr a_conv = java_to_owned_str(env, a);
47786 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47787 *ret_copy = PaymentError_invoice(a_conv);
47788 int64_t ret_ref = (uintptr_t)ret_copy;
47792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
47793 LDKLightningError a_conv;
47794 a_conv.inner = (void*)(a & (~1));
47795 a_conv.is_owned = (a & 1) || (a == 0);
47796 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47797 a_conv = LightningError_clone(&a_conv);
47798 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47799 *ret_copy = PaymentError_routing(a_conv);
47800 int64_t ret_ref = (uintptr_t)ret_copy;
47804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
47805 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
47806 CHECK_ACCESS(a_ptr);
47807 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
47808 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
47809 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47810 *ret_copy = PaymentError_sending(a_conv);
47811 int64_t ret_ref = (uintptr_t)ret_copy;
47815 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) {
47816 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
47817 CHECK_ACCESS(payer_ptr);
47818 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
47819 if (payer_conv.free == LDKPayer_JCalls_free) {
47820 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47821 LDKPayer_JCalls_cloned(&payer_conv);
47823 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
47824 CHECK_ACCESS(router_ptr);
47825 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47826 if (router_conv.free == LDKRouter_JCalls_free) {
47827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47828 LDKRouter_JCalls_cloned(&router_conv);
47830 LDKMultiThreadedLockableScore scorer_conv;
47831 scorer_conv.inner = (void*)(scorer & (~1));
47832 scorer_conv.is_owned = false;
47833 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47834 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
47835 CHECK_ACCESS(logger_ptr);
47836 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47837 if (logger_conv.free == LDKLogger_JCalls_free) {
47838 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47839 LDKLogger_JCalls_cloned(&logger_conv);
47841 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
47842 CHECK_ACCESS(event_handler_ptr);
47843 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47844 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47845 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47846 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47848 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
47849 CHECK_ACCESS(retry_ptr);
47850 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47851 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
47852 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
47853 int64_t ret_ref = 0;
47854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47857 ret_ref = (uintptr_t)ret_var.inner;
47858 if (ret_var.is_owned) {
47864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
47865 LDKInvoicePayer 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 LDKInvoice invoice_conv;
47870 invoice_conv.inner = (void*)(invoice & (~1));
47871 invoice_conv.is_owned = false;
47872 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47873 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47874 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47875 return (int64_t)ret_conv;
47878 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) {
47879 LDKInvoicePayer this_arg_conv;
47880 this_arg_conv.inner = (void*)(this_arg & (~1));
47881 this_arg_conv.is_owned = false;
47882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47883 LDKInvoice invoice_conv;
47884 invoice_conv.inner = (void*)(invoice & (~1));
47885 invoice_conv.is_owned = false;
47886 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47887 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47888 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47889 return (int64_t)ret_conv;
47892 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) {
47893 LDKInvoicePayer 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 LDKPublicKey pubkey_ref;
47898 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
47899 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
47900 LDKThirtyTwoBytes payment_preimage_ref;
47901 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
47902 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
47903 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47904 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47905 return (int64_t)ret_conv;
47908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
47909 LDKInvoicePayer this_arg_conv;
47910 this_arg_conv.inner = (void*)(this_arg & (~1));
47911 this_arg_conv.is_owned = false;
47912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47913 unsigned char payment_hash_arr[32];
47914 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47915 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
47916 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47917 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47921 LDKInvoicePayer this_arg_conv;
47922 this_arg_conv.inner = (void*)(this_arg & (~1));
47923 this_arg_conv.is_owned = false;
47924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47925 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47926 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47927 return (int64_t)ret_ret;
47930 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) {
47931 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
47932 CHECK_ACCESS(amt_msat_ptr);
47933 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47934 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
47935 LDKThirtyTwoBytes payment_hash_ref;
47936 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47937 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47938 LDKStr description_conv = java_to_owned_str(env, description);
47939 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47940 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47941 if (phantom_route_hints_constr.datalen > 0)
47942 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47944 phantom_route_hints_constr.data = NULL;
47945 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47946 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47947 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47948 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47949 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
47950 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
47951 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47952 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47953 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47955 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47956 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
47957 CHECK_ACCESS(keys_manager_ptr);
47958 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47959 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47960 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47961 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47963 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47964 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47965 *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);
47966 return (int64_t)ret_conv;
47969 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) {
47970 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
47971 CHECK_ACCESS(amt_msat_ptr);
47972 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47973 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
47974 LDKThirtyTwoBytes payment_hash_ref;
47975 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47976 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47977 LDKSha256 description_hash_conv;
47978 description_hash_conv.inner = (void*)(description_hash & (~1));
47979 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
47980 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47981 description_hash_conv = Sha256_clone(&description_hash_conv);
47982 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47983 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47984 if (phantom_route_hints_constr.datalen > 0)
47985 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47987 phantom_route_hints_constr.data = NULL;
47988 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47989 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47990 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47991 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47992 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
47993 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
47994 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47995 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47996 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47998 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47999 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48000 CHECK_ACCESS(keys_manager_ptr);
48001 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48002 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48004 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48006 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48007 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48008 *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);
48009 return (int64_t)ret_conv;
48012 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) {
48013 LDKChannelManager channelmanager_conv;
48014 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48015 channelmanager_conv.is_owned = false;
48016 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48017 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48018 CHECK_ACCESS(keys_manager_ptr);
48019 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48020 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48021 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48022 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48024 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48025 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48026 CHECK_ACCESS(amt_msat_ptr);
48027 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48028 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48029 LDKStr description_conv = java_to_owned_str(env, description);
48030 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48031 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
48032 return (int64_t)ret_conv;
48035 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) {
48036 LDKChannelManager channelmanager_conv;
48037 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48038 channelmanager_conv.is_owned = false;
48039 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48040 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48041 CHECK_ACCESS(keys_manager_ptr);
48042 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48043 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48044 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48045 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48047 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48048 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48049 CHECK_ACCESS(amt_msat_ptr);
48050 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48051 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48052 LDKSha256 description_hash_conv;
48053 description_hash_conv.inner = (void*)(description_hash & (~1));
48054 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
48055 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48056 description_hash_conv = Sha256_clone(&description_hash_conv);
48057 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48058 *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);
48059 return (int64_t)ret_conv;
48062 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) {
48063 LDKChannelManager channelmanager_conv;
48064 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48065 channelmanager_conv.is_owned = false;
48066 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48067 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48068 CHECK_ACCESS(keys_manager_ptr);
48069 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48070 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48071 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48072 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48074 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48075 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48076 CHECK_ACCESS(amt_msat_ptr);
48077 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48078 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48079 LDKSha256 description_hash_conv;
48080 description_hash_conv.inner = (void*)(description_hash & (~1));
48081 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
48082 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48083 description_hash_conv = Sha256_clone(&description_hash_conv);
48084 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48085 *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);
48086 return (int64_t)ret_conv;
48089 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) {
48090 LDKChannelManager channelmanager_conv;
48091 channelmanager_conv.inner = (void*)(channelmanager & (~1));
48092 channelmanager_conv.is_owned = false;
48093 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48094 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
48095 CHECK_ACCESS(keys_manager_ptr);
48096 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48097 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48099 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48101 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
48102 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
48103 CHECK_ACCESS(amt_msat_ptr);
48104 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48105 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
48106 LDKStr description_conv = java_to_owned_str(env, description);
48107 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48108 *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);
48109 return (int64_t)ret_conv;
48112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48113 LDKDefaultRouter this_obj_conv;
48114 this_obj_conv.inner = (void*)(this_obj & (~1));
48115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48117 DefaultRouter_free(this_obj_conv);
48120 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) {
48121 LDKNetworkGraph network_graph_conv;
48122 network_graph_conv.inner = (void*)(network_graph & (~1));
48123 network_graph_conv.is_owned = false;
48124 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48125 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
48126 CHECK_ACCESS(logger_ptr);
48127 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48128 if (logger_conv.free == LDKLogger_JCalls_free) {
48129 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48130 LDKLogger_JCalls_cloned(&logger_conv);
48132 LDKThirtyTwoBytes random_seed_bytes_ref;
48133 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
48134 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
48135 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
48136 int64_t ret_ref = 0;
48137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48140 ret_ref = (uintptr_t)ret_var.inner;
48141 if (ret_var.is_owned) {
48147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
48148 LDKDefaultRouter this_arg_conv;
48149 this_arg_conv.inner = (void*)(this_arg & (~1));
48150 this_arg_conv.is_owned = false;
48151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48152 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
48153 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
48154 return (int64_t)ret_ret;
48157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
48158 LDKChannelManager this_arg_conv;
48159 this_arg_conv.inner = (void*)(this_arg & (~1));
48160 this_arg_conv.is_owned = false;
48161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48162 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48163 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48164 return (int64_t)ret_ret;
48167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48168 LDKStr s_conv = java_to_owned_str(env, s);
48169 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48170 *ret_conv = SiPrefix_from_str(s_conv);
48171 return (int64_t)ret_conv;
48174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48175 LDKStr s_conv = java_to_owned_str(env, s);
48176 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48177 *ret_conv = Invoice_from_str(s_conv);
48178 return (int64_t)ret_conv;
48181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48182 LDKStr s_conv = java_to_owned_str(env, s);
48183 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48184 *ret_conv = SignedRawInvoice_from_str(s_conv);
48185 return (int64_t)ret_conv;
48188 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48189 LDKParseError* o_conv = (LDKParseError*)o;
48190 LDKStr ret_str = ParseError_to_str(o_conv);
48191 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48196 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48197 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
48198 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48199 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48204 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48206 o_conv.inner = (void*)(o & (~1));
48207 o_conv.is_owned = false;
48208 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48209 LDKStr ret_str = Invoice_to_str(&o_conv);
48210 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48215 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48216 LDKSignedRawInvoice o_conv;
48217 o_conv.inner = (void*)(o & (~1));
48218 o_conv.is_owned = false;
48219 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48220 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48221 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48226 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48227 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
48228 LDKStr ret_str = Currency_to_str(o_conv);
48229 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48234 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48235 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
48236 LDKStr ret_str = SiPrefix_to_str(o_conv);
48237 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48243 LDKRapidGossipSync this_obj_conv;
48244 this_obj_conv.inner = (void*)(this_obj & (~1));
48245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48247 RapidGossipSync_free(this_obj_conv);
48250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
48251 LDKNetworkGraph network_graph_conv;
48252 network_graph_conv.inner = (void*)(network_graph & (~1));
48253 network_graph_conv.is_owned = false;
48254 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48255 LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
48256 int64_t ret_ref = 0;
48257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48260 ret_ref = (uintptr_t)ret_var.inner;
48261 if (ret_var.is_owned) {
48267 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) {
48268 LDKRapidGossipSync this_arg_conv;
48269 this_arg_conv.inner = (void*)(this_arg & (~1));
48270 this_arg_conv.is_owned = false;
48271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48272 LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
48273 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48274 *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
48275 return (int64_t)ret_conv;
48278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
48279 LDKRapidGossipSync this_arg_conv;
48280 this_arg_conv.inner = (void*)(this_arg & (~1));
48281 this_arg_conv.is_owned = false;
48282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48283 jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
48287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48288 if ((this_ptr & 1) != 0) return;
48289 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48290 CHECK_ACCESS(this_ptr_ptr);
48291 LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
48292 FREE((void*)this_ptr);
48293 GraphSyncError_free(this_ptr_conv);
48296 static inline uintptr_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
48297 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48298 *ret_copy = GraphSyncError_clone(arg);
48299 int64_t ret_ref = (uintptr_t)ret_copy;
48302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48303 LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)arg;
48304 int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
48308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48309 LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)orig;
48310 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48311 *ret_copy = GraphSyncError_clone(orig_conv);
48312 int64_t ret_ref = (uintptr_t)ret_copy;
48316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
48317 LDKDecodeError a_conv;
48318 a_conv.inner = (void*)(a & (~1));
48319 a_conv.is_owned = (a & 1) || (a == 0);
48320 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48321 a_conv = DecodeError_clone(&a_conv);
48322 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48323 *ret_copy = GraphSyncError_decode_error(a_conv);
48324 int64_t ret_ref = (uintptr_t)ret_copy;
48328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
48329 LDKLightningError a_conv;
48330 a_conv.inner = (void*)(a & (~1));
48331 a_conv.is_owned = (a & 1) || (a == 0);
48332 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48333 a_conv = LightningError_clone(&a_conv);
48334 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48335 *ret_copy = GraphSyncError_lightning_error(a_conv);
48336 int64_t ret_ref = (uintptr_t)ret_copy;
48340 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) {
48341 LDKRapidGossipSync this_arg_conv;
48342 this_arg_conv.inner = (void*)(this_arg & (~1));
48343 this_arg_conv.is_owned = false;
48344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48345 LDKu8slice update_data_ref;
48346 update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
48347 update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
48348 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48349 *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
48350 (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
48351 return (int64_t)ret_conv;