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 LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1755 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1756 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1759 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1760 CHECK(owner->result_ok);
1761 return PaymentParameters_clone(&*owner->contents.result);
1763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1764 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1765 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1766 int64_t ret_ref = 0;
1767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1770 ret_ref = (uintptr_t)ret_var.inner;
1771 if (ret_var.is_owned) {
1777 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1778 CHECK(!owner->result_ok);
1779 return DecodeError_clone(&*owner->contents.err);
1781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1782 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1783 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1784 int64_t ret_ref = 0;
1785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1788 ret_ref = (uintptr_t)ret_var.inner;
1789 if (ret_var.is_owned) {
1795 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1796 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1797 for (size_t i = 0; i < ret.datalen; i++) {
1798 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1802 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1803 CHECK(owner->result_ok);
1804 return RouteHint_clone(&*owner->contents.result);
1806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1807 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1808 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1809 int64_t ret_ref = 0;
1810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1813 ret_ref = (uintptr_t)ret_var.inner;
1814 if (ret_var.is_owned) {
1820 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1821 CHECK(!owner->result_ok);
1822 return DecodeError_clone(&*owner->contents.err);
1824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1825 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1826 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1827 int64_t ret_ref = 0;
1828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1831 ret_ref = (uintptr_t)ret_var.inner;
1832 if (ret_var.is_owned) {
1838 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1839 CHECK(owner->result_ok);
1840 return RouteHintHop_clone(&*owner->contents.result);
1842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1843 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1844 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1845 int64_t ret_ref = 0;
1846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1849 ret_ref = (uintptr_t)ret_var.inner;
1850 if (ret_var.is_owned) {
1856 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1857 CHECK(!owner->result_ok);
1858 return DecodeError_clone(&*owner->contents.err);
1860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1861 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1862 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1863 int64_t ret_ref = 0;
1864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1867 ret_ref = (uintptr_t)ret_var.inner;
1868 if (ret_var.is_owned) {
1874 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1875 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1876 for (size_t i = 0; i < ret.datalen; i++) {
1877 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1881 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1882 CHECK(owner->result_ok);
1883 return Route_clone(&*owner->contents.result);
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1886 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1887 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1888 int64_t ret_ref = 0;
1889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1892 ret_ref = (uintptr_t)ret_var.inner;
1893 if (ret_var.is_owned) {
1899 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1900 CHECK(!owner->result_ok);
1901 return LightningError_clone(&*owner->contents.err);
1903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1904 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1905 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1906 int64_t ret_ref = 0;
1907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1910 ret_ref = (uintptr_t)ret_var.inner;
1911 if (ret_var.is_owned) {
1917 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1918 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1919 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1920 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1922 LDKPaymentPurpose_InvoicePayment_class =
1923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1924 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1925 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1926 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1927 LDKPaymentPurpose_SpontaneousPayment_class =
1928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1929 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1930 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1931 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1933 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1934 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1936 case LDKPaymentPurpose_InvoicePayment: {
1937 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1938 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1939 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1940 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1941 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1943 case LDKPaymentPurpose_SpontaneousPayment: {
1944 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1945 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1946 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1951 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1952 CHECK(owner->result_ok);
1953 return PaymentPurpose_clone(&*owner->contents.result);
1955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1956 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1957 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1958 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1959 int64_t ret_ref = (uintptr_t)ret_copy;
1963 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1964 CHECK(!owner->result_ok);
1965 return DecodeError_clone(&*owner->contents.err);
1967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1968 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1969 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1970 int64_t ret_ref = 0;
1971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1974 ret_ref = (uintptr_t)ret_var.inner;
1975 if (ret_var.is_owned) {
1981 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1982 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1983 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1984 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1985 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1986 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1987 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1988 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1989 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1990 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1991 static jclass LDKClosureReason_ProcessingError_class = NULL;
1992 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1993 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1994 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1995 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1996 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1998 LDKClosureReason_CounterpartyForceClosed_class =
1999 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2000 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2001 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2002 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2003 LDKClosureReason_HolderForceClosed_class =
2004 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2005 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2006 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2007 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2008 LDKClosureReason_CooperativeClosure_class =
2009 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2010 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2011 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2012 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2013 LDKClosureReason_CommitmentTxConfirmed_class =
2014 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2015 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2016 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2017 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2018 LDKClosureReason_FundingTimedOut_class =
2019 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2020 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2021 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2022 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2023 LDKClosureReason_ProcessingError_class =
2024 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2025 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2026 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2027 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2028 LDKClosureReason_DisconnectedPeer_class =
2029 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2030 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2031 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2032 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2033 LDKClosureReason_OutdatedChannelManager_class =
2034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2035 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2036 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2037 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2039 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2040 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2042 case LDKClosureReason_CounterpartyForceClosed: {
2043 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2044 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2045 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2047 case LDKClosureReason_HolderForceClosed: {
2048 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2050 case LDKClosureReason_CooperativeClosure: {
2051 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2053 case LDKClosureReason_CommitmentTxConfirmed: {
2054 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2056 case LDKClosureReason_FundingTimedOut: {
2057 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2059 case LDKClosureReason_ProcessingError: {
2060 LDKStr err_str = obj->processing_error.err;
2061 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2062 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2064 case LDKClosureReason_DisconnectedPeer: {
2065 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2067 case LDKClosureReason_OutdatedChannelManager: {
2068 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2073 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2074 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2075 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2076 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2078 LDKCOption_ClosureReasonZ_Some_class =
2079 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2080 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2081 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2082 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2083 LDKCOption_ClosureReasonZ_None_class =
2084 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2085 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2086 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2087 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2089 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2090 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2092 case LDKCOption_ClosureReasonZ_Some: {
2093 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2094 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2096 case LDKCOption_ClosureReasonZ_None: {
2097 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2102 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2103 CHECK(owner->result_ok);
2104 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2107 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2108 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2109 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2110 int64_t ret_ref = (uintptr_t)ret_copy;
2114 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2115 CHECK(!owner->result_ok);
2116 return DecodeError_clone(&*owner->contents.err);
2118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2119 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2120 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2121 int64_t ret_ref = 0;
2122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2125 ret_ref = (uintptr_t)ret_var.inner;
2126 if (ret_var.is_owned) {
2132 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
2133 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
2134 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
2135 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
2136 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
2137 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
2138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
2139 LDKHTLCDestination_NextHopChannel_class =
2140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
2141 CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
2142 LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
2143 CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
2144 LDKHTLCDestination_UnknownNextHop_class =
2145 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2146 CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2147 LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2148 CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2149 LDKHTLCDestination_FailedPayment_class =
2150 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2151 CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2152 LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2153 CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2155 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2156 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
2158 case LDKHTLCDestination_NextHopChannel: {
2159 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2160 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2161 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2162 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2163 return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2165 case LDKHTLCDestination_UnknownNextHop: {
2166 int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2167 return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2169 case LDKHTLCDestination_FailedPayment: {
2170 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2171 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2172 return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2177 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2178 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2179 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2180 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2182 LDKCOption_HTLCDestinationZ_Some_class =
2183 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2184 CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2185 LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2186 CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2187 LDKCOption_HTLCDestinationZ_None_class =
2188 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2189 CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2190 LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2191 CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2193 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2194 LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1);
2196 case LDKCOption_HTLCDestinationZ_Some: {
2197 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2198 return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2200 case LDKCOption_HTLCDestinationZ_None: {
2201 return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2206 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2207 CHECK(owner->result_ok);
2208 return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2211 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
2212 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2213 *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2214 int64_t ret_ref = (uintptr_t)ret_copy;
2218 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2219 CHECK(!owner->result_ok);
2220 return DecodeError_clone(&*owner->contents.err);
2222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2223 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
2224 LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2225 int64_t ret_ref = 0;
2226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2229 ret_ref = (uintptr_t)ret_var.inner;
2230 if (ret_var.is_owned) {
2236 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2237 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2238 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2239 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2240 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2241 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2243 LDKNetworkUpdate_ChannelUpdateMessage_class =
2244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2245 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2246 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2247 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2248 LDKNetworkUpdate_ChannelFailure_class =
2249 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2250 CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2251 LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2252 CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2253 LDKNetworkUpdate_NodeFailure_class =
2254 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2255 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2256 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2257 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2259 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2260 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2262 case LDKNetworkUpdate_ChannelUpdateMessage: {
2263 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2264 int64_t msg_ref = 0;
2265 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2266 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2267 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2268 msg_ref = (uintptr_t)msg_var.inner & ~1;
2269 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2271 case LDKNetworkUpdate_ChannelFailure: {
2272 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2273 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2274 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2276 case LDKNetworkUpdate_NodeFailure: {
2277 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2278 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2279 jboolean is_permanent_conv = obj->node_failure.is_permanent;
2280 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2285 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2286 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2287 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2288 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2290 LDKCOption_NetworkUpdateZ_Some_class =
2291 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2292 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2293 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2294 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2295 LDKCOption_NetworkUpdateZ_None_class =
2296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2297 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2298 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2299 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2301 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2302 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2304 case LDKCOption_NetworkUpdateZ_Some: {
2305 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2306 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2308 case LDKCOption_NetworkUpdateZ_None: {
2309 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2314 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2315 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2316 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2317 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2318 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2319 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2321 LDKSpendableOutputDescriptor_StaticOutput_class =
2322 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2323 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2324 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2325 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2326 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2327 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2328 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2329 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2330 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2331 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2332 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2333 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2334 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2335 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2337 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2338 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2340 case LDKSpendableOutputDescriptor_StaticOutput: {
2341 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2342 int64_t outpoint_ref = 0;
2343 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2344 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2345 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2346 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2347 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2348 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2350 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2351 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2352 int64_t delayed_payment_output_ref = 0;
2353 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2354 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2355 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2356 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2357 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2359 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2360 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2361 int64_t static_payment_output_ref = 0;
2362 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2363 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2364 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2365 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2366 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2371 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2372 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2373 for (size_t i = 0; i < ret.datalen; i++) {
2374 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2378 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2379 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2380 static jclass LDKEvent_PaymentReceived_class = NULL;
2381 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2382 static jclass LDKEvent_PaymentClaimed_class = NULL;
2383 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2384 static jclass LDKEvent_PaymentSent_class = NULL;
2385 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2386 static jclass LDKEvent_PaymentFailed_class = NULL;
2387 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2388 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2389 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2390 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2391 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2392 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2393 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2394 static jclass LDKEvent_ProbeFailed_class = NULL;
2395 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2396 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2397 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2398 static jclass LDKEvent_SpendableOutputs_class = NULL;
2399 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2400 static jclass LDKEvent_PaymentForwarded_class = NULL;
2401 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2402 static jclass LDKEvent_ChannelClosed_class = NULL;
2403 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2404 static jclass LDKEvent_DiscardFunding_class = NULL;
2405 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2406 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2407 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2408 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
2409 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
2410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2411 LDKEvent_FundingGenerationReady_class =
2412 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2413 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2414 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2415 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2416 LDKEvent_PaymentReceived_class =
2417 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2418 CHECK(LDKEvent_PaymentReceived_class != NULL);
2419 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2420 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2421 LDKEvent_PaymentClaimed_class =
2422 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2423 CHECK(LDKEvent_PaymentClaimed_class != NULL);
2424 LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2425 CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2426 LDKEvent_PaymentSent_class =
2427 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2428 CHECK(LDKEvent_PaymentSent_class != NULL);
2429 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2430 CHECK(LDKEvent_PaymentSent_meth != NULL);
2431 LDKEvent_PaymentFailed_class =
2432 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2433 CHECK(LDKEvent_PaymentFailed_class != NULL);
2434 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2435 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2436 LDKEvent_PaymentPathSuccessful_class =
2437 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2438 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2439 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2440 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2441 LDKEvent_PaymentPathFailed_class =
2442 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2443 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2444 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2445 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2446 LDKEvent_ProbeSuccessful_class =
2447 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
2448 CHECK(LDKEvent_ProbeSuccessful_class != NULL);
2449 LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
2450 CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
2451 LDKEvent_ProbeFailed_class =
2452 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
2453 CHECK(LDKEvent_ProbeFailed_class != NULL);
2454 LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
2455 CHECK(LDKEvent_ProbeFailed_meth != NULL);
2456 LDKEvent_PendingHTLCsForwardable_class =
2457 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2458 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2459 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2460 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2461 LDKEvent_SpendableOutputs_class =
2462 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2463 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2464 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2465 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2466 LDKEvent_PaymentForwarded_class =
2467 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2468 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2469 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2470 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2471 LDKEvent_ChannelClosed_class =
2472 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2473 CHECK(LDKEvent_ChannelClosed_class != NULL);
2474 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2475 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2476 LDKEvent_DiscardFunding_class =
2477 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2478 CHECK(LDKEvent_DiscardFunding_class != NULL);
2479 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2480 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2481 LDKEvent_OpenChannelRequest_class =
2482 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2483 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2484 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2485 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2486 LDKEvent_HTLCHandlingFailed_class =
2487 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
2488 CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
2489 LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
2490 CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
2492 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2493 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2495 case LDKEvent_FundingGenerationReady: {
2496 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2497 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2498 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2499 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2500 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2501 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2502 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2503 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2504 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2505 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);
2507 case LDKEvent_PaymentReceived: {
2508 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2509 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2510 int64_t amount_msat_conv = obj->payment_received.amount_msat;
2511 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2512 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2514 case LDKEvent_PaymentClaimed: {
2515 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2516 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2517 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2518 int64_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
2519 return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2521 case LDKEvent_PaymentSent: {
2522 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2523 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2524 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2525 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2526 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2527 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2528 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2529 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2531 case LDKEvent_PaymentFailed: {
2532 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2533 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2534 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2535 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2536 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2538 case LDKEvent_PaymentPathSuccessful: {
2539 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2540 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2541 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2542 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2543 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2544 int64_tArray path_arr = NULL;
2545 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2546 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2547 for (size_t k = 0; k < path_var.datalen; k++) {
2548 LDKRouteHop path_conv_10_var = path_var.data[k];
2549 int64_t path_conv_10_ref = 0;
2550 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2551 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2552 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2553 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2554 path_arr_ptr[k] = path_conv_10_ref;
2556 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2557 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2559 case LDKEvent_PaymentPathFailed: {
2560 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2561 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2562 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2563 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2564 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2565 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2566 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2567 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2568 int64_tArray path_arr = NULL;
2569 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2570 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2571 for (size_t k = 0; k < path_var.datalen; k++) {
2572 LDKRouteHop path_conv_10_var = path_var.data[k];
2573 int64_t path_conv_10_ref = 0;
2574 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2575 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2576 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2577 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2578 path_arr_ptr[k] = path_conv_10_ref;
2580 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2581 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2582 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2583 int64_t retry_ref = 0;
2584 if ((uintptr_t)retry_var.inner > 4096) {
2585 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2586 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2587 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2588 retry_ref = (uintptr_t)retry_var.inner & ~1;
2590 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);
2592 case LDKEvent_ProbeSuccessful: {
2593 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2594 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
2595 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2596 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
2597 LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2598 int64_tArray path_arr = NULL;
2599 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2600 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2601 for (size_t k = 0; k < path_var.datalen; k++) {
2602 LDKRouteHop path_conv_10_var = path_var.data[k];
2603 int64_t path_conv_10_ref = 0;
2604 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2605 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2606 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2607 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2608 path_arr_ptr[k] = path_conv_10_ref;
2610 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2611 return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2613 case LDKEvent_ProbeFailed: {
2614 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2615 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
2616 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2617 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
2618 LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2619 int64_tArray path_arr = NULL;
2620 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2621 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2622 for (size_t k = 0; k < path_var.datalen; k++) {
2623 LDKRouteHop path_conv_10_var = path_var.data[k];
2624 int64_t path_conv_10_ref = 0;
2625 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2626 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2627 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2628 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2629 path_arr_ptr[k] = path_conv_10_ref;
2631 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2632 int64_t short_channel_id_ref = ((uintptr_t)&obj->probe_failed.short_channel_id) | 1;
2633 return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
2635 case LDKEvent_PendingHTLCsForwardable: {
2636 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2637 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2639 case LDKEvent_SpendableOutputs: {
2640 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2641 int64_tArray outputs_arr = NULL;
2642 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2643 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2644 for (size_t b = 0; b < outputs_var.datalen; b++) {
2645 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2646 outputs_arr_ptr[b] = outputs_conv_27_ref;
2648 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2649 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2651 case LDKEvent_PaymentForwarded: {
2652 int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2653 (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2654 int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2655 (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2656 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2657 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2658 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);
2660 case LDKEvent_ChannelClosed: {
2661 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2662 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2663 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2664 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2665 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2667 case LDKEvent_DiscardFunding: {
2668 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2669 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2670 LDKTransaction transaction_var = obj->discard_funding.transaction;
2671 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2672 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2673 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2675 case LDKEvent_OpenChannelRequest: {
2676 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2677 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2678 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2679 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2680 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2681 int64_t push_msat_conv = obj->open_channel_request.push_msat;
2682 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2683 int64_t channel_type_ref = 0;
2684 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2685 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2686 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2687 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2688 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);
2690 case LDKEvent_HTLCHandlingFailed: {
2691 int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2692 (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
2693 int64_t failed_next_destination_ref = ((uintptr_t)&obj->htlc_handling_failed.failed_next_destination) | 1;
2694 return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
2699 static jclass LDKCOption_EventZ_Some_class = NULL;
2700 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2701 static jclass LDKCOption_EventZ_None_class = NULL;
2702 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2704 LDKCOption_EventZ_Some_class =
2705 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2706 CHECK(LDKCOption_EventZ_Some_class != NULL);
2707 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2708 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2709 LDKCOption_EventZ_None_class =
2710 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2711 CHECK(LDKCOption_EventZ_None_class != NULL);
2712 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2713 CHECK(LDKCOption_EventZ_None_meth != NULL);
2715 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2716 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2718 case LDKCOption_EventZ_Some: {
2719 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2720 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2722 case LDKCOption_EventZ_None: {
2723 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2728 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2729 CHECK(owner->result_ok);
2730 return COption_EventZ_clone(&*owner->contents.result);
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2733 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2734 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2735 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2736 int64_t ret_ref = (uintptr_t)ret_copy;
2740 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2741 CHECK(!owner->result_ok);
2742 return DecodeError_clone(&*owner->contents.err);
2744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2745 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2746 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2747 int64_t ret_ref = 0;
2748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2751 ret_ref = (uintptr_t)ret_var.inner;
2752 if (ret_var.is_owned) {
2758 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2759 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2760 static jclass LDKErrorAction_IgnoreError_class = NULL;
2761 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2762 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2763 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2764 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2765 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2766 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2767 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2768 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2769 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2771 LDKErrorAction_DisconnectPeer_class =
2772 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2773 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2774 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2775 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2776 LDKErrorAction_IgnoreError_class =
2777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2778 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2779 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2780 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2781 LDKErrorAction_IgnoreAndLog_class =
2782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2783 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2784 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2785 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2786 LDKErrorAction_IgnoreDuplicateGossip_class =
2787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2788 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2789 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2790 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2791 LDKErrorAction_SendErrorMessage_class =
2792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2793 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2794 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2795 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2796 LDKErrorAction_SendWarningMessage_class =
2797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2798 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2799 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2800 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2802 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2803 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2805 case LDKErrorAction_DisconnectPeer: {
2806 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2807 int64_t msg_ref = 0;
2808 if ((uintptr_t)msg_var.inner > 4096) {
2809 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2810 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2811 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2812 msg_ref = (uintptr_t)msg_var.inner & ~1;
2814 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2816 case LDKErrorAction_IgnoreError: {
2817 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2819 case LDKErrorAction_IgnoreAndLog: {
2820 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2821 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2823 case LDKErrorAction_IgnoreDuplicateGossip: {
2824 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2826 case LDKErrorAction_SendErrorMessage: {
2827 LDKErrorMessage msg_var = obj->send_error_message.msg;
2828 int64_t msg_ref = 0;
2829 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2830 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2831 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2832 msg_ref = (uintptr_t)msg_var.inner & ~1;
2833 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2835 case LDKErrorAction_SendWarningMessage: {
2836 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2837 int64_t msg_ref = 0;
2838 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2839 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2841 msg_ref = (uintptr_t)msg_var.inner & ~1;
2842 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2843 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2848 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2849 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2850 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2851 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2852 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2853 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2854 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2855 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2856 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2857 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2858 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2859 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2860 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2861 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2862 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2863 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2864 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2865 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2866 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2867 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2868 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2869 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2870 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2871 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2872 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2873 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2874 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2875 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2876 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2877 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2878 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2879 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2880 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2881 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2882 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2883 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2884 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2885 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2886 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2887 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2889 LDKMessageSendEvent_SendAcceptChannel_class =
2890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2891 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2892 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2893 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2894 LDKMessageSendEvent_SendOpenChannel_class =
2895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2896 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2897 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2898 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2899 LDKMessageSendEvent_SendFundingCreated_class =
2900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2901 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2902 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2903 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2904 LDKMessageSendEvent_SendFundingSigned_class =
2905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2906 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2907 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2908 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2909 LDKMessageSendEvent_SendChannelReady_class =
2910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2911 CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2912 LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2913 CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2914 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2916 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2917 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2918 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2919 LDKMessageSendEvent_UpdateHTLCs_class =
2920 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2921 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2922 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2923 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2924 LDKMessageSendEvent_SendRevokeAndACK_class =
2925 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2926 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2927 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2928 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2929 LDKMessageSendEvent_SendClosingSigned_class =
2930 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2931 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2932 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2933 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2934 LDKMessageSendEvent_SendShutdown_class =
2935 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2936 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2937 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2938 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2939 LDKMessageSendEvent_SendChannelReestablish_class =
2940 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2941 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2942 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2943 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2944 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2945 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2946 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2947 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2948 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2949 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2950 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2951 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2952 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2953 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2954 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2955 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2956 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2957 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2958 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2959 LDKMessageSendEvent_SendChannelUpdate_class =
2960 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2961 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2962 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2963 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2964 LDKMessageSendEvent_HandleError_class =
2965 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2966 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2967 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2968 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2969 LDKMessageSendEvent_SendChannelRangeQuery_class =
2970 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2971 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2972 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2973 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2974 LDKMessageSendEvent_SendShortIdsQuery_class =
2975 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2976 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2977 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2978 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2979 LDKMessageSendEvent_SendReplyChannelRange_class =
2980 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2981 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2982 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2983 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2984 LDKMessageSendEvent_SendGossipTimestampFilter_class =
2985 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2986 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2987 LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2988 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2990 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2991 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2993 case LDKMessageSendEvent_SendAcceptChannel: {
2994 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2995 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2996 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2997 int64_t msg_ref = 0;
2998 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2999 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3000 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3001 msg_ref = (uintptr_t)msg_var.inner & ~1;
3002 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
3004 case LDKMessageSendEvent_SendOpenChannel: {
3005 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3006 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
3007 LDKOpenChannel msg_var = obj->send_open_channel.msg;
3008 int64_t msg_ref = 0;
3009 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3010 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3011 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3012 msg_ref = (uintptr_t)msg_var.inner & ~1;
3013 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
3015 case LDKMessageSendEvent_SendFundingCreated: {
3016 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3017 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
3018 LDKFundingCreated msg_var = obj->send_funding_created.msg;
3019 int64_t msg_ref = 0;
3020 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3021 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3022 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3023 msg_ref = (uintptr_t)msg_var.inner & ~1;
3024 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
3026 case LDKMessageSendEvent_SendFundingSigned: {
3027 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3028 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
3029 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3030 int64_t msg_ref = 0;
3031 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3032 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3033 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3034 msg_ref = (uintptr_t)msg_var.inner & ~1;
3035 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
3037 case LDKMessageSendEvent_SendChannelReady: {
3038 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3039 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
3040 LDKChannelReady msg_var = obj->send_channel_ready.msg;
3041 int64_t msg_ref = 0;
3042 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3043 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3044 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3045 msg_ref = (uintptr_t)msg_var.inner & ~1;
3046 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
3048 case LDKMessageSendEvent_SendAnnouncementSignatures: {
3049 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3050 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
3051 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3052 int64_t msg_ref = 0;
3053 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3054 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3056 msg_ref = (uintptr_t)msg_var.inner & ~1;
3057 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
3059 case LDKMessageSendEvent_UpdateHTLCs: {
3060 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3061 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
3062 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3063 int64_t updates_ref = 0;
3064 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3065 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3066 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3067 updates_ref = (uintptr_t)updates_var.inner & ~1;
3068 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
3070 case LDKMessageSendEvent_SendRevokeAndACK: {
3071 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3072 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
3073 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3074 int64_t msg_ref = 0;
3075 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3076 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3077 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3078 msg_ref = (uintptr_t)msg_var.inner & ~1;
3079 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
3081 case LDKMessageSendEvent_SendClosingSigned: {
3082 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3083 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
3084 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3085 int64_t msg_ref = 0;
3086 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3087 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3088 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3089 msg_ref = (uintptr_t)msg_var.inner & ~1;
3090 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
3092 case LDKMessageSendEvent_SendShutdown: {
3093 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3094 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
3095 LDKShutdown msg_var = obj->send_shutdown.msg;
3096 int64_t msg_ref = 0;
3097 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3098 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3099 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3100 msg_ref = (uintptr_t)msg_var.inner & ~1;
3101 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
3103 case LDKMessageSendEvent_SendChannelReestablish: {
3104 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3105 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
3106 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3107 int64_t msg_ref = 0;
3108 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3109 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3110 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3111 msg_ref = (uintptr_t)msg_var.inner & ~1;
3112 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
3114 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
3115 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3116 int64_t msg_ref = 0;
3117 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3118 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3119 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3120 msg_ref = (uintptr_t)msg_var.inner & ~1;
3121 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3122 int64_t update_msg_ref = 0;
3123 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3124 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3125 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3126 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
3127 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
3129 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
3130 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3131 int64_t msg_ref = 0;
3132 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3133 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3134 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3135 msg_ref = (uintptr_t)msg_var.inner & ~1;
3136 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
3138 case LDKMessageSendEvent_BroadcastChannelUpdate: {
3139 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3140 int64_t msg_ref = 0;
3141 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3142 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3143 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3144 msg_ref = (uintptr_t)msg_var.inner & ~1;
3145 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
3147 case LDKMessageSendEvent_SendChannelUpdate: {
3148 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3149 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
3150 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3151 int64_t msg_ref = 0;
3152 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3155 msg_ref = (uintptr_t)msg_var.inner & ~1;
3156 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
3158 case LDKMessageSendEvent_HandleError: {
3159 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3160 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
3161 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
3162 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
3164 case LDKMessageSendEvent_SendChannelRangeQuery: {
3165 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3166 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3167 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3168 int64_t msg_ref = 0;
3169 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3170 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3171 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3172 msg_ref = (uintptr_t)msg_var.inner & ~1;
3173 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3175 case LDKMessageSendEvent_SendShortIdsQuery: {
3176 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3177 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3178 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3179 int64_t msg_ref = 0;
3180 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3181 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3182 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3183 msg_ref = (uintptr_t)msg_var.inner & ~1;
3184 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3186 case LDKMessageSendEvent_SendReplyChannelRange: {
3187 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3188 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3189 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3190 int64_t msg_ref = 0;
3191 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3192 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3194 msg_ref = (uintptr_t)msg_var.inner & ~1;
3195 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3197 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3198 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3199 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3200 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3201 int64_t msg_ref = 0;
3202 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3203 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3204 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3205 msg_ref = (uintptr_t)msg_var.inner & ~1;
3206 return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3211 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3212 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3213 for (size_t i = 0; i < ret.datalen; i++) {
3214 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3218 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3219 CHECK(owner->result_ok);
3220 return TxOut_clone(&*owner->contents.result);
3222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3223 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3224 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3225 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3226 return (int64_t)ret_ref;
3229 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3230 CHECK(!owner->result_ok);
3231 return AccessError_clone(&*owner->contents.err);
3233 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3234 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3235 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3239 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3243 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3244 int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3248 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3252 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3253 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3254 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3255 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3259 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3260 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3261 for (size_t i = 0; i < ret.datalen; i++) {
3262 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3266 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3267 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3268 for (size_t i = 0; i < ret.datalen; i++) {
3269 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3273 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3274 CHECK(owner->result_ok);
3275 return *owner->contents.result;
3277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3278 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3279 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3282 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3283 CHECK(!owner->result_ok);
3284 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3286 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3287 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3288 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3292 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3293 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3294 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3295 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3296 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3297 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3298 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3299 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3301 LDKMonitorEvent_HTLCEvent_class =
3302 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3303 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3304 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3305 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3306 LDKMonitorEvent_CommitmentTxConfirmed_class =
3307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3308 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3309 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3310 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3311 LDKMonitorEvent_UpdateCompleted_class =
3312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3313 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3314 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3315 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3316 LDKMonitorEvent_UpdateFailed_class =
3317 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3318 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3319 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3320 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3322 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3323 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
3325 case LDKMonitorEvent_HTLCEvent: {
3326 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3327 int64_t htlc_event_ref = 0;
3328 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3331 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
3332 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3334 case LDKMonitorEvent_CommitmentTxConfirmed: {
3335 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3336 int64_t commitment_tx_confirmed_ref = 0;
3337 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3338 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3339 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3340 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
3341 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3343 case LDKMonitorEvent_UpdateCompleted: {
3344 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3345 int64_t funding_txo_ref = 0;
3346 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3347 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3348 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3349 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
3350 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3351 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3353 case LDKMonitorEvent_UpdateFailed: {
3354 LDKOutPoint update_failed_var = obj->update_failed;
3355 int64_t update_failed_ref = 0;
3356 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3357 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3358 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3359 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
3360 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3365 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3366 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3367 for (size_t i = 0; i < ret.datalen; i++) {
3368 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3372 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3373 return OutPoint_clone(&owner->a);
3375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3376 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3377 LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3378 int64_t ret_ref = 0;
3379 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3380 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3382 ret_ref = (uintptr_t)ret_var.inner;
3383 if (ret_var.is_owned) {
3389 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3390 return CVec_MonitorEventZ_clone(&owner->b);
3392 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3393 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3394 LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3395 int64_tArray ret_arr = NULL;
3396 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3397 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3398 for (size_t o = 0; o < ret_var.datalen; o++) {
3399 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3400 *ret_conv_14_copy = ret_var.data[o];
3401 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
3402 ret_arr_ptr[o] = ret_conv_14_ref;
3404 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3409 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3413 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3414 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3415 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3419 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3420 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3421 for (size_t i = 0; i < ret.datalen; i++) {
3422 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3426 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3427 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3428 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3429 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3431 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3432 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3433 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3434 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3435 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3436 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3437 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3438 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3439 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3440 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3442 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3443 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3445 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3446 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3447 *some_conv = obj->some;
3448 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3449 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
3451 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3452 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3457 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3458 CHECK(owner->result_ok);
3459 return FixedPenaltyScorer_clone(&*owner->contents.result);
3461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3462 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3463 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3464 int64_t ret_ref = 0;
3465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3468 ret_ref = (uintptr_t)ret_var.inner;
3469 if (ret_var.is_owned) {
3475 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3476 CHECK(!owner->result_ok);
3477 return DecodeError_clone(&*owner->contents.err);
3479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3480 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3481 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3482 int64_t ret_ref = 0;
3483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3486 ret_ref = (uintptr_t)ret_var.inner;
3487 if (ret_var.is_owned) {
3493 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3497 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3498 int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3502 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3506 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3507 int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3511 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3512 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3513 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3514 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3516 LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3517 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3518 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3519 LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3520 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3521 LDKCOption_C2Tuple_u64u64ZZ_None_class =
3522 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3523 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3524 LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3525 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3527 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3528 LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)(ptr & ~1);
3530 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3531 LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3532 *some_conv = obj->some;
3533 *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3534 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, ((int64_t)some_conv));
3536 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3537 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3542 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3543 LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3544 for (size_t i = 0; i < ret.datalen; i++) {
3545 ret.data[i] = NodeId_clone(&orig->data[i]);
3549 typedef struct LDKLogger_JCalls {
3550 atomic_size_t refcnt;
3555 static void LDKLogger_JCalls_free(void* this_arg) {
3556 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3557 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3559 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3560 if (get_jenv_res == JNI_EDETACHED) {
3561 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3563 DO_ASSERT(get_jenv_res == JNI_OK);
3565 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3566 if (get_jenv_res == JNI_EDETACHED) {
3567 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3572 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3573 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3576 if (get_jenv_res == JNI_EDETACHED) {
3577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3579 DO_ASSERT(get_jenv_res == JNI_OK);
3581 LDKRecord record_var = *record;
3582 int64_t record_ref = 0;
3583 record_var = Record_clone(&record_var);
3584 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3585 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3586 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3587 record_ref = (uintptr_t)record_var.inner;
3588 if (record_var.is_owned) {
3591 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3593 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3594 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3595 (*env)->ExceptionDescribe(env);
3596 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3598 if (get_jenv_res == JNI_EDETACHED) {
3599 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3602 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3603 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3604 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3606 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3607 jclass c = (*env)->GetObjectClass(env, o);
3609 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3610 atomic_init(&calls->refcnt, 1);
3611 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3612 calls->o = (*env)->NewWeakGlobalRef(env, o);
3613 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3614 CHECK(calls->log_meth != NULL);
3617 .this_arg = (void*) calls,
3618 .log = log_LDKLogger_jcall,
3619 .free = LDKLogger_JCalls_free,
3623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3624 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3625 *res_ptr = LDKLogger_init(env, clz, o);
3626 return (uint64_t)res_ptr;
3628 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3629 CHECK(owner->result_ok);
3630 return &*owner->contents.result;
3632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3633 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3634 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3635 int64_t ret_ref = 0;
3636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3639 ret_ref = (uintptr_t)ret_var.inner & ~1;
3643 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3644 CHECK(!owner->result_ok);
3645 return DecodeError_clone(&*owner->contents.err);
3647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3648 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3649 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3650 int64_t ret_ref = 0;
3651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3654 ret_ref = (uintptr_t)ret_var.inner;
3655 if (ret_var.is_owned) {
3661 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3662 CHECK(owner->result_ok);
3663 return InitFeatures_clone(&*owner->contents.result);
3665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3666 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3667 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3668 int64_t ret_ref = 0;
3669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3672 ret_ref = (uintptr_t)ret_var.inner;
3673 if (ret_var.is_owned) {
3679 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3680 CHECK(!owner->result_ok);
3681 return DecodeError_clone(&*owner->contents.err);
3683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3684 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3685 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3686 int64_t ret_ref = 0;
3687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3690 ret_ref = (uintptr_t)ret_var.inner;
3691 if (ret_var.is_owned) {
3697 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3698 CHECK(owner->result_ok);
3699 return ChannelFeatures_clone(&*owner->contents.result);
3701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3702 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3703 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3704 int64_t ret_ref = 0;
3705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3708 ret_ref = (uintptr_t)ret_var.inner;
3709 if (ret_var.is_owned) {
3715 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3716 CHECK(!owner->result_ok);
3717 return DecodeError_clone(&*owner->contents.err);
3719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3720 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3721 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3722 int64_t ret_ref = 0;
3723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3726 ret_ref = (uintptr_t)ret_var.inner;
3727 if (ret_var.is_owned) {
3733 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3734 CHECK(owner->result_ok);
3735 return NodeFeatures_clone(&*owner->contents.result);
3737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3738 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3739 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3740 int64_t ret_ref = 0;
3741 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3742 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3744 ret_ref = (uintptr_t)ret_var.inner;
3745 if (ret_var.is_owned) {
3751 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3752 CHECK(!owner->result_ok);
3753 return DecodeError_clone(&*owner->contents.err);
3755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3756 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3757 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3758 int64_t ret_ref = 0;
3759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3762 ret_ref = (uintptr_t)ret_var.inner;
3763 if (ret_var.is_owned) {
3769 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3770 CHECK(owner->result_ok);
3771 return InvoiceFeatures_clone(&*owner->contents.result);
3773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3774 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3775 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3776 int64_t ret_ref = 0;
3777 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3778 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3780 ret_ref = (uintptr_t)ret_var.inner;
3781 if (ret_var.is_owned) {
3787 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3788 CHECK(!owner->result_ok);
3789 return DecodeError_clone(&*owner->contents.err);
3791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3792 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3793 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3794 int64_t ret_ref = 0;
3795 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3796 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3798 ret_ref = (uintptr_t)ret_var.inner;
3799 if (ret_var.is_owned) {
3805 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3806 CHECK(owner->result_ok);
3807 return ChannelTypeFeatures_clone(&*owner->contents.result);
3809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3810 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3811 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3812 int64_t ret_ref = 0;
3813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3816 ret_ref = (uintptr_t)ret_var.inner;
3817 if (ret_var.is_owned) {
3823 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3824 CHECK(!owner->result_ok);
3825 return DecodeError_clone(&*owner->contents.err);
3827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3828 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3829 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3830 int64_t ret_ref = 0;
3831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3834 ret_ref = (uintptr_t)ret_var.inner;
3835 if (ret_var.is_owned) {
3841 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3842 CHECK(owner->result_ok);
3843 return NodeId_clone(&*owner->contents.result);
3845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3846 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3847 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3848 int64_t ret_ref = 0;
3849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3852 ret_ref = (uintptr_t)ret_var.inner;
3853 if (ret_var.is_owned) {
3859 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3860 CHECK(!owner->result_ok);
3861 return DecodeError_clone(&*owner->contents.err);
3863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3864 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3865 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3866 int64_t ret_ref = 0;
3867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3870 ret_ref = (uintptr_t)ret_var.inner;
3871 if (ret_var.is_owned) {
3877 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3878 CHECK(owner->result_ok);
3879 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3882 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3883 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3884 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3885 int64_t ret_ref = (uintptr_t)ret_copy;
3889 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3890 CHECK(!owner->result_ok);
3891 return DecodeError_clone(&*owner->contents.err);
3893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3894 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3895 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_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 typedef struct LDKAccess_JCalls {
3908 atomic_size_t refcnt;
3911 jmethodID get_utxo_meth;
3913 static void LDKAccess_JCalls_free(void* this_arg) {
3914 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3915 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3917 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3918 if (get_jenv_res == JNI_EDETACHED) {
3919 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3921 DO_ASSERT(get_jenv_res == JNI_OK);
3923 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3924 if (get_jenv_res == JNI_EDETACHED) {
3925 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3930 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3931 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3933 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3934 if (get_jenv_res == JNI_EDETACHED) {
3935 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3937 DO_ASSERT(get_jenv_res == JNI_OK);
3939 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3940 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3941 int64_t short_channel_id_conv = short_channel_id;
3942 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3944 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3945 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3946 (*env)->ExceptionDescribe(env);
3947 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3949 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3950 CHECK_ACCESS(ret_ptr);
3951 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3953 if (get_jenv_res == JNI_EDETACHED) {
3954 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3958 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3959 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3960 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3962 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3963 jclass c = (*env)->GetObjectClass(env, o);
3965 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3966 atomic_init(&calls->refcnt, 1);
3967 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3968 calls->o = (*env)->NewWeakGlobalRef(env, o);
3969 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3970 CHECK(calls->get_utxo_meth != NULL);
3973 .this_arg = (void*) calls,
3974 .get_utxo = get_utxo_LDKAccess_jcall,
3975 .free = LDKAccess_JCalls_free,
3979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3980 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3981 *res_ptr = LDKAccess_init(env, clz, o);
3982 return (uint64_t)res_ptr;
3984 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) {
3985 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3986 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3987 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3988 unsigned char genesis_hash_arr[32];
3989 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3990 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3991 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3992 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3993 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3994 return (int64_t)ret_conv;
3997 static jclass LDKCOption_AccessZ_Some_class = NULL;
3998 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3999 static jclass LDKCOption_AccessZ_None_class = NULL;
4000 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
4001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
4002 LDKCOption_AccessZ_Some_class =
4003 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
4004 CHECK(LDKCOption_AccessZ_Some_class != NULL);
4005 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
4006 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
4007 LDKCOption_AccessZ_None_class =
4008 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
4009 CHECK(LDKCOption_AccessZ_None_class != NULL);
4010 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
4011 CHECK(LDKCOption_AccessZ_None_meth != NULL);
4013 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4014 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4016 case LDKCOption_AccessZ_Some: {
4017 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4018 *some_ret = obj->some;
4019 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4020 if ((*some_ret).free == LDKAccess_JCalls_free) {
4021 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4022 LDKAccess_JCalls_cloned(&(*some_ret));
4024 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
4026 case LDKCOption_AccessZ_None: {
4027 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
4032 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4033 CHECK(owner->result_ok);
4034 return *owner->contents.result;
4036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4037 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
4038 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4042 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4043 CHECK(!owner->result_ok);
4044 return LightningError_clone(&*owner->contents.err);
4046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4047 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
4048 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4049 int64_t ret_ref = 0;
4050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4053 ret_ref = (uintptr_t)ret_var.inner;
4054 if (ret_var.is_owned) {
4060 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4061 return ChannelAnnouncement_clone(&owner->a);
4063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4064 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4065 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4066 int64_t ret_ref = 0;
4067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4070 ret_ref = (uintptr_t)ret_var.inner;
4071 if (ret_var.is_owned) {
4077 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4078 return ChannelUpdate_clone(&owner->b);
4080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4081 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4082 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4083 int64_t ret_ref = 0;
4084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4087 ret_ref = (uintptr_t)ret_var.inner;
4088 if (ret_var.is_owned) {
4094 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4095 return ChannelUpdate_clone(&owner->c);
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4098 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4099 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4100 int64_t ret_ref = 0;
4101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4104 ret_ref = (uintptr_t)ret_var.inner;
4105 if (ret_var.is_owned) {
4111 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4112 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4113 for (size_t i = 0; i < ret.datalen; i++) {
4114 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4118 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4119 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4120 for (size_t i = 0; i < ret.datalen; i++) {
4121 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4125 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4126 CHECK(owner->result_ok);
4127 return *owner->contents.result;
4129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4130 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
4131 CResult_NoneLightningErrorZ_get_ok(owner_conv);
4134 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4135 CHECK(!owner->result_ok);
4136 return LightningError_clone(&*owner->contents.err);
4138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4139 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
4140 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4141 int64_t ret_ref = 0;
4142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4145 ret_ref = (uintptr_t)ret_var.inner;
4146 if (ret_var.is_owned) {
4152 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4153 CHECK(owner->result_ok);
4154 return ChannelUpdateInfo_clone(&*owner->contents.result);
4156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4157 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
4158 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4159 int64_t ret_ref = 0;
4160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4163 ret_ref = (uintptr_t)ret_var.inner;
4164 if (ret_var.is_owned) {
4170 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4171 CHECK(!owner->result_ok);
4172 return DecodeError_clone(&*owner->contents.err);
4174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4175 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
4176 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4177 int64_t ret_ref = 0;
4178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4181 ret_ref = (uintptr_t)ret_var.inner;
4182 if (ret_var.is_owned) {
4188 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4189 CHECK(owner->result_ok);
4190 return ChannelInfo_clone(&*owner->contents.result);
4192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4193 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4194 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4195 int64_t ret_ref = 0;
4196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4199 ret_ref = (uintptr_t)ret_var.inner;
4200 if (ret_var.is_owned) {
4206 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4207 CHECK(!owner->result_ok);
4208 return DecodeError_clone(&*owner->contents.err);
4210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4211 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4212 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4213 int64_t ret_ref = 0;
4214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4217 ret_ref = (uintptr_t)ret_var.inner;
4218 if (ret_var.is_owned) {
4224 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4225 CHECK(owner->result_ok);
4226 return RoutingFees_clone(&*owner->contents.result);
4228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4229 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4230 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4231 int64_t ret_ref = 0;
4232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4235 ret_ref = (uintptr_t)ret_var.inner;
4236 if (ret_var.is_owned) {
4242 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4243 CHECK(!owner->result_ok);
4244 return DecodeError_clone(&*owner->contents.err);
4246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4247 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4248 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4249 int64_t ret_ref = 0;
4250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4253 ret_ref = (uintptr_t)ret_var.inner;
4254 if (ret_var.is_owned) {
4260 static jclass LDKNetAddress_IPv4_class = NULL;
4261 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4262 static jclass LDKNetAddress_IPv6_class = NULL;
4263 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4264 static jclass LDKNetAddress_OnionV2_class = NULL;
4265 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4266 static jclass LDKNetAddress_OnionV3_class = NULL;
4267 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4268 static jclass LDKNetAddress_Hostname_class = NULL;
4269 static jmethodID LDKNetAddress_Hostname_meth = NULL;
4270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4271 LDKNetAddress_IPv4_class =
4272 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4273 CHECK(LDKNetAddress_IPv4_class != NULL);
4274 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4275 CHECK(LDKNetAddress_IPv4_meth != NULL);
4276 LDKNetAddress_IPv6_class =
4277 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4278 CHECK(LDKNetAddress_IPv6_class != NULL);
4279 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4280 CHECK(LDKNetAddress_IPv6_meth != NULL);
4281 LDKNetAddress_OnionV2_class =
4282 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4283 CHECK(LDKNetAddress_OnionV2_class != NULL);
4284 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4285 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4286 LDKNetAddress_OnionV3_class =
4287 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4288 CHECK(LDKNetAddress_OnionV3_class != NULL);
4289 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4290 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4291 LDKNetAddress_Hostname_class =
4292 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
4293 CHECK(LDKNetAddress_Hostname_class != NULL);
4294 LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
4295 CHECK(LDKNetAddress_Hostname_meth != NULL);
4297 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4298 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4300 case LDKNetAddress_IPv4: {
4301 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4302 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4303 int16_t port_conv = obj->i_pv4.port;
4304 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4306 case LDKNetAddress_IPv6: {
4307 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4308 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4309 int16_t port_conv = obj->i_pv6.port;
4310 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4312 case LDKNetAddress_OnionV2: {
4313 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4314 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4315 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4317 case LDKNetAddress_OnionV3: {
4318 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4319 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4320 int16_t checksum_conv = obj->onion_v3.checksum;
4321 int8_t version_conv = obj->onion_v3.version;
4322 int16_t port_conv = obj->onion_v3.port;
4323 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4325 case LDKNetAddress_Hostname: {
4326 LDKHostname hostname_var = obj->hostname.hostname;
4327 int64_t hostname_ref = 0;
4328 CHECK((((uintptr_t)hostname_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4329 CHECK((((uintptr_t)&hostname_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4330 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4331 hostname_ref = (uintptr_t)hostname_var.inner & ~1;
4332 int16_t port_conv = obj->hostname.port;
4333 return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
4338 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4339 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4340 for (size_t i = 0; i < ret.datalen; i++) {
4341 ret.data[i] = NetAddress_clone(&orig->data[i]);
4345 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4346 CHECK(owner->result_ok);
4347 return NodeAnnouncementInfo_clone(&*owner->contents.result);
4349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4350 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4351 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4352 int64_t ret_ref = 0;
4353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4356 ret_ref = (uintptr_t)ret_var.inner;
4357 if (ret_var.is_owned) {
4363 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4364 CHECK(!owner->result_ok);
4365 return DecodeError_clone(&*owner->contents.err);
4367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4368 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4369 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4370 int64_t ret_ref = 0;
4371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4374 ret_ref = (uintptr_t)ret_var.inner;
4375 if (ret_var.is_owned) {
4381 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4382 CHECK(owner->result_ok);
4383 return NodeAlias_clone(&*owner->contents.result);
4385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4386 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4387 LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4388 int64_t ret_ref = 0;
4389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4392 ret_ref = (uintptr_t)ret_var.inner;
4393 if (ret_var.is_owned) {
4399 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4400 CHECK(!owner->result_ok);
4401 return DecodeError_clone(&*owner->contents.err);
4403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4404 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4405 LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4406 int64_t ret_ref = 0;
4407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4410 ret_ref = (uintptr_t)ret_var.inner;
4411 if (ret_var.is_owned) {
4417 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4418 CHECK(owner->result_ok);
4419 return NodeInfo_clone(&*owner->contents.result);
4421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4422 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4423 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4424 int64_t ret_ref = 0;
4425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4428 ret_ref = (uintptr_t)ret_var.inner;
4429 if (ret_var.is_owned) {
4435 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4436 CHECK(!owner->result_ok);
4437 return DecodeError_clone(&*owner->contents.err);
4439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4440 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4441 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4442 int64_t ret_ref = 0;
4443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4446 ret_ref = (uintptr_t)ret_var.inner;
4447 if (ret_var.is_owned) {
4453 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4454 CHECK(owner->result_ok);
4455 return &*owner->contents.result;
4457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4458 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4459 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4460 int64_t ret_ref = 0;
4461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4464 ret_ref = (uintptr_t)ret_var.inner & ~1;
4468 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4469 CHECK(!owner->result_ok);
4470 return DecodeError_clone(&*owner->contents.err);
4472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4473 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4474 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4475 int64_t ret_ref = 0;
4476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4479 ret_ref = (uintptr_t)ret_var.inner;
4480 if (ret_var.is_owned) {
4486 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4487 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4488 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4489 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4491 LDKCOption_CVec_NetAddressZZ_Some_class =
4492 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4493 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4494 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4495 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4496 LDKCOption_CVec_NetAddressZZ_None_class =
4497 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4498 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4499 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4500 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4502 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4503 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4505 case LDKCOption_CVec_NetAddressZZ_Some: {
4506 LDKCVec_NetAddressZ some_var = obj->some;
4507 int64_tArray some_arr = NULL;
4508 some_arr = (*env)->NewLongArray(env, some_var.datalen);
4509 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4510 for (size_t m = 0; m < some_var.datalen; m++) {
4511 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
4512 some_arr_ptr[m] = some_conv_12_ref;
4514 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4515 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4517 case LDKCOption_CVec_NetAddressZZ_None: {
4518 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4523 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4524 CHECK(owner->result_ok);
4525 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
4527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4528 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4529 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4530 int64_t ret_ref = 0;
4531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4534 ret_ref = (uintptr_t)ret_var.inner;
4535 if (ret_var.is_owned) {
4541 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4542 CHECK(!owner->result_ok);
4543 return DecodeError_clone(&*owner->contents.err);
4545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4546 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4547 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4548 int64_t ret_ref = 0;
4549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4552 ret_ref = (uintptr_t)ret_var.inner;
4553 if (ret_var.is_owned) {
4559 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4560 CHECK(owner->result_ok);
4561 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
4563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4564 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4565 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4566 int64_t ret_ref = 0;
4567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4570 ret_ref = (uintptr_t)ret_var.inner;
4571 if (ret_var.is_owned) {
4577 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4578 CHECK(!owner->result_ok);
4579 return DecodeError_clone(&*owner->contents.err);
4581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4582 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4583 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4584 int64_t ret_ref = 0;
4585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4588 ret_ref = (uintptr_t)ret_var.inner;
4589 if (ret_var.is_owned) {
4595 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4596 CHECK(owner->result_ok);
4597 return SpendableOutputDescriptor_clone(&*owner->contents.result);
4599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4600 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4601 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4602 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4603 int64_t ret_ref = (uintptr_t)ret_copy;
4607 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4608 CHECK(!owner->result_ok);
4609 return DecodeError_clone(&*owner->contents.err);
4611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4612 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4613 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4614 int64_t ret_ref = 0;
4615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4618 ret_ref = (uintptr_t)ret_var.inner;
4619 if (ret_var.is_owned) {
4625 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4626 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4627 for (size_t i = 0; i < ret.datalen; i++) {
4628 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4632 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4636 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4637 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4642 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4645 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4646 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4647 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4648 jobjectArray ret_arr = NULL;
4649 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4651 for (size_t i = 0; i < ret_var.datalen; i++) {
4652 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4653 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4654 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4660 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4661 CHECK(owner->result_ok);
4662 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4665 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4666 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4667 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4668 return ((int64_t)ret_conv);
4671 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4672 CHECK(!owner->result_ok);
4673 return *owner->contents.err;
4675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4676 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4677 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4680 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4681 CHECK(owner->result_ok);
4682 return *owner->contents.result;
4684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4685 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4686 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4687 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4691 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4692 CHECK(!owner->result_ok);
4693 return *owner->contents.err;
4695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4696 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4697 CResult_SignatureNoneZ_get_err(owner_conv);
4700 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4704 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4705 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4710 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4714 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4715 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4716 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4720 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4721 CHECK(owner->result_ok);
4722 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4725 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4726 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4727 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4728 return ((int64_t)ret_conv);
4731 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4732 CHECK(!owner->result_ok);
4733 return *owner->contents.err;
4735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4736 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4737 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4740 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4741 CHECK(owner->result_ok);
4742 return *owner->contents.result;
4744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4745 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4746 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4747 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4751 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4752 CHECK(!owner->result_ok);
4753 return *owner->contents.err;
4755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4756 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4757 CResult_SecretKeyNoneZ_get_err(owner_conv);
4760 typedef struct LDKBaseSign_JCalls {
4761 atomic_size_t refcnt;
4764 jmethodID get_per_commitment_point_meth;
4765 jmethodID release_commitment_secret_meth;
4766 jmethodID validate_holder_commitment_meth;
4767 jmethodID channel_keys_id_meth;
4768 jmethodID sign_counterparty_commitment_meth;
4769 jmethodID validate_counterparty_revocation_meth;
4770 jmethodID sign_holder_commitment_and_htlcs_meth;
4771 jmethodID sign_justice_revoked_output_meth;
4772 jmethodID sign_justice_revoked_htlc_meth;
4773 jmethodID sign_counterparty_htlc_transaction_meth;
4774 jmethodID sign_closing_transaction_meth;
4775 jmethodID sign_channel_announcement_meth;
4776 jmethodID ready_channel_meth;
4777 } LDKBaseSign_JCalls;
4778 static void LDKBaseSign_JCalls_free(void* this_arg) {
4779 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4780 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4782 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4783 if (get_jenv_res == JNI_EDETACHED) {
4784 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4786 DO_ASSERT(get_jenv_res == JNI_OK);
4788 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4789 if (get_jenv_res == JNI_EDETACHED) {
4790 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4795 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4796 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4798 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4799 if (get_jenv_res == JNI_EDETACHED) {
4800 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4802 DO_ASSERT(get_jenv_res == JNI_OK);
4804 int64_t idx_conv = idx;
4805 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4807 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4808 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4809 (*env)->ExceptionDescribe(env);
4810 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4812 LDKPublicKey ret_ref;
4813 CHECK((*env)->GetArrayLength(env, ret) == 33);
4814 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4815 if (get_jenv_res == JNI_EDETACHED) {
4816 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4820 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4821 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4823 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4824 if (get_jenv_res == JNI_EDETACHED) {
4825 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4827 DO_ASSERT(get_jenv_res == JNI_OK);
4829 int64_t idx_conv = idx;
4830 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4832 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4833 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4834 (*env)->ExceptionDescribe(env);
4835 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4837 LDKThirtyTwoBytes ret_ref;
4838 CHECK((*env)->GetArrayLength(env, ret) == 32);
4839 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4840 if (get_jenv_res == JNI_EDETACHED) {
4841 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4845 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4846 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4848 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4849 if (get_jenv_res == JNI_EDETACHED) {
4850 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4852 DO_ASSERT(get_jenv_res == JNI_OK);
4854 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4855 int64_t holder_tx_ref = 0;
4856 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4857 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4858 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4859 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4860 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
4861 if (holder_tx_var.is_owned) {
4864 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4865 jobjectArray preimages_arr = NULL;
4866 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4868 for (size_t i = 0; i < preimages_var.datalen; i++) {
4869 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4870 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4871 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4874 FREE(preimages_var.data);
4875 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4877 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4878 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4879 (*env)->ExceptionDescribe(env);
4880 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4882 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4883 CHECK_ACCESS(ret_ptr);
4884 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4886 if (get_jenv_res == JNI_EDETACHED) {
4887 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4891 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4892 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4894 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4895 if (get_jenv_res == JNI_EDETACHED) {
4896 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4898 DO_ASSERT(get_jenv_res == JNI_OK);
4900 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4902 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4903 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4904 (*env)->ExceptionDescribe(env);
4905 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4907 LDKThirtyTwoBytes ret_ref;
4908 CHECK((*env)->GetArrayLength(env, ret) == 32);
4909 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4910 if (get_jenv_res == JNI_EDETACHED) {
4911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4915 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4916 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4918 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4919 if (get_jenv_res == JNI_EDETACHED) {
4920 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4922 DO_ASSERT(get_jenv_res == JNI_OK);
4924 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4925 int64_t commitment_tx_ref = 0;
4926 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4927 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4928 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4929 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4930 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4931 if (commitment_tx_var.is_owned) {
4932 commitment_tx_ref |= 1;
4934 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4935 jobjectArray preimages_arr = NULL;
4936 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4938 for (size_t i = 0; i < preimages_var.datalen; i++) {
4939 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4940 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4941 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4944 FREE(preimages_var.data);
4945 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4947 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4948 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4949 (*env)->ExceptionDescribe(env);
4950 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4952 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4953 CHECK_ACCESS(ret_ptr);
4954 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4956 if (get_jenv_res == JNI_EDETACHED) {
4957 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4961 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4962 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4964 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4965 if (get_jenv_res == JNI_EDETACHED) {
4966 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4968 DO_ASSERT(get_jenv_res == JNI_OK);
4970 int64_t idx_conv = idx;
4971 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4972 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4975 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4976 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4977 (*env)->ExceptionDescribe(env);
4978 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4980 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4981 CHECK_ACCESS(ret_ptr);
4982 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4984 if (get_jenv_res == JNI_EDETACHED) {
4985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4989 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4990 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4992 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4993 if (get_jenv_res == JNI_EDETACHED) {
4994 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4996 DO_ASSERT(get_jenv_res == JNI_OK);
4998 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4999 int64_t commitment_tx_ref = 0;
5000 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
5001 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5002 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5003 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
5004 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
5005 if (commitment_tx_var.is_owned) {
5006 commitment_tx_ref |= 1;
5008 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5010 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
5011 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5012 (*env)->ExceptionDescribe(env);
5013 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
5015 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5016 CHECK_ACCESS(ret_ptr);
5017 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
5019 if (get_jenv_res == JNI_EDETACHED) {
5020 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5024 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]) {
5025 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5027 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5028 if (get_jenv_res == JNI_EDETACHED) {
5029 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5031 DO_ASSERT(get_jenv_res == JNI_OK);
5033 LDKTransaction justice_tx_var = justice_tx;
5034 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5035 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5036 Transaction_free(justice_tx_var);
5037 int64_t input_conv = input;
5038 int64_t amount_conv = amount;
5039 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5040 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5041 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5043 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);
5044 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5045 (*env)->ExceptionDescribe(env);
5046 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
5048 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5049 CHECK_ACCESS(ret_ptr);
5050 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5052 if (get_jenv_res == JNI_EDETACHED) {
5053 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5057 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) {
5058 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5060 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5061 if (get_jenv_res == JNI_EDETACHED) {
5062 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5064 DO_ASSERT(get_jenv_res == JNI_OK);
5066 LDKTransaction justice_tx_var = justice_tx;
5067 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5068 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5069 Transaction_free(justice_tx_var);
5070 int64_t input_conv = input;
5071 int64_t amount_conv = amount;
5072 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5073 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5074 LDKHTLCOutputInCommitment htlc_var = *htlc;
5075 int64_t htlc_ref = 0;
5076 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5077 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5078 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5079 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5080 htlc_ref = (uintptr_t)htlc_var.inner;
5081 if (htlc_var.is_owned) {
5084 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5086 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);
5087 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5088 (*env)->ExceptionDescribe(env);
5089 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
5091 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5092 CHECK_ACCESS(ret_ptr);
5093 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5095 if (get_jenv_res == JNI_EDETACHED) {
5096 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5100 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) {
5101 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5103 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5104 if (get_jenv_res == JNI_EDETACHED) {
5105 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5107 DO_ASSERT(get_jenv_res == JNI_OK);
5109 LDKTransaction htlc_tx_var = htlc_tx;
5110 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
5111 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
5112 Transaction_free(htlc_tx_var);
5113 int64_t input_conv = input;
5114 int64_t amount_conv = amount;
5115 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
5116 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
5117 LDKHTLCOutputInCommitment htlc_var = *htlc;
5118 int64_t htlc_ref = 0;
5119 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5120 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5121 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5122 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5123 htlc_ref = (uintptr_t)htlc_var.inner;
5124 if (htlc_var.is_owned) {
5127 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5129 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);
5130 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5131 (*env)->ExceptionDescribe(env);
5132 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
5134 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5135 CHECK_ACCESS(ret_ptr);
5136 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5138 if (get_jenv_res == JNI_EDETACHED) {
5139 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5143 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
5144 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5146 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5147 if (get_jenv_res == JNI_EDETACHED) {
5148 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5150 DO_ASSERT(get_jenv_res == JNI_OK);
5152 LDKClosingTransaction closing_tx_var = *closing_tx;
5153 int64_t closing_tx_ref = 0;
5154 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
5155 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5156 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5157 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
5158 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
5159 if (closing_tx_var.is_owned) {
5160 closing_tx_ref |= 1;
5162 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5164 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
5165 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5166 (*env)->ExceptionDescribe(env);
5167 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
5169 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5170 CHECK_ACCESS(ret_ptr);
5171 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5173 if (get_jenv_res == JNI_EDETACHED) {
5174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5178 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
5179 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5181 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5182 if (get_jenv_res == JNI_EDETACHED) {
5183 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5185 DO_ASSERT(get_jenv_res == JNI_OK);
5187 LDKUnsignedChannelAnnouncement msg_var = *msg;
5188 int64_t msg_ref = 0;
5189 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
5190 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5191 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5192 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5193 msg_ref = (uintptr_t)msg_var.inner;
5194 if (msg_var.is_owned) {
5197 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5199 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
5200 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5201 (*env)->ExceptionDescribe(env);
5202 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
5204 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5205 CHECK_ACCESS(ret_ptr);
5206 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
5208 if (get_jenv_res == JNI_EDETACHED) {
5209 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5213 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
5214 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5216 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5217 if (get_jenv_res == JNI_EDETACHED) {
5218 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5220 DO_ASSERT(get_jenv_res == JNI_OK);
5222 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
5223 int64_t channel_parameters_ref = 0;
5224 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
5225 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
5228 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
5229 if (channel_parameters_var.is_owned) {
5230 channel_parameters_ref |= 1;
5232 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5234 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
5235 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5236 (*env)->ExceptionDescribe(env);
5237 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
5239 if (get_jenv_res == JNI_EDETACHED) {
5240 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5243 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5244 jclass c = (*env)->GetObjectClass(env, o);
5246 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
5247 atomic_init(&calls->refcnt, 1);
5248 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5249 calls->o = (*env)->NewWeakGlobalRef(env, o);
5250 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
5251 CHECK(calls->get_per_commitment_point_meth != NULL);
5252 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
5253 CHECK(calls->release_commitment_secret_meth != NULL);
5254 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
5255 CHECK(calls->validate_holder_commitment_meth != NULL);
5256 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
5257 CHECK(calls->channel_keys_id_meth != NULL);
5258 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
5259 CHECK(calls->sign_counterparty_commitment_meth != NULL);
5260 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
5261 CHECK(calls->validate_counterparty_revocation_meth != NULL);
5262 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
5263 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
5264 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
5265 CHECK(calls->sign_justice_revoked_output_meth != NULL);
5266 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
5267 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
5268 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
5269 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
5270 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
5271 CHECK(calls->sign_closing_transaction_meth != NULL);
5272 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
5273 CHECK(calls->sign_channel_announcement_meth != NULL);
5274 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
5275 CHECK(calls->ready_channel_meth != NULL);
5277 LDKChannelPublicKeys pubkeys_conv;
5278 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5279 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5280 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5283 .this_arg = (void*) calls,
5284 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
5285 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
5286 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
5287 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
5288 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
5289 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
5290 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
5291 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
5292 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
5293 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
5294 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
5295 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
5296 .ready_channel = ready_channel_LDKBaseSign_jcall,
5297 .free = LDKBaseSign_JCalls_free,
5298 .pubkeys = pubkeys_conv,
5299 .set_pubkeys = NULL,
5303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5304 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
5305 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
5306 return (uint64_t)res_ptr;
5308 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) {
5309 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5310 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5311 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5312 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5313 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5318 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5319 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5320 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5321 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5326 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) {
5327 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5328 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5329 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5330 LDKHolderCommitmentTransaction holder_tx_conv;
5331 holder_tx_conv.inner = (void*)(holder_tx & (~1));
5332 holder_tx_conv.is_owned = false;
5333 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5334 LDKCVec_PaymentPreimageZ preimages_constr;
5335 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5336 if (preimages_constr.datalen > 0)
5337 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5339 preimages_constr.data = NULL;
5340 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5341 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5342 LDKThirtyTwoBytes preimages_conv_8_ref;
5343 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5344 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5345 preimages_constr.data[i] = preimages_conv_8_ref;
5347 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5348 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5349 return (int64_t)ret_conv;
5352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5353 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5354 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5355 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5356 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5357 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5361 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) {
5362 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5363 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5364 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5365 LDKCommitmentTransaction commitment_tx_conv;
5366 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5367 commitment_tx_conv.is_owned = false;
5368 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5369 LDKCVec_PaymentPreimageZ preimages_constr;
5370 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5371 if (preimages_constr.datalen > 0)
5372 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5374 preimages_constr.data = NULL;
5375 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5376 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5377 LDKThirtyTwoBytes preimages_conv_8_ref;
5378 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5379 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5380 preimages_constr.data[i] = preimages_conv_8_ref;
5382 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5383 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
5384 return (int64_t)ret_conv;
5387 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) {
5388 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5390 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5391 unsigned char secret_arr[32];
5392 CHECK((*env)->GetArrayLength(env, secret) == 32);
5393 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5394 unsigned char (*secret_ref)[32] = &secret_arr;
5395 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5396 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5397 return (int64_t)ret_conv;
5400 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) {
5401 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5402 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5403 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5404 LDKHolderCommitmentTransaction commitment_tx_conv;
5405 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5406 commitment_tx_conv.is_owned = false;
5407 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5408 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5409 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5410 return (int64_t)ret_conv;
5413 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) {
5414 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5415 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5416 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5417 LDKTransaction justice_tx_ref;
5418 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5419 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5420 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5421 justice_tx_ref.data_is_owned = true;
5422 unsigned char per_commitment_key_arr[32];
5423 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5424 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5425 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5426 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5427 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5428 return (int64_t)ret_conv;
5431 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) {
5432 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5433 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5434 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5435 LDKTransaction justice_tx_ref;
5436 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5437 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5438 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5439 justice_tx_ref.data_is_owned = true;
5440 unsigned char per_commitment_key_arr[32];
5441 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5442 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5443 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5444 LDKHTLCOutputInCommitment htlc_conv;
5445 htlc_conv.inner = (void*)(htlc & (~1));
5446 htlc_conv.is_owned = false;
5447 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5448 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5449 *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);
5450 return (int64_t)ret_conv;
5453 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) {
5454 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5456 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5457 LDKTransaction htlc_tx_ref;
5458 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5459 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5460 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5461 htlc_tx_ref.data_is_owned = true;
5462 LDKPublicKey per_commitment_point_ref;
5463 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5464 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5465 LDKHTLCOutputInCommitment htlc_conv;
5466 htlc_conv.inner = (void*)(htlc & (~1));
5467 htlc_conv.is_owned = false;
5468 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5469 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5470 *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);
5471 return (int64_t)ret_conv;
5474 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) {
5475 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5476 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5477 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5478 LDKClosingTransaction closing_tx_conv;
5479 closing_tx_conv.inner = (void*)(closing_tx & (~1));
5480 closing_tx_conv.is_owned = false;
5481 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5482 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5483 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5484 return (int64_t)ret_conv;
5487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5488 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5489 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5490 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5491 LDKUnsignedChannelAnnouncement msg_conv;
5492 msg_conv.inner = (void*)(msg & (~1));
5493 msg_conv.is_owned = false;
5494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5495 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5496 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5497 return (int64_t)ret_conv;
5500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5501 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5502 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5503 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5504 LDKChannelTransactionParameters channel_parameters_conv;
5505 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
5506 channel_parameters_conv.is_owned = false;
5507 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5508 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5511 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5512 if (this_arg->set_pubkeys != NULL)
5513 this_arg->set_pubkeys(this_arg);
5514 return this_arg->pubkeys;
5516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5517 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5518 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5519 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5520 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5521 int64_t ret_ref = 0;
5522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5525 ret_ref = (uintptr_t)ret_var.inner;
5526 if (ret_var.is_owned) {
5532 typedef struct LDKSign_JCalls {
5533 atomic_size_t refcnt;
5536 LDKBaseSign_JCalls* BaseSign;
5537 jmethodID write_meth;
5539 static void LDKSign_JCalls_free(void* this_arg) {
5540 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5541 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5543 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5544 if (get_jenv_res == JNI_EDETACHED) {
5545 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5547 DO_ASSERT(get_jenv_res == JNI_OK);
5549 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5550 if (get_jenv_res == JNI_EDETACHED) {
5551 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5556 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5557 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5559 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5560 if (get_jenv_res == JNI_EDETACHED) {
5561 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5563 DO_ASSERT(get_jenv_res == JNI_OK);
5565 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5567 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5568 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5569 (*env)->ExceptionDescribe(env);
5570 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5572 LDKCVec_u8Z ret_ref;
5573 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5574 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5575 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5576 if (get_jenv_res == JNI_EDETACHED) {
5577 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5581 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5582 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5583 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5584 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5586 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5587 jclass c = (*env)->GetObjectClass(env, o);
5589 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5590 atomic_init(&calls->refcnt, 1);
5591 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5592 calls->o = (*env)->NewWeakGlobalRef(env, o);
5593 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5594 CHECK(calls->write_meth != NULL);
5596 LDKChannelPublicKeys pubkeys_conv;
5597 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5598 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5599 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5602 .this_arg = (void*) calls,
5603 .write = write_LDKSign_jcall,
5604 .cloned = LDKSign_JCalls_cloned,
5605 .free = LDKSign_JCalls_free,
5606 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5608 calls->BaseSign = ret.BaseSign.this_arg;
5611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5612 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5613 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5614 return (uint64_t)res_ptr;
5616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5617 LDKSign *inp = (LDKSign *)(arg & ~1);
5618 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
5619 DO_ASSERT((res_ptr & 1) == 0);
5620 return (int64_t)(res_ptr | 1);
5622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5623 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5624 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5625 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5626 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5627 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5628 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5629 CVec_u8Z_free(ret_var);
5633 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5634 CHECK(owner->result_ok);
5635 return Sign_clone(&*owner->contents.result);
5637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5638 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5639 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5640 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5641 return (int64_t)ret_ret;
5644 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5645 CHECK(!owner->result_ok);
5646 return DecodeError_clone(&*owner->contents.err);
5648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5649 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5650 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5651 int64_t ret_ref = 0;
5652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5655 ret_ref = (uintptr_t)ret_var.inner;
5656 if (ret_var.is_owned) {
5662 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5663 CHECK(owner->result_ok);
5664 return *owner->contents.result;
5666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5667 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5668 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5669 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5673 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5674 CHECK(!owner->result_ok);
5675 return *owner->contents.err;
5677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5678 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5679 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5682 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5683 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5684 for (size_t i = 0; i < ret.datalen; i++) {
5685 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5689 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5690 CHECK(owner->result_ok);
5691 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5693 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5694 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5695 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5696 jobjectArray ret_arr = NULL;
5697 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5699 for (size_t i = 0; i < ret_var.datalen; i++) {
5700 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5701 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5702 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5703 CVec_u8Z_free(ret_conv_8_var);
5704 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5711 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5712 CHECK(!owner->result_ok);
5713 return *owner->contents.err;
5715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5716 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5717 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5720 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5721 CHECK(owner->result_ok);
5722 return InMemorySigner_clone(&*owner->contents.result);
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5725 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5726 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5727 int64_t ret_ref = 0;
5728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5731 ret_ref = (uintptr_t)ret_var.inner;
5732 if (ret_var.is_owned) {
5738 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5739 CHECK(!owner->result_ok);
5740 return DecodeError_clone(&*owner->contents.err);
5742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5743 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5744 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5745 int64_t ret_ref = 0;
5746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5749 ret_ref = (uintptr_t)ret_var.inner;
5750 if (ret_var.is_owned) {
5756 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5757 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5758 for (size_t i = 0; i < ret.datalen; i++) {
5759 ret.data[i] = TxOut_clone(&orig->data[i]);
5763 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5764 CHECK(owner->result_ok);
5765 return *owner->contents.result;
5767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5768 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5769 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5770 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5771 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5775 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5776 CHECK(!owner->result_ok);
5777 return *owner->contents.err;
5779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5780 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5781 CResult_TransactionNoneZ_get_err(owner_conv);
5784 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5785 return ThirtyTwoBytes_clone(&owner->a);
5787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5788 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5789 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5794 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5795 return ChannelMonitor_clone(&owner->b);
5797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5798 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5799 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5800 int64_t ret_ref = 0;
5801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5804 ret_ref = (uintptr_t)ret_var.inner;
5805 if (ret_var.is_owned) {
5811 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5812 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5813 for (size_t i = 0; i < ret.datalen; i++) {
5814 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5818 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5819 CHECK(owner->result_ok);
5820 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5822 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5823 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5824 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5825 int64_tArray ret_arr = NULL;
5826 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5827 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5828 for (size_t j = 0; j < ret_var.datalen; j++) {
5829 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5830 *ret_conv_35_conv = ret_var.data[j];
5831 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
5833 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5838 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5839 CHECK(!owner->result_ok);
5840 return *owner->contents.err;
5842 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5843 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5844 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5848 static jclass LDKCOption_u16Z_Some_class = NULL;
5849 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5850 static jclass LDKCOption_u16Z_None_class = NULL;
5851 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5853 LDKCOption_u16Z_Some_class =
5854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5855 CHECK(LDKCOption_u16Z_Some_class != NULL);
5856 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5857 CHECK(LDKCOption_u16Z_Some_meth != NULL);
5858 LDKCOption_u16Z_None_class =
5859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5860 CHECK(LDKCOption_u16Z_None_class != NULL);
5861 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5862 CHECK(LDKCOption_u16Z_None_meth != NULL);
5864 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5865 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5867 case LDKCOption_u16Z_Some: {
5868 int16_t some_conv = obj->some;
5869 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5871 case LDKCOption_u16Z_None: {
5872 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5877 static jclass LDKAPIError_APIMisuseError_class = NULL;
5878 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5879 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5880 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5881 static jclass LDKAPIError_RouteError_class = NULL;
5882 static jmethodID LDKAPIError_RouteError_meth = NULL;
5883 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5884 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5885 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5886 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5887 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5888 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5890 LDKAPIError_APIMisuseError_class =
5891 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5892 CHECK(LDKAPIError_APIMisuseError_class != NULL);
5893 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5894 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5895 LDKAPIError_FeeRateTooHigh_class =
5896 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5897 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5898 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5899 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5900 LDKAPIError_RouteError_class =
5901 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5902 CHECK(LDKAPIError_RouteError_class != NULL);
5903 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5904 CHECK(LDKAPIError_RouteError_meth != NULL);
5905 LDKAPIError_ChannelUnavailable_class =
5906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5907 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5908 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5909 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5910 LDKAPIError_MonitorUpdateFailed_class =
5911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5912 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5913 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5914 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5915 LDKAPIError_IncompatibleShutdownScript_class =
5916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5917 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5918 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5919 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5922 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5924 case LDKAPIError_APIMisuseError: {
5925 LDKStr err_str = obj->api_misuse_error.err;
5926 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5927 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5929 case LDKAPIError_FeeRateTooHigh: {
5930 LDKStr err_str = obj->fee_rate_too_high.err;
5931 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5932 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5933 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5935 case LDKAPIError_RouteError: {
5936 LDKStr err_str = obj->route_error.err;
5937 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5938 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5940 case LDKAPIError_ChannelUnavailable: {
5941 LDKStr err_str = obj->channel_unavailable.err;
5942 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5943 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5945 case LDKAPIError_MonitorUpdateFailed: {
5946 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5948 case LDKAPIError_IncompatibleShutdownScript: {
5949 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5950 int64_t script_ref = 0;
5951 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5952 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5953 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5954 script_ref = (uintptr_t)script_var.inner & ~1;
5955 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5960 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5961 CHECK(owner->result_ok);
5962 return *owner->contents.result;
5964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5965 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5966 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5969 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5970 CHECK(!owner->result_ok);
5971 return APIError_clone(&*owner->contents.err);
5973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5974 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5975 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5976 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5977 int64_t ret_ref = (uintptr_t)ret_copy;
5981 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5982 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5983 for (size_t i = 0; i < ret.datalen; i++) {
5984 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5988 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5989 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5990 for (size_t i = 0; i < ret.datalen; i++) {
5991 ret.data[i] = APIError_clone(&orig->data[i]);
5995 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5996 CHECK(owner->result_ok);
5997 return ThirtyTwoBytes_clone(&*owner->contents.result);
5999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6000 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
6001 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6006 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6007 CHECK(!owner->result_ok);
6008 return APIError_clone(&*owner->contents.err);
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6011 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
6012 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6013 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6014 int64_t ret_ref = (uintptr_t)ret_copy;
6018 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6019 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6020 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6021 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6022 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
6023 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
6024 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6025 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6027 LDKPaymentSendFailure_ParameterError_class =
6028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6029 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6030 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6031 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6032 LDKPaymentSendFailure_PathParameterError_class =
6033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6034 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6035 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6036 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6037 LDKPaymentSendFailure_AllFailedRetrySafe_class =
6038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
6039 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
6040 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
6041 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
6042 LDKPaymentSendFailure_PartialFailure_class =
6043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6044 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6045 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6046 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6048 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6049 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6051 case LDKPaymentSendFailure_ParameterError: {
6052 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
6053 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6055 case LDKPaymentSendFailure_PathParameterError: {
6056 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6057 int64_tArray path_parameter_error_arr = NULL;
6058 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6059 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6060 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6061 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6062 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6063 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6064 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
6066 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6067 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6069 case LDKPaymentSendFailure_AllFailedRetrySafe: {
6070 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
6071 int64_tArray all_failed_retry_safe_arr = NULL;
6072 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
6073 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
6074 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
6075 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
6076 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
6078 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
6079 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
6081 case LDKPaymentSendFailure_PartialFailure: {
6082 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6083 int64_tArray results_arr = NULL;
6084 results_arr = (*env)->NewLongArray(env, results_var.datalen);
6085 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6086 for (size_t w = 0; w < results_var.datalen; w++) {
6087 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6088 *results_conv_22_conv = results_var.data[w];
6089 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6090 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
6092 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6093 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6094 int64_t failed_paths_retry_ref = 0;
6095 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
6096 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6097 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6098 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6099 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
6101 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6102 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6103 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6108 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6109 CHECK(owner->result_ok);
6110 return ThirtyTwoBytes_clone(&*owner->contents.result);
6112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6113 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6114 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6115 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
6119 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6120 CHECK(!owner->result_ok);
6121 return PaymentSendFailure_clone(&*owner->contents.err);
6123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6124 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6125 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6126 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
6127 int64_t ret_ref = (uintptr_t)ret_copy;
6131 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6132 CHECK(owner->result_ok);
6133 return *owner->contents.result;
6135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6136 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6137 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6140 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6141 CHECK(!owner->result_ok);
6142 return PaymentSendFailure_clone(&*owner->contents.err);
6144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6145 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6146 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6147 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6148 int64_t ret_ref = (uintptr_t)ret_copy;
6152 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6153 return ThirtyTwoBytes_clone(&owner->a);
6155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6156 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6157 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
6162 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6163 return ThirtyTwoBytes_clone(&owner->b);
6165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6166 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6167 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6168 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
6172 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6173 CHECK(owner->result_ok);
6174 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6177 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6178 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6179 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6180 return ((int64_t)ret_conv);
6183 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6184 CHECK(!owner->result_ok);
6185 return PaymentSendFailure_clone(&*owner->contents.err);
6187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6188 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6189 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6190 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6191 int64_t ret_ref = (uintptr_t)ret_copy;
6195 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6196 LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6197 for (size_t i = 0; i < ret.datalen; i++) {
6198 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6202 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6203 return ThirtyTwoBytes_clone(&owner->a);
6205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6206 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6207 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6208 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6212 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6213 return ThirtyTwoBytes_clone(&owner->b);
6215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6216 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6222 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6223 CHECK(owner->result_ok);
6224 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6227 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6228 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6229 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6230 return ((int64_t)ret_conv);
6233 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6234 CHECK(!owner->result_ok);
6235 return *owner->contents.err;
6237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6238 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6239 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6242 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6243 CHECK(owner->result_ok);
6244 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6247 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6248 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6249 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6250 return ((int64_t)ret_conv);
6253 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6254 CHECK(!owner->result_ok);
6255 return APIError_clone(&*owner->contents.err);
6257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6258 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6259 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6260 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6261 int64_t ret_ref = (uintptr_t)ret_copy;
6265 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6266 CHECK(owner->result_ok);
6267 return ThirtyTwoBytes_clone(&*owner->contents.result);
6269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6270 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6271 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6272 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6276 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6277 CHECK(!owner->result_ok);
6278 return *owner->contents.err;
6280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6281 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6282 CResult_PaymentSecretNoneZ_get_err(owner_conv);
6285 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6286 CHECK(owner->result_ok);
6287 return ThirtyTwoBytes_clone(&*owner->contents.result);
6289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6290 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6291 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6292 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
6296 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6297 CHECK(!owner->result_ok);
6298 return APIError_clone(&*owner->contents.err);
6300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6301 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6302 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6303 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6304 int64_t ret_ref = (uintptr_t)ret_copy;
6308 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6309 CHECK(owner->result_ok);
6310 return ThirtyTwoBytes_clone(&*owner->contents.result);
6312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6313 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6314 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6315 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6319 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6320 CHECK(!owner->result_ok);
6321 return APIError_clone(&*owner->contents.err);
6323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6324 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6325 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6326 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6327 int64_t ret_ref = (uintptr_t)ret_copy;
6331 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6332 CHECK(owner->result_ok);
6333 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
6335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6336 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6337 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6338 int64_t ret_ref = 0;
6339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6342 ret_ref = (uintptr_t)ret_var.inner;
6343 if (ret_var.is_owned) {
6349 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6350 CHECK(!owner->result_ok);
6351 return DecodeError_clone(&*owner->contents.err);
6353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6354 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6355 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6356 int64_t ret_ref = 0;
6357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6360 ret_ref = (uintptr_t)ret_var.inner;
6361 if (ret_var.is_owned) {
6367 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6368 CHECK(owner->result_ok);
6369 return ChannelCounterparty_clone(&*owner->contents.result);
6371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6372 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6373 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6374 int64_t ret_ref = 0;
6375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6378 ret_ref = (uintptr_t)ret_var.inner;
6379 if (ret_var.is_owned) {
6385 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6386 CHECK(!owner->result_ok);
6387 return DecodeError_clone(&*owner->contents.err);
6389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6390 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6391 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6392 int64_t ret_ref = 0;
6393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6396 ret_ref = (uintptr_t)ret_var.inner;
6397 if (ret_var.is_owned) {
6403 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6404 CHECK(owner->result_ok);
6405 return ChannelDetails_clone(&*owner->contents.result);
6407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6408 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6409 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6410 int64_t ret_ref = 0;
6411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6414 ret_ref = (uintptr_t)ret_var.inner;
6415 if (ret_var.is_owned) {
6421 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6422 CHECK(!owner->result_ok);
6423 return DecodeError_clone(&*owner->contents.err);
6425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6426 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6427 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6428 int64_t ret_ref = 0;
6429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6432 ret_ref = (uintptr_t)ret_var.inner;
6433 if (ret_var.is_owned) {
6439 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6440 CHECK(owner->result_ok);
6441 return PhantomRouteHints_clone(&*owner->contents.result);
6443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6444 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6445 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6446 int64_t ret_ref = 0;
6447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6450 ret_ref = (uintptr_t)ret_var.inner;
6451 if (ret_var.is_owned) {
6457 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6458 CHECK(!owner->result_ok);
6459 return DecodeError_clone(&*owner->contents.err);
6461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6462 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6463 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6464 int64_t ret_ref = 0;
6465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6468 ret_ref = (uintptr_t)ret_var.inner;
6469 if (ret_var.is_owned) {
6475 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6476 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6477 for (size_t i = 0; i < ret.datalen; i++) {
6478 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6482 typedef struct LDKWatch_JCalls {
6483 atomic_size_t refcnt;
6486 jmethodID watch_channel_meth;
6487 jmethodID update_channel_meth;
6488 jmethodID release_pending_monitor_events_meth;
6490 static void LDKWatch_JCalls_free(void* this_arg) {
6491 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6492 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6494 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6495 if (get_jenv_res == JNI_EDETACHED) {
6496 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6498 DO_ASSERT(get_jenv_res == JNI_OK);
6500 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6501 if (get_jenv_res == JNI_EDETACHED) {
6502 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6507 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6508 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6510 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6511 if (get_jenv_res == JNI_EDETACHED) {
6512 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6514 DO_ASSERT(get_jenv_res == JNI_OK);
6516 LDKOutPoint funding_txo_var = funding_txo;
6517 int64_t funding_txo_ref = 0;
6518 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6519 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6520 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6521 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6522 if (funding_txo_var.is_owned) {
6523 funding_txo_ref |= 1;
6525 LDKChannelMonitor monitor_var = monitor;
6526 int64_t monitor_ref = 0;
6527 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6528 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6529 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6530 monitor_ref = (uintptr_t)monitor_var.inner;
6531 if (monitor_var.is_owned) {
6534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6536 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6537 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6538 (*env)->ExceptionDescribe(env);
6539 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6541 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6542 CHECK_ACCESS(ret_ptr);
6543 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6545 if (get_jenv_res == JNI_EDETACHED) {
6546 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6550 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6551 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6553 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6554 if (get_jenv_res == JNI_EDETACHED) {
6555 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6557 DO_ASSERT(get_jenv_res == JNI_OK);
6559 LDKOutPoint funding_txo_var = funding_txo;
6560 int64_t funding_txo_ref = 0;
6561 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6562 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6563 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6564 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6565 if (funding_txo_var.is_owned) {
6566 funding_txo_ref |= 1;
6568 LDKChannelMonitorUpdate update_var = update;
6569 int64_t update_ref = 0;
6570 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6571 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6572 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6573 update_ref = (uintptr_t)update_var.inner;
6574 if (update_var.is_owned) {
6577 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6579 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6580 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6581 (*env)->ExceptionDescribe(env);
6582 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6584 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6585 CHECK_ACCESS(ret_ptr);
6586 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6588 if (get_jenv_res == JNI_EDETACHED) {
6589 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6593 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6594 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6596 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6597 if (get_jenv_res == JNI_EDETACHED) {
6598 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6600 DO_ASSERT(get_jenv_res == JNI_OK);
6602 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6604 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6605 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6606 (*env)->ExceptionDescribe(env);
6607 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6609 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6610 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6611 if (ret_constr.datalen > 0)
6612 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6614 ret_constr.data = NULL;
6615 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6616 for (size_t x = 0; x < ret_constr.datalen; x++) {
6617 int64_t ret_conv_49 = ret_vals[x];
6618 void* ret_conv_49_ptr = (void*)(((uintptr_t)ret_conv_49) & ~1);
6619 CHECK_ACCESS(ret_conv_49_ptr);
6620 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6621 FREE((void*)ret_conv_49);
6622 ret_constr.data[x] = ret_conv_49_conv;
6624 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6625 if (get_jenv_res == JNI_EDETACHED) {
6626 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6630 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6631 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6632 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6634 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6635 jclass c = (*env)->GetObjectClass(env, o);
6637 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6638 atomic_init(&calls->refcnt, 1);
6639 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6640 calls->o = (*env)->NewWeakGlobalRef(env, o);
6641 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6642 CHECK(calls->watch_channel_meth != NULL);
6643 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6644 CHECK(calls->update_channel_meth != NULL);
6645 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6646 CHECK(calls->release_pending_monitor_events_meth != NULL);
6649 .this_arg = (void*) calls,
6650 .watch_channel = watch_channel_LDKWatch_jcall,
6651 .update_channel = update_channel_LDKWatch_jcall,
6652 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6653 .free = LDKWatch_JCalls_free,
6657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6658 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6659 *res_ptr = LDKWatch_init(env, clz, o);
6660 return (uint64_t)res_ptr;
6662 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) {
6663 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6664 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6665 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6666 LDKOutPoint funding_txo_conv;
6667 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6668 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6669 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6670 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6671 LDKChannelMonitor monitor_conv;
6672 monitor_conv.inner = (void*)(monitor & (~1));
6673 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6674 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6675 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6676 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6677 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6678 return (int64_t)ret_conv;
6681 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) {
6682 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6683 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6684 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6685 LDKOutPoint funding_txo_conv;
6686 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6687 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6688 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6689 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6690 LDKChannelMonitorUpdate update_conv;
6691 update_conv.inner = (void*)(update & (~1));
6692 update_conv.is_owned = (update & 1) || (update == 0);
6693 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6694 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6695 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6696 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6697 return (int64_t)ret_conv;
6700 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6701 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6702 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6703 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6704 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6705 int64_tArray ret_arr = NULL;
6706 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6707 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6708 for (size_t x = 0; x < ret_var.datalen; x++) {
6709 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6710 *ret_conv_49_conv = ret_var.data[x];
6711 ret_arr_ptr[x] = ((int64_t)ret_conv_49_conv);
6713 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6718 typedef struct LDKBroadcasterInterface_JCalls {
6719 atomic_size_t refcnt;
6722 jmethodID broadcast_transaction_meth;
6723 } LDKBroadcasterInterface_JCalls;
6724 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6725 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6726 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6728 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6729 if (get_jenv_res == JNI_EDETACHED) {
6730 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6732 DO_ASSERT(get_jenv_res == JNI_OK);
6734 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6735 if (get_jenv_res == JNI_EDETACHED) {
6736 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6741 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6742 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6744 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6745 if (get_jenv_res == JNI_EDETACHED) {
6746 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6748 DO_ASSERT(get_jenv_res == JNI_OK);
6750 LDKTransaction tx_var = tx;
6751 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6752 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6753 Transaction_free(tx_var);
6754 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6756 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6757 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6758 (*env)->ExceptionDescribe(env);
6759 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6761 if (get_jenv_res == JNI_EDETACHED) {
6762 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6765 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6766 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6767 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6769 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6770 jclass c = (*env)->GetObjectClass(env, o);
6772 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6773 atomic_init(&calls->refcnt, 1);
6774 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6775 calls->o = (*env)->NewWeakGlobalRef(env, o);
6776 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6777 CHECK(calls->broadcast_transaction_meth != NULL);
6779 LDKBroadcasterInterface ret = {
6780 .this_arg = (void*) calls,
6781 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6782 .free = LDKBroadcasterInterface_JCalls_free,
6786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6787 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6788 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6789 return (uint64_t)res_ptr;
6791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6792 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6793 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6794 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6795 LDKTransaction tx_ref;
6796 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6797 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6798 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6799 tx_ref.data_is_owned = true;
6800 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6803 typedef struct LDKKeysInterface_JCalls {
6804 atomic_size_t refcnt;
6807 jmethodID get_node_secret_meth;
6808 jmethodID get_destination_script_meth;
6809 jmethodID get_shutdown_scriptpubkey_meth;
6810 jmethodID get_channel_signer_meth;
6811 jmethodID get_secure_random_bytes_meth;
6812 jmethodID read_chan_signer_meth;
6813 jmethodID sign_invoice_meth;
6814 jmethodID get_inbound_payment_key_material_meth;
6815 } LDKKeysInterface_JCalls;
6816 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6817 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6818 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6820 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6821 if (get_jenv_res == JNI_EDETACHED) {
6822 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6824 DO_ASSERT(get_jenv_res == JNI_OK);
6826 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6827 if (get_jenv_res == JNI_EDETACHED) {
6828 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6833 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6834 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6836 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6837 if (get_jenv_res == JNI_EDETACHED) {
6838 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6840 DO_ASSERT(get_jenv_res == JNI_OK);
6842 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6843 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6845 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6846 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6847 (*env)->ExceptionDescribe(env);
6848 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6850 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6851 CHECK_ACCESS(ret_ptr);
6852 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6854 if (get_jenv_res == JNI_EDETACHED) {
6855 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6859 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6860 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6862 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6863 if (get_jenv_res == JNI_EDETACHED) {
6864 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6866 DO_ASSERT(get_jenv_res == JNI_OK);
6868 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6870 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6871 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6872 (*env)->ExceptionDescribe(env);
6873 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6875 LDKCVec_u8Z ret_ref;
6876 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6877 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6878 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6879 if (get_jenv_res == JNI_EDETACHED) {
6880 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6884 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6885 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6887 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6888 if (get_jenv_res == JNI_EDETACHED) {
6889 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6891 DO_ASSERT(get_jenv_res == JNI_OK);
6893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6895 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6896 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6897 (*env)->ExceptionDescribe(env);
6898 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6900 LDKShutdownScript ret_conv;
6901 ret_conv.inner = (void*)(ret & (~1));
6902 ret_conv.is_owned = (ret & 1) || (ret == 0);
6903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6904 if (get_jenv_res == JNI_EDETACHED) {
6905 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6909 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6910 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
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 jboolean inbound_conv = inbound;
6919 int64_t channel_value_satoshis_conv = channel_value_satoshis;
6920 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6922 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6923 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6924 (*env)->ExceptionDescribe(env);
6925 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6927 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6928 CHECK_ACCESS(ret_ptr);
6929 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6931 if (get_jenv_res == JNI_EDETACHED) {
6932 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6936 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6937 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6940 if (get_jenv_res == JNI_EDETACHED) {
6941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6943 DO_ASSERT(get_jenv_res == JNI_OK);
6945 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6947 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6948 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6949 (*env)->ExceptionDescribe(env);
6950 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6952 LDKThirtyTwoBytes ret_ref;
6953 CHECK((*env)->GetArrayLength(env, ret) == 32);
6954 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6955 if (get_jenv_res == JNI_EDETACHED) {
6956 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6960 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6961 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6963 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6964 if (get_jenv_res == JNI_EDETACHED) {
6965 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6967 DO_ASSERT(get_jenv_res == JNI_OK);
6969 LDKu8slice reader_var = reader;
6970 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6971 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6972 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6974 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6975 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6976 (*env)->ExceptionDescribe(env);
6977 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6979 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6980 CHECK_ACCESS(ret_ptr);
6981 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6983 if (get_jenv_res == JNI_EDETACHED) {
6984 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6988 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6989 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6991 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6992 if (get_jenv_res == JNI_EDETACHED) {
6993 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6995 DO_ASSERT(get_jenv_res == JNI_OK);
6997 LDKu8slice hrp_bytes_var = hrp_bytes;
6998 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6999 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
7000 LDKCVec_u5Z invoice_data_var = invoice_data;
7001 jobjectArray invoice_data_arr = NULL;
7002 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7003 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7004 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7005 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7006 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7008 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7009 FREE(invoice_data_var.data);
7010 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
7011 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7013 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
7014 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7015 (*env)->ExceptionDescribe(env);
7016 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
7018 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7019 CHECK_ACCESS(ret_ptr);
7020 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7022 if (get_jenv_res == JNI_EDETACHED) {
7023 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7027 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
7028 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7030 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7031 if (get_jenv_res == JNI_EDETACHED) {
7032 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7034 DO_ASSERT(get_jenv_res == JNI_OK);
7036 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7038 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7039 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7040 (*env)->ExceptionDescribe(env);
7041 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
7043 LDKThirtyTwoBytes ret_ref;
7044 CHECK((*env)->GetArrayLength(env, ret) == 32);
7045 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7046 if (get_jenv_res == JNI_EDETACHED) {
7047 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7051 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
7052 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
7053 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7055 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
7056 jclass c = (*env)->GetObjectClass(env, o);
7058 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
7059 atomic_init(&calls->refcnt, 1);
7060 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7061 calls->o = (*env)->NewWeakGlobalRef(env, o);
7062 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
7063 CHECK(calls->get_node_secret_meth != NULL);
7064 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
7065 CHECK(calls->get_destination_script_meth != NULL);
7066 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
7067 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
7068 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
7069 CHECK(calls->get_channel_signer_meth != NULL);
7070 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7071 CHECK(calls->get_secure_random_bytes_meth != NULL);
7072 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
7073 CHECK(calls->read_chan_signer_meth != NULL);
7074 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7075 CHECK(calls->sign_invoice_meth != NULL);
7076 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7077 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7079 LDKKeysInterface ret = {
7080 .this_arg = (void*) calls,
7081 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
7082 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
7083 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
7084 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
7085 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
7086 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
7087 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
7088 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
7089 .free = LDKKeysInterface_JCalls_free,
7093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7094 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7095 *res_ptr = LDKKeysInterface_init(env, clz, o);
7096 return (uint64_t)res_ptr;
7098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7099 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7100 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7101 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7102 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7103 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
7104 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
7105 return (int64_t)ret_conv;
7108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
7109 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7110 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7111 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7112 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
7113 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7114 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7115 CVec_u8Z_free(ret_var);
7119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
7120 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7121 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7122 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7123 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7124 int64_t ret_ref = 0;
7125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7128 ret_ref = (uintptr_t)ret_var.inner;
7129 if (ret_var.is_owned) {
7135 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) {
7136 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7137 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7138 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7139 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
7140 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
7141 return (int64_t)ret_ret;
7144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7145 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7146 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7147 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7148 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7149 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
7154 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7155 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7156 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7157 LDKu8slice reader_ref;
7158 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
7159 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
7160 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7161 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7162 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
7163 return (int64_t)ret_conv;
7166 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) {
7167 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7168 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7169 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7170 LDKu8slice hrp_bytes_ref;
7171 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
7172 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
7173 LDKCVec_u5Z invoice_data_constr;
7174 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
7175 if (invoice_data_constr.datalen > 0)
7176 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
7178 invoice_data_constr.data = NULL;
7179 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
7180 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7181 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7183 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
7185 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
7186 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
7187 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7188 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
7189 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
7190 return (int64_t)ret_conv;
7193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7194 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7195 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7196 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7197 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7198 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7202 typedef struct LDKFeeEstimator_JCalls {
7203 atomic_size_t refcnt;
7206 jmethodID get_est_sat_per_1000_weight_meth;
7207 } LDKFeeEstimator_JCalls;
7208 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7209 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7210 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7212 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7213 if (get_jenv_res == JNI_EDETACHED) {
7214 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7216 DO_ASSERT(get_jenv_res == JNI_OK);
7218 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7219 if (get_jenv_res == JNI_EDETACHED) {
7220 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7225 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7226 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7228 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7229 if (get_jenv_res == JNI_EDETACHED) {
7230 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7232 DO_ASSERT(get_jenv_res == JNI_OK);
7234 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
7235 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7237 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
7238 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7239 (*env)->ExceptionDescribe(env);
7240 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
7242 if (get_jenv_res == JNI_EDETACHED) {
7243 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7247 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7248 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7249 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7251 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
7252 jclass c = (*env)->GetObjectClass(env, o);
7254 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7255 atomic_init(&calls->refcnt, 1);
7256 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7257 calls->o = (*env)->NewWeakGlobalRef(env, o);
7258 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
7259 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
7261 LDKFeeEstimator ret = {
7262 .this_arg = (void*) calls,
7263 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7264 .free = LDKFeeEstimator_JCalls_free,
7268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
7269 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7270 *res_ptr = LDKFeeEstimator_init(env, clz, o);
7271 return (uint64_t)res_ptr;
7273 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) {
7274 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7275 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7276 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7277 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
7278 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7282 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7283 return ThirtyTwoBytes_clone(&owner->a);
7285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7286 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7287 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
7292 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7296 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7297 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7298 int64_t ret_ref = 0;
7299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7302 ret_ref = (uintptr_t)ret_var.inner & ~1;
7306 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7307 CHECK(owner->result_ok);
7308 return &*owner->contents.result;
7310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7311 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7312 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
7316 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7317 CHECK(!owner->result_ok);
7318 return DecodeError_clone(&*owner->contents.err);
7320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7321 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7322 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7323 int64_t ret_ref = 0;
7324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7327 ret_ref = (uintptr_t)ret_var.inner;
7328 if (ret_var.is_owned) {
7334 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7335 CHECK(owner->result_ok);
7336 return ChannelConfig_clone(&*owner->contents.result);
7338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7339 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7340 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7341 int64_t ret_ref = 0;
7342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7345 ret_ref = (uintptr_t)ret_var.inner;
7346 if (ret_var.is_owned) {
7352 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7353 CHECK(!owner->result_ok);
7354 return DecodeError_clone(&*owner->contents.err);
7356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7357 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7358 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7359 int64_t ret_ref = 0;
7360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7363 ret_ref = (uintptr_t)ret_var.inner;
7364 if (ret_var.is_owned) {
7370 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7371 CHECK(owner->result_ok);
7372 return OutPoint_clone(&*owner->contents.result);
7374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7375 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7376 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7377 int64_t ret_ref = 0;
7378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7381 ret_ref = (uintptr_t)ret_var.inner;
7382 if (ret_var.is_owned) {
7388 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7389 CHECK(!owner->result_ok);
7390 return DecodeError_clone(&*owner->contents.err);
7392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7393 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7394 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7395 int64_t ret_ref = 0;
7396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7399 ret_ref = (uintptr_t)ret_var.inner;
7400 if (ret_var.is_owned) {
7406 typedef struct LDKType_JCalls {
7407 atomic_size_t refcnt;
7410 jmethodID type_id_meth;
7411 jmethodID debug_str_meth;
7412 jmethodID write_meth;
7414 static void LDKType_JCalls_free(void* this_arg) {
7415 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7416 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7418 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7419 if (get_jenv_res == JNI_EDETACHED) {
7420 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7422 DO_ASSERT(get_jenv_res == JNI_OK);
7424 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7425 if (get_jenv_res == JNI_EDETACHED) {
7426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7431 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7432 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7435 if (get_jenv_res == JNI_EDETACHED) {
7436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7438 DO_ASSERT(get_jenv_res == JNI_OK);
7440 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7442 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
7443 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7444 (*env)->ExceptionDescribe(env);
7445 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
7447 if (get_jenv_res == JNI_EDETACHED) {
7448 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7452 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7453 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7455 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7456 if (get_jenv_res == JNI_EDETACHED) {
7457 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7459 DO_ASSERT(get_jenv_res == JNI_OK);
7461 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7463 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
7464 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7465 (*env)->ExceptionDescribe(env);
7466 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
7468 LDKStr ret_conv = java_to_owned_str(env, ret);
7469 if (get_jenv_res == JNI_EDETACHED) {
7470 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7474 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7475 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7477 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7478 if (get_jenv_res == JNI_EDETACHED) {
7479 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7481 DO_ASSERT(get_jenv_res == JNI_OK);
7483 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7485 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
7486 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7487 (*env)->ExceptionDescribe(env);
7488 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
7490 LDKCVec_u8Z ret_ref;
7491 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7492 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7493 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7494 if (get_jenv_res == JNI_EDETACHED) {
7495 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7499 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7500 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7501 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7503 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7504 jclass c = (*env)->GetObjectClass(env, o);
7506 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7507 atomic_init(&calls->refcnt, 1);
7508 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7509 calls->o = (*env)->NewWeakGlobalRef(env, o);
7510 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7511 CHECK(calls->type_id_meth != NULL);
7512 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7513 CHECK(calls->debug_str_meth != NULL);
7514 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7515 CHECK(calls->write_meth != NULL);
7518 .this_arg = (void*) calls,
7519 .type_id = type_id_LDKType_jcall,
7520 .debug_str = debug_str_LDKType_jcall,
7521 .write = write_LDKType_jcall,
7522 .cloned = LDKType_JCalls_cloned,
7523 .free = LDKType_JCalls_free,
7527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7528 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7529 *res_ptr = LDKType_init(env, clz, o);
7530 return (uint64_t)res_ptr;
7532 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7533 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7534 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7535 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7536 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7540 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7541 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7542 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7543 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7544 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7545 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7551 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7552 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7553 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7554 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7555 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7556 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7557 CVec_u8Z_free(ret_var);
7561 static jclass LDKCOption_TypeZ_Some_class = NULL;
7562 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7563 static jclass LDKCOption_TypeZ_None_class = NULL;
7564 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7566 LDKCOption_TypeZ_Some_class =
7567 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7568 CHECK(LDKCOption_TypeZ_Some_class != NULL);
7569 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7570 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7571 LDKCOption_TypeZ_None_class =
7572 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7573 CHECK(LDKCOption_TypeZ_None_class != NULL);
7574 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7575 CHECK(LDKCOption_TypeZ_None_meth != NULL);
7577 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7578 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
7580 case LDKCOption_TypeZ_Some: {
7581 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7582 *some_ret = Type_clone(&obj->some);
7583 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
7585 case LDKCOption_TypeZ_None: {
7586 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7591 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7592 CHECK(owner->result_ok);
7593 return COption_TypeZ_clone(&*owner->contents.result);
7595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7596 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7597 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7598 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7599 int64_t ret_ref = (uintptr_t)ret_copy;
7603 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7604 CHECK(!owner->result_ok);
7605 return DecodeError_clone(&*owner->contents.err);
7607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7608 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7609 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7610 int64_t ret_ref = 0;
7611 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7612 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7614 ret_ref = (uintptr_t)ret_var.inner;
7615 if (ret_var.is_owned) {
7621 static jclass LDKPaymentError_Invoice_class = NULL;
7622 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7623 static jclass LDKPaymentError_Routing_class = NULL;
7624 static jmethodID LDKPaymentError_Routing_meth = NULL;
7625 static jclass LDKPaymentError_Sending_class = NULL;
7626 static jmethodID LDKPaymentError_Sending_meth = NULL;
7627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7628 LDKPaymentError_Invoice_class =
7629 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7630 CHECK(LDKPaymentError_Invoice_class != NULL);
7631 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7632 CHECK(LDKPaymentError_Invoice_meth != NULL);
7633 LDKPaymentError_Routing_class =
7634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7635 CHECK(LDKPaymentError_Routing_class != NULL);
7636 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7637 CHECK(LDKPaymentError_Routing_meth != NULL);
7638 LDKPaymentError_Sending_class =
7639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7640 CHECK(LDKPaymentError_Sending_class != NULL);
7641 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7642 CHECK(LDKPaymentError_Sending_meth != NULL);
7644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7645 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
7647 case LDKPaymentError_Invoice: {
7648 LDKStr invoice_str = obj->invoice;
7649 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7650 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7652 case LDKPaymentError_Routing: {
7653 LDKLightningError routing_var = obj->routing;
7654 int64_t routing_ref = 0;
7655 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7656 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7657 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7658 routing_ref = (uintptr_t)routing_var.inner & ~1;
7659 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7661 case LDKPaymentError_Sending: {
7662 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
7663 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7668 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7669 CHECK(owner->result_ok);
7670 return ThirtyTwoBytes_clone(&*owner->contents.result);
7672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7673 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7674 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7675 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7679 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7680 CHECK(!owner->result_ok);
7681 return PaymentError_clone(&*owner->contents.err);
7683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7684 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7685 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7686 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7687 int64_t ret_ref = (uintptr_t)ret_copy;
7691 static jclass LDKParseError_Bech32Error_class = NULL;
7692 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7693 static jclass LDKParseError_ParseAmountError_class = NULL;
7694 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7695 static jclass LDKParseError_MalformedSignature_class = NULL;
7696 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7697 static jclass LDKParseError_BadPrefix_class = NULL;
7698 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7699 static jclass LDKParseError_UnknownCurrency_class = NULL;
7700 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7701 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7702 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7703 static jclass LDKParseError_MalformedHRP_class = NULL;
7704 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7705 static jclass LDKParseError_TooShortDataPart_class = NULL;
7706 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7707 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7708 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7709 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7710 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7711 static jclass LDKParseError_PaddingError_class = NULL;
7712 static jmethodID LDKParseError_PaddingError_meth = NULL;
7713 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7714 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7715 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7716 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7717 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7718 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7719 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7720 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7721 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7722 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7723 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7724 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7725 static jclass LDKParseError_Skip_class = NULL;
7726 static jmethodID LDKParseError_Skip_meth = NULL;
7727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7728 LDKParseError_Bech32Error_class =
7729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7730 CHECK(LDKParseError_Bech32Error_class != NULL);
7731 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7732 CHECK(LDKParseError_Bech32Error_meth != NULL);
7733 LDKParseError_ParseAmountError_class =
7734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7735 CHECK(LDKParseError_ParseAmountError_class != NULL);
7736 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7737 CHECK(LDKParseError_ParseAmountError_meth != NULL);
7738 LDKParseError_MalformedSignature_class =
7739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7740 CHECK(LDKParseError_MalformedSignature_class != NULL);
7741 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7742 CHECK(LDKParseError_MalformedSignature_meth != NULL);
7743 LDKParseError_BadPrefix_class =
7744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7745 CHECK(LDKParseError_BadPrefix_class != NULL);
7746 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7747 CHECK(LDKParseError_BadPrefix_meth != NULL);
7748 LDKParseError_UnknownCurrency_class =
7749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7750 CHECK(LDKParseError_UnknownCurrency_class != NULL);
7751 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7752 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7753 LDKParseError_UnknownSiPrefix_class =
7754 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7755 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7756 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7757 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7758 LDKParseError_MalformedHRP_class =
7759 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7760 CHECK(LDKParseError_MalformedHRP_class != NULL);
7761 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7762 CHECK(LDKParseError_MalformedHRP_meth != NULL);
7763 LDKParseError_TooShortDataPart_class =
7764 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7765 CHECK(LDKParseError_TooShortDataPart_class != NULL);
7766 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7767 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7768 LDKParseError_UnexpectedEndOfTaggedFields_class =
7769 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7770 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7771 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7772 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7773 LDKParseError_DescriptionDecodeError_class =
7774 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7775 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7776 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7777 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7778 LDKParseError_PaddingError_class =
7779 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7780 CHECK(LDKParseError_PaddingError_class != NULL);
7781 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7782 CHECK(LDKParseError_PaddingError_meth != NULL);
7783 LDKParseError_IntegerOverflowError_class =
7784 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7785 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7786 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7787 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7788 LDKParseError_InvalidSegWitProgramLength_class =
7789 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7790 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7791 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7792 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7793 LDKParseError_InvalidPubKeyHashLength_class =
7794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7795 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7796 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7797 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7798 LDKParseError_InvalidScriptHashLength_class =
7799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7800 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7801 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7802 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7803 LDKParseError_InvalidRecoveryId_class =
7804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7805 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7806 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7807 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7808 LDKParseError_InvalidSliceLength_class =
7809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7810 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7811 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7812 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7813 LDKParseError_Skip_class =
7814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7815 CHECK(LDKParseError_Skip_class != NULL);
7816 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7817 CHECK(LDKParseError_Skip_meth != NULL);
7819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7820 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
7822 case LDKParseError_Bech32Error: {
7823 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
7824 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7826 case LDKParseError_ParseAmountError: {
7827 /*obj->parse_amount_error*/
7828 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7830 case LDKParseError_MalformedSignature: {
7831 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7832 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7834 case LDKParseError_BadPrefix: {
7835 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7837 case LDKParseError_UnknownCurrency: {
7838 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7840 case LDKParseError_UnknownSiPrefix: {
7841 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7843 case LDKParseError_MalformedHRP: {
7844 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7846 case LDKParseError_TooShortDataPart: {
7847 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7849 case LDKParseError_UnexpectedEndOfTaggedFields: {
7850 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7852 case LDKParseError_DescriptionDecodeError: {
7853 /*obj->description_decode_error*/
7854 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7856 case LDKParseError_PaddingError: {
7857 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7859 case LDKParseError_IntegerOverflowError: {
7860 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7862 case LDKParseError_InvalidSegWitProgramLength: {
7863 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7865 case LDKParseError_InvalidPubKeyHashLength: {
7866 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7868 case LDKParseError_InvalidScriptHashLength: {
7869 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7871 case LDKParseError_InvalidRecoveryId: {
7872 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7874 case LDKParseError_InvalidSliceLength: {
7875 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7876 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7877 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7879 case LDKParseError_Skip: {
7880 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7885 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7886 CHECK(owner->result_ok);
7887 return SiPrefix_clone(&*owner->contents.result);
7889 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7890 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7891 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7895 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7896 CHECK(!owner->result_ok);
7897 return ParseError_clone(&*owner->contents.err);
7899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7900 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7901 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7902 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7903 int64_t ret_ref = (uintptr_t)ret_copy;
7907 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7908 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7909 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7910 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7912 LDKParseOrSemanticError_ParseError_class =
7913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7914 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7915 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7916 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7917 LDKParseOrSemanticError_SemanticError_class =
7918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7919 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7920 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7921 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7923 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7924 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
7926 case LDKParseOrSemanticError_ParseError: {
7927 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
7928 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7930 case LDKParseOrSemanticError_SemanticError: {
7931 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7932 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7937 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7938 CHECK(owner->result_ok);
7939 return Invoice_clone(&*owner->contents.result);
7941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7942 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7943 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7944 int64_t ret_ref = 0;
7945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7948 ret_ref = (uintptr_t)ret_var.inner;
7949 if (ret_var.is_owned) {
7955 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7956 CHECK(!owner->result_ok);
7957 return ParseOrSemanticError_clone(&*owner->contents.err);
7959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7960 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7961 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7962 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7963 int64_t ret_ref = (uintptr_t)ret_copy;
7967 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7968 CHECK(owner->result_ok);
7969 return SignedRawInvoice_clone(&*owner->contents.result);
7971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7972 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7973 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7974 int64_t ret_ref = 0;
7975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7978 ret_ref = (uintptr_t)ret_var.inner;
7979 if (ret_var.is_owned) {
7985 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7986 CHECK(!owner->result_ok);
7987 return ParseError_clone(&*owner->contents.err);
7989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7990 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7991 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7992 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7993 int64_t ret_ref = (uintptr_t)ret_copy;
7997 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7998 return RawInvoice_clone(&owner->a);
8000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8001 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8002 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
8003 int64_t ret_ref = 0;
8004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8007 ret_ref = (uintptr_t)ret_var.inner;
8008 if (ret_var.is_owned) {
8014 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8015 return ThirtyTwoBytes_clone(&owner->b);
8017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8018 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8019 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
8024 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8025 return InvoiceSignature_clone(&owner->c);
8027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8028 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8029 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(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 LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8042 CHECK(owner->result_ok);
8043 return PayeePubKey_clone(&*owner->contents.result);
8045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8046 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
8047 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(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 enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8060 CHECK(!owner->result_ok);
8061 return *owner->contents.err;
8063 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8064 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
8065 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
8069 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
8070 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
8071 for (size_t i = 0; i < ret.datalen; i++) {
8072 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
8076 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8077 CHECK(owner->result_ok);
8078 return PositiveTimestamp_clone(&*owner->contents.result);
8080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8081 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
8082 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
8083 int64_t ret_ref = 0;
8084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8087 ret_ref = (uintptr_t)ret_var.inner;
8088 if (ret_var.is_owned) {
8094 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8095 CHECK(!owner->result_ok);
8096 return CreationError_clone(&*owner->contents.err);
8098 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8099 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
8100 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
8104 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8105 CHECK(owner->result_ok);
8106 return *owner->contents.result;
8108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8109 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
8110 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
8113 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8114 CHECK(!owner->result_ok);
8115 return SemanticError_clone(&*owner->contents.err);
8117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8118 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
8119 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
8123 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8124 CHECK(owner->result_ok);
8125 return Invoice_clone(&*owner->contents.result);
8127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8128 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
8129 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
8130 int64_t ret_ref = 0;
8131 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8132 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8134 ret_ref = (uintptr_t)ret_var.inner;
8135 if (ret_var.is_owned) {
8141 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8142 CHECK(!owner->result_ok);
8143 return SemanticError_clone(&*owner->contents.err);
8145 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8146 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
8147 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
8151 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8152 CHECK(owner->result_ok);
8153 return Description_clone(&*owner->contents.result);
8155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8156 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
8157 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
8158 int64_t ret_ref = 0;
8159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8162 ret_ref = (uintptr_t)ret_var.inner;
8163 if (ret_var.is_owned) {
8169 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8170 CHECK(!owner->result_ok);
8171 return CreationError_clone(&*owner->contents.err);
8173 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8174 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
8175 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
8179 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8180 CHECK(owner->result_ok);
8181 return PrivateRoute_clone(&*owner->contents.result);
8183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8184 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
8185 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
8186 int64_t ret_ref = 0;
8187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8190 ret_ref = (uintptr_t)ret_var.inner;
8191 if (ret_var.is_owned) {
8197 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8198 CHECK(!owner->result_ok);
8199 return CreationError_clone(&*owner->contents.err);
8201 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8202 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
8203 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
8207 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8208 CHECK(owner->result_ok);
8209 return *owner->contents.result;
8211 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8212 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8213 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
8214 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8218 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8219 CHECK(!owner->result_ok);
8220 return *owner->contents.err;
8222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8223 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8224 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
8228 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8229 CHECK(owner->result_ok);
8230 return ChannelMonitorUpdate_clone(&*owner->contents.result);
8232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8233 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8234 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8235 int64_t ret_ref = 0;
8236 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8237 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8239 ret_ref = (uintptr_t)ret_var.inner;
8240 if (ret_var.is_owned) {
8246 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8247 CHECK(!owner->result_ok);
8248 return DecodeError_clone(&*owner->contents.err);
8250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8251 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8252 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8253 int64_t ret_ref = 0;
8254 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8255 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8257 ret_ref = (uintptr_t)ret_var.inner;
8258 if (ret_var.is_owned) {
8264 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8265 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8266 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8267 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8269 LDKCOption_MonitorEventZ_Some_class =
8270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8271 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8272 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8273 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8274 LDKCOption_MonitorEventZ_None_class =
8275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8276 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8277 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8278 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8280 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8281 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
8283 case LDKCOption_MonitorEventZ_Some: {
8284 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8285 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8287 case LDKCOption_MonitorEventZ_None: {
8288 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8293 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8294 CHECK(owner->result_ok);
8295 return COption_MonitorEventZ_clone(&*owner->contents.result);
8297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8298 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8299 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8300 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8301 int64_t ret_ref = (uintptr_t)ret_copy;
8305 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8306 CHECK(!owner->result_ok);
8307 return DecodeError_clone(&*owner->contents.err);
8309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8310 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8311 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8312 int64_t ret_ref = 0;
8313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8316 ret_ref = (uintptr_t)ret_var.inner;
8317 if (ret_var.is_owned) {
8323 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8324 CHECK(owner->result_ok);
8325 return HTLCUpdate_clone(&*owner->contents.result);
8327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8328 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8329 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8330 int64_t ret_ref = 0;
8331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8334 ret_ref = (uintptr_t)ret_var.inner;
8335 if (ret_var.is_owned) {
8341 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8342 CHECK(!owner->result_ok);
8343 return DecodeError_clone(&*owner->contents.err);
8345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8346 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8347 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8348 int64_t ret_ref = 0;
8349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8352 ret_ref = (uintptr_t)ret_var.inner;
8353 if (ret_var.is_owned) {
8359 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8360 return OutPoint_clone(&owner->a);
8362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8363 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8364 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8365 int64_t ret_ref = 0;
8366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8369 ret_ref = (uintptr_t)ret_var.inner;
8370 if (ret_var.is_owned) {
8376 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8377 return CVec_u8Z_clone(&owner->b);
8379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8380 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8381 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8382 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8383 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8384 CVec_u8Z_free(ret_var);
8388 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8391 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8392 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8393 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8397 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8398 return CVec_u8Z_clone(&owner->b);
8400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8401 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8402 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8403 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8404 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8405 CVec_u8Z_free(ret_var);
8409 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8410 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8411 for (size_t i = 0; i < ret.datalen; i++) {
8412 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8416 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8417 return ThirtyTwoBytes_clone(&owner->a);
8419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8420 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8421 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8422 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8426 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8427 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8429 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8430 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8431 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8432 int64_tArray ret_arr = NULL;
8433 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8434 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8435 for (size_t v = 0; v < ret_var.datalen; v++) {
8436 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8437 *ret_conv_21_conv = ret_var.data[v];
8438 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
8440 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8445 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8446 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 };
8447 for (size_t i = 0; i < ret.datalen; i++) {
8448 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8452 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
8453 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
8454 for (size_t i = 0; i < ret.datalen; i++) {
8455 ret.data[i] = Event_clone(&orig->data[i]);
8459 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8462 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8463 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8464 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8468 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8469 return TxOut_clone(&owner->b);
8471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8472 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8473 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8474 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8475 return (int64_t)ret_ref;
8478 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8479 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8480 for (size_t i = 0; i < ret.datalen; i++) {
8481 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8485 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8486 return ThirtyTwoBytes_clone(&owner->a);
8488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8489 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8490 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8495 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8496 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8498 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8499 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8500 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8501 int64_tArray ret_arr = NULL;
8502 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8503 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8504 for (size_t u = 0; u < ret_var.datalen; u++) {
8505 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8506 *ret_conv_20_conv = ret_var.data[u];
8507 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
8509 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8514 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8515 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 };
8516 for (size_t i = 0; i < ret.datalen; i++) {
8517 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8521 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8522 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8523 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8524 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8525 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8526 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8527 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
8528 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
8529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8530 LDKBalance_ClaimableOnChannelClose_class =
8531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8532 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8533 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8534 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8535 LDKBalance_ClaimableAwaitingConfirmations_class =
8536 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8537 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8538 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8539 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8540 LDKBalance_ContentiousClaimable_class =
8541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8542 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8543 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
8544 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8545 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
8546 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
8547 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
8548 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
8549 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
8551 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8552 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
8554 case LDKBalance_ClaimableOnChannelClose: {
8555 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8556 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8558 case LDKBalance_ClaimableAwaitingConfirmations: {
8559 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8560 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8561 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8563 case LDKBalance_ContentiousClaimable: {
8564 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8565 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8566 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8568 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8569 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8570 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8571 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8576 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8577 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8578 for (size_t i = 0; i < ret.datalen; i++) {
8579 ret.data[i] = Balance_clone(&orig->data[i]);
8583 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8584 CHECK(owner->result_ok);
8585 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8588 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8589 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8590 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8591 return ((int64_t)ret_conv);
8594 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8595 CHECK(!owner->result_ok);
8596 return DecodeError_clone(&*owner->contents.err);
8598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8599 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8600 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8601 int64_t ret_ref = 0;
8602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8605 ret_ref = (uintptr_t)ret_var.inner;
8606 if (ret_var.is_owned) {
8612 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8616 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8617 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8622 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8623 return Type_clone(&owner->b);
8625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8626 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8627 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8628 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8629 return (int64_t)ret_ret;
8632 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8633 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8634 for (size_t i = 0; i < ret.datalen; i++) {
8635 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8639 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8640 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8641 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8642 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8644 LDKCOption_NetAddressZ_Some_class =
8645 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8646 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8647 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8648 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8649 LDKCOption_NetAddressZ_None_class =
8650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8651 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8652 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8653 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8655 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8656 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
8658 case LDKCOption_NetAddressZ_Some: {
8659 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8660 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8662 case LDKCOption_NetAddressZ_None: {
8663 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8668 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8669 CHECK(owner->result_ok);
8670 return CVec_u8Z_clone(&*owner->contents.result);
8672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8673 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8674 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8675 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8676 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8677 CVec_u8Z_free(ret_var);
8681 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8682 CHECK(!owner->result_ok);
8683 return PeerHandleError_clone(&*owner->contents.err);
8685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8686 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8687 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8688 int64_t ret_ref = 0;
8689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8692 ret_ref = (uintptr_t)ret_var.inner;
8693 if (ret_var.is_owned) {
8699 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8700 CHECK(owner->result_ok);
8701 return *owner->contents.result;
8703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8704 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8705 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8708 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8709 CHECK(!owner->result_ok);
8710 return PeerHandleError_clone(&*owner->contents.err);
8712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8713 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8714 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8715 int64_t ret_ref = 0;
8716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8719 ret_ref = (uintptr_t)ret_var.inner;
8720 if (ret_var.is_owned) {
8726 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8727 CHECK(owner->result_ok);
8728 return *owner->contents.result;
8730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8731 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8732 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8736 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8737 CHECK(!owner->result_ok);
8738 return PeerHandleError_clone(&*owner->contents.err);
8740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8741 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8742 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_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 jclass LDKGraphSyncError_DecodeError_class = NULL;
8755 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8756 static jclass LDKGraphSyncError_LightningError_class = NULL;
8757 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8759 LDKGraphSyncError_DecodeError_class =
8760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8761 CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8762 LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8763 CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8764 LDKGraphSyncError_LightningError_class =
8765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8766 CHECK(LDKGraphSyncError_LightningError_class != NULL);
8767 LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8768 CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8770 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8771 LDKGraphSyncError *obj = (LDKGraphSyncError*)(ptr & ~1);
8773 case LDKGraphSyncError_DecodeError: {
8774 LDKDecodeError decode_error_var = obj->decode_error;
8775 int64_t decode_error_ref = 0;
8776 CHECK((((uintptr_t)decode_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8777 CHECK((((uintptr_t)&decode_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8778 CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8779 decode_error_ref = (uintptr_t)decode_error_var.inner & ~1;
8780 return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8782 case LDKGraphSyncError_LightningError: {
8783 LDKLightningError lightning_error_var = obj->lightning_error;
8784 int64_t lightning_error_ref = 0;
8785 CHECK((((uintptr_t)lightning_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8786 CHECK((((uintptr_t)&lightning_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8787 CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8788 lightning_error_ref = (uintptr_t)lightning_error_var.inner & ~1;
8789 return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8794 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8795 CHECK(owner->result_ok);
8796 return *owner->contents.result;
8798 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8799 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8800 int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8804 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8805 CHECK(!owner->result_ok);
8806 return GraphSyncError_clone(&*owner->contents.err);
8808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8809 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8810 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8811 *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8812 int64_t ret_ref = (uintptr_t)ret_copy;
8816 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8817 CHECK(owner->result_ok);
8818 return NetAddress_clone(&*owner->contents.result);
8820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8821 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8822 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8823 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8824 int64_t ret_ref = (uintptr_t)ret_copy;
8828 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8829 CHECK(!owner->result_ok);
8830 return DecodeError_clone(&*owner->contents.err);
8832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8833 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8834 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8835 int64_t ret_ref = 0;
8836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8839 ret_ref = (uintptr_t)ret_var.inner;
8840 if (ret_var.is_owned) {
8846 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8847 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8848 for (size_t i = 0; i < ret.datalen; i++) {
8849 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8853 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8854 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8855 for (size_t i = 0; i < ret.datalen; i++) {
8856 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8860 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8861 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8862 for (size_t i = 0; i < ret.datalen; i++) {
8863 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8867 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8868 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8869 for (size_t i = 0; i < ret.datalen; i++) {
8870 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8874 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8875 CHECK(owner->result_ok);
8876 return AcceptChannel_clone(&*owner->contents.result);
8878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8879 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8880 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8881 int64_t ret_ref = 0;
8882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8885 ret_ref = (uintptr_t)ret_var.inner;
8886 if (ret_var.is_owned) {
8892 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8893 CHECK(!owner->result_ok);
8894 return DecodeError_clone(&*owner->contents.err);
8896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8897 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8898 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8899 int64_t ret_ref = 0;
8900 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8901 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8903 ret_ref = (uintptr_t)ret_var.inner;
8904 if (ret_var.is_owned) {
8910 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8911 CHECK(owner->result_ok);
8912 return AnnouncementSignatures_clone(&*owner->contents.result);
8914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8915 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8916 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8917 int64_t ret_ref = 0;
8918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8921 ret_ref = (uintptr_t)ret_var.inner;
8922 if (ret_var.is_owned) {
8928 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8929 CHECK(!owner->result_ok);
8930 return DecodeError_clone(&*owner->contents.err);
8932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8933 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8934 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8935 int64_t ret_ref = 0;
8936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8939 ret_ref = (uintptr_t)ret_var.inner;
8940 if (ret_var.is_owned) {
8946 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8947 CHECK(owner->result_ok);
8948 return ChannelReestablish_clone(&*owner->contents.result);
8950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8951 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8952 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8953 int64_t ret_ref = 0;
8954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8957 ret_ref = (uintptr_t)ret_var.inner;
8958 if (ret_var.is_owned) {
8964 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8965 CHECK(!owner->result_ok);
8966 return DecodeError_clone(&*owner->contents.err);
8968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8969 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8970 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8971 int64_t ret_ref = 0;
8972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8975 ret_ref = (uintptr_t)ret_var.inner;
8976 if (ret_var.is_owned) {
8982 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8983 CHECK(owner->result_ok);
8984 return ClosingSigned_clone(&*owner->contents.result);
8986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8987 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8988 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8989 int64_t ret_ref = 0;
8990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8993 ret_ref = (uintptr_t)ret_var.inner;
8994 if (ret_var.is_owned) {
9000 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9001 CHECK(!owner->result_ok);
9002 return DecodeError_clone(&*owner->contents.err);
9004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9005 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
9006 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9007 int64_t ret_ref = 0;
9008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9011 ret_ref = (uintptr_t)ret_var.inner;
9012 if (ret_var.is_owned) {
9018 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9019 CHECK(owner->result_ok);
9020 return ClosingSignedFeeRange_clone(&*owner->contents.result);
9022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9023 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
9024 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9025 int64_t ret_ref = 0;
9026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9029 ret_ref = (uintptr_t)ret_var.inner;
9030 if (ret_var.is_owned) {
9036 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9037 CHECK(!owner->result_ok);
9038 return DecodeError_clone(&*owner->contents.err);
9040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9041 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
9042 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9043 int64_t ret_ref = 0;
9044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9047 ret_ref = (uintptr_t)ret_var.inner;
9048 if (ret_var.is_owned) {
9054 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9055 CHECK(owner->result_ok);
9056 return CommitmentSigned_clone(&*owner->contents.result);
9058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9059 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
9060 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9061 int64_t ret_ref = 0;
9062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9065 ret_ref = (uintptr_t)ret_var.inner;
9066 if (ret_var.is_owned) {
9072 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9073 CHECK(!owner->result_ok);
9074 return DecodeError_clone(&*owner->contents.err);
9076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9077 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
9078 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9079 int64_t ret_ref = 0;
9080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9083 ret_ref = (uintptr_t)ret_var.inner;
9084 if (ret_var.is_owned) {
9090 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9091 CHECK(owner->result_ok);
9092 return FundingCreated_clone(&*owner->contents.result);
9094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9095 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
9096 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9097 int64_t ret_ref = 0;
9098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9101 ret_ref = (uintptr_t)ret_var.inner;
9102 if (ret_var.is_owned) {
9108 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9109 CHECK(!owner->result_ok);
9110 return DecodeError_clone(&*owner->contents.err);
9112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9113 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
9114 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9115 int64_t ret_ref = 0;
9116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9119 ret_ref = (uintptr_t)ret_var.inner;
9120 if (ret_var.is_owned) {
9126 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9127 CHECK(owner->result_ok);
9128 return FundingSigned_clone(&*owner->contents.result);
9130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9131 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
9132 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9133 int64_t ret_ref = 0;
9134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9137 ret_ref = (uintptr_t)ret_var.inner;
9138 if (ret_var.is_owned) {
9144 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9145 CHECK(!owner->result_ok);
9146 return DecodeError_clone(&*owner->contents.err);
9148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9149 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
9150 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9151 int64_t ret_ref = 0;
9152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9155 ret_ref = (uintptr_t)ret_var.inner;
9156 if (ret_var.is_owned) {
9162 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9163 CHECK(owner->result_ok);
9164 return ChannelReady_clone(&*owner->contents.result);
9166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9167 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
9168 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9169 int64_t ret_ref = 0;
9170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9173 ret_ref = (uintptr_t)ret_var.inner;
9174 if (ret_var.is_owned) {
9180 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9181 CHECK(!owner->result_ok);
9182 return DecodeError_clone(&*owner->contents.err);
9184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9185 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
9186 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9187 int64_t ret_ref = 0;
9188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9191 ret_ref = (uintptr_t)ret_var.inner;
9192 if (ret_var.is_owned) {
9198 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9199 CHECK(owner->result_ok);
9200 return Init_clone(&*owner->contents.result);
9202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9203 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9204 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9205 int64_t ret_ref = 0;
9206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9209 ret_ref = (uintptr_t)ret_var.inner;
9210 if (ret_var.is_owned) {
9216 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9217 CHECK(!owner->result_ok);
9218 return DecodeError_clone(&*owner->contents.err);
9220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9221 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9222 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
9223 int64_t ret_ref = 0;
9224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9227 ret_ref = (uintptr_t)ret_var.inner;
9228 if (ret_var.is_owned) {
9234 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9235 CHECK(owner->result_ok);
9236 return OpenChannel_clone(&*owner->contents.result);
9238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9239 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9240 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9241 int64_t ret_ref = 0;
9242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9245 ret_ref = (uintptr_t)ret_var.inner;
9246 if (ret_var.is_owned) {
9252 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9253 CHECK(!owner->result_ok);
9254 return DecodeError_clone(&*owner->contents.err);
9256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9257 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9258 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9259 int64_t ret_ref = 0;
9260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9263 ret_ref = (uintptr_t)ret_var.inner;
9264 if (ret_var.is_owned) {
9270 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9271 CHECK(owner->result_ok);
9272 return RevokeAndACK_clone(&*owner->contents.result);
9274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9275 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9276 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9277 int64_t ret_ref = 0;
9278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9281 ret_ref = (uintptr_t)ret_var.inner;
9282 if (ret_var.is_owned) {
9288 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9289 CHECK(!owner->result_ok);
9290 return DecodeError_clone(&*owner->contents.err);
9292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9293 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9294 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9295 int64_t ret_ref = 0;
9296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9299 ret_ref = (uintptr_t)ret_var.inner;
9300 if (ret_var.is_owned) {
9306 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9307 CHECK(owner->result_ok);
9308 return Shutdown_clone(&*owner->contents.result);
9310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9311 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9312 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9313 int64_t ret_ref = 0;
9314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9317 ret_ref = (uintptr_t)ret_var.inner;
9318 if (ret_var.is_owned) {
9324 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9325 CHECK(!owner->result_ok);
9326 return DecodeError_clone(&*owner->contents.err);
9328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9329 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9330 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9331 int64_t ret_ref = 0;
9332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9335 ret_ref = (uintptr_t)ret_var.inner;
9336 if (ret_var.is_owned) {
9342 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9343 CHECK(owner->result_ok);
9344 return UpdateFailHTLC_clone(&*owner->contents.result);
9346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9347 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9348 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9349 int64_t ret_ref = 0;
9350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9353 ret_ref = (uintptr_t)ret_var.inner;
9354 if (ret_var.is_owned) {
9360 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9361 CHECK(!owner->result_ok);
9362 return DecodeError_clone(&*owner->contents.err);
9364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9365 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9366 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9367 int64_t ret_ref = 0;
9368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9371 ret_ref = (uintptr_t)ret_var.inner;
9372 if (ret_var.is_owned) {
9378 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9379 CHECK(owner->result_ok);
9380 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
9382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9383 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9384 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9385 int64_t ret_ref = 0;
9386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9389 ret_ref = (uintptr_t)ret_var.inner;
9390 if (ret_var.is_owned) {
9396 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9397 CHECK(!owner->result_ok);
9398 return DecodeError_clone(&*owner->contents.err);
9400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9401 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9402 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9403 int64_t ret_ref = 0;
9404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9407 ret_ref = (uintptr_t)ret_var.inner;
9408 if (ret_var.is_owned) {
9414 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9415 CHECK(owner->result_ok);
9416 return UpdateFee_clone(&*owner->contents.result);
9418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9419 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9420 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9421 int64_t ret_ref = 0;
9422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9425 ret_ref = (uintptr_t)ret_var.inner;
9426 if (ret_var.is_owned) {
9432 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9433 CHECK(!owner->result_ok);
9434 return DecodeError_clone(&*owner->contents.err);
9436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9437 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9438 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9439 int64_t ret_ref = 0;
9440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9443 ret_ref = (uintptr_t)ret_var.inner;
9444 if (ret_var.is_owned) {
9450 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9451 CHECK(owner->result_ok);
9452 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9455 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9456 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9457 int64_t ret_ref = 0;
9458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9461 ret_ref = (uintptr_t)ret_var.inner;
9462 if (ret_var.is_owned) {
9468 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9469 CHECK(!owner->result_ok);
9470 return DecodeError_clone(&*owner->contents.err);
9472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9473 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9474 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9475 int64_t ret_ref = 0;
9476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9479 ret_ref = (uintptr_t)ret_var.inner;
9480 if (ret_var.is_owned) {
9486 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9487 CHECK(owner->result_ok);
9488 return UpdateAddHTLC_clone(&*owner->contents.result);
9490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9491 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9492 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9493 int64_t ret_ref = 0;
9494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9497 ret_ref = (uintptr_t)ret_var.inner;
9498 if (ret_var.is_owned) {
9504 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9505 CHECK(!owner->result_ok);
9506 return DecodeError_clone(&*owner->contents.err);
9508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9509 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9510 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9511 int64_t ret_ref = 0;
9512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9515 ret_ref = (uintptr_t)ret_var.inner;
9516 if (ret_var.is_owned) {
9522 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9523 CHECK(owner->result_ok);
9524 return Ping_clone(&*owner->contents.result);
9526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9527 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9528 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9529 int64_t ret_ref = 0;
9530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9533 ret_ref = (uintptr_t)ret_var.inner;
9534 if (ret_var.is_owned) {
9540 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9541 CHECK(!owner->result_ok);
9542 return DecodeError_clone(&*owner->contents.err);
9544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9545 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9546 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9547 int64_t ret_ref = 0;
9548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9551 ret_ref = (uintptr_t)ret_var.inner;
9552 if (ret_var.is_owned) {
9558 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9559 CHECK(owner->result_ok);
9560 return Pong_clone(&*owner->contents.result);
9562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9563 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9564 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9565 int64_t ret_ref = 0;
9566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9569 ret_ref = (uintptr_t)ret_var.inner;
9570 if (ret_var.is_owned) {
9576 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9577 CHECK(!owner->result_ok);
9578 return DecodeError_clone(&*owner->contents.err);
9580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9581 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9582 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9583 int64_t ret_ref = 0;
9584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9587 ret_ref = (uintptr_t)ret_var.inner;
9588 if (ret_var.is_owned) {
9594 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9595 CHECK(owner->result_ok);
9596 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9599 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9600 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9601 int64_t ret_ref = 0;
9602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9605 ret_ref = (uintptr_t)ret_var.inner;
9606 if (ret_var.is_owned) {
9612 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9613 CHECK(!owner->result_ok);
9614 return DecodeError_clone(&*owner->contents.err);
9616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9617 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9618 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9619 int64_t ret_ref = 0;
9620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9623 ret_ref = (uintptr_t)ret_var.inner;
9624 if (ret_var.is_owned) {
9630 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9631 CHECK(owner->result_ok);
9632 return ChannelAnnouncement_clone(&*owner->contents.result);
9634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9635 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9636 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9637 int64_t ret_ref = 0;
9638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9641 ret_ref = (uintptr_t)ret_var.inner;
9642 if (ret_var.is_owned) {
9648 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9649 CHECK(!owner->result_ok);
9650 return DecodeError_clone(&*owner->contents.err);
9652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9653 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9654 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9655 int64_t ret_ref = 0;
9656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9659 ret_ref = (uintptr_t)ret_var.inner;
9660 if (ret_var.is_owned) {
9666 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9667 CHECK(owner->result_ok);
9668 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9671 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9672 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9673 int64_t ret_ref = 0;
9674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9677 ret_ref = (uintptr_t)ret_var.inner;
9678 if (ret_var.is_owned) {
9684 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9685 CHECK(!owner->result_ok);
9686 return DecodeError_clone(&*owner->contents.err);
9688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9689 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9690 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9691 int64_t ret_ref = 0;
9692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9695 ret_ref = (uintptr_t)ret_var.inner;
9696 if (ret_var.is_owned) {
9702 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9703 CHECK(owner->result_ok);
9704 return ChannelUpdate_clone(&*owner->contents.result);
9706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9707 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9708 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9709 int64_t ret_ref = 0;
9710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9713 ret_ref = (uintptr_t)ret_var.inner;
9714 if (ret_var.is_owned) {
9720 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9721 CHECK(!owner->result_ok);
9722 return DecodeError_clone(&*owner->contents.err);
9724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9725 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9726 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9727 int64_t ret_ref = 0;
9728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9731 ret_ref = (uintptr_t)ret_var.inner;
9732 if (ret_var.is_owned) {
9738 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9739 CHECK(owner->result_ok);
9740 return ErrorMessage_clone(&*owner->contents.result);
9742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9743 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9744 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9745 int64_t ret_ref = 0;
9746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9749 ret_ref = (uintptr_t)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9757 CHECK(!owner->result_ok);
9758 return DecodeError_clone(&*owner->contents.err);
9760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9761 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9762 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9763 int64_t ret_ref = 0;
9764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9767 ret_ref = (uintptr_t)ret_var.inner;
9768 if (ret_var.is_owned) {
9774 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9775 CHECK(owner->result_ok);
9776 return WarningMessage_clone(&*owner->contents.result);
9778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9779 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9780 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9781 int64_t ret_ref = 0;
9782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9785 ret_ref = (uintptr_t)ret_var.inner;
9786 if (ret_var.is_owned) {
9792 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9793 CHECK(!owner->result_ok);
9794 return DecodeError_clone(&*owner->contents.err);
9796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9797 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9798 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9799 int64_t ret_ref = 0;
9800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9803 ret_ref = (uintptr_t)ret_var.inner;
9804 if (ret_var.is_owned) {
9810 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9811 CHECK(owner->result_ok);
9812 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9815 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9816 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9817 int64_t ret_ref = 0;
9818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9821 ret_ref = (uintptr_t)ret_var.inner;
9822 if (ret_var.is_owned) {
9828 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9829 CHECK(!owner->result_ok);
9830 return DecodeError_clone(&*owner->contents.err);
9832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9833 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9834 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9835 int64_t ret_ref = 0;
9836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9839 ret_ref = (uintptr_t)ret_var.inner;
9840 if (ret_var.is_owned) {
9846 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9847 CHECK(owner->result_ok);
9848 return NodeAnnouncement_clone(&*owner->contents.result);
9850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9851 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9852 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9853 int64_t ret_ref = 0;
9854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9857 ret_ref = (uintptr_t)ret_var.inner;
9858 if (ret_var.is_owned) {
9864 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9865 CHECK(!owner->result_ok);
9866 return DecodeError_clone(&*owner->contents.err);
9868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9869 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9870 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9871 int64_t ret_ref = 0;
9872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9875 ret_ref = (uintptr_t)ret_var.inner;
9876 if (ret_var.is_owned) {
9882 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9883 CHECK(owner->result_ok);
9884 return QueryShortChannelIds_clone(&*owner->contents.result);
9886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9887 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9888 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9889 int64_t ret_ref = 0;
9890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9893 ret_ref = (uintptr_t)ret_var.inner;
9894 if (ret_var.is_owned) {
9900 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9901 CHECK(!owner->result_ok);
9902 return DecodeError_clone(&*owner->contents.err);
9904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9905 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9906 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9907 int64_t ret_ref = 0;
9908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9911 ret_ref = (uintptr_t)ret_var.inner;
9912 if (ret_var.is_owned) {
9918 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9919 CHECK(owner->result_ok);
9920 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9923 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9924 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9925 int64_t ret_ref = 0;
9926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9929 ret_ref = (uintptr_t)ret_var.inner;
9930 if (ret_var.is_owned) {
9936 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9937 CHECK(!owner->result_ok);
9938 return DecodeError_clone(&*owner->contents.err);
9940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9941 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9942 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9943 int64_t ret_ref = 0;
9944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9947 ret_ref = (uintptr_t)ret_var.inner;
9948 if (ret_var.is_owned) {
9954 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9955 CHECK(owner->result_ok);
9956 return QueryChannelRange_clone(&*owner->contents.result);
9958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9959 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9960 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9961 int64_t ret_ref = 0;
9962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9965 ret_ref = (uintptr_t)ret_var.inner;
9966 if (ret_var.is_owned) {
9972 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9973 CHECK(!owner->result_ok);
9974 return DecodeError_clone(&*owner->contents.err);
9976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9977 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9978 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9979 int64_t ret_ref = 0;
9980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9983 ret_ref = (uintptr_t)ret_var.inner;
9984 if (ret_var.is_owned) {
9990 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9991 CHECK(owner->result_ok);
9992 return ReplyChannelRange_clone(&*owner->contents.result);
9994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9995 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9996 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9997 int64_t ret_ref = 0;
9998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10001 ret_ref = (uintptr_t)ret_var.inner;
10002 if (ret_var.is_owned) {
10008 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10009 CHECK(!owner->result_ok);
10010 return DecodeError_clone(&*owner->contents.err);
10012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10013 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
10014 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10015 int64_t ret_ref = 0;
10016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10019 ret_ref = (uintptr_t)ret_var.inner;
10020 if (ret_var.is_owned) {
10026 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10027 CHECK(owner->result_ok);
10028 return GossipTimestampFilter_clone(&*owner->contents.result);
10030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10031 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
10032 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10033 int64_t ret_ref = 0;
10034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10037 ret_ref = (uintptr_t)ret_var.inner;
10038 if (ret_var.is_owned) {
10044 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10045 CHECK(!owner->result_ok);
10046 return DecodeError_clone(&*owner->contents.err);
10048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10049 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
10050 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10051 int64_t ret_ref = 0;
10052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10055 ret_ref = (uintptr_t)ret_var.inner;
10056 if (ret_var.is_owned) {
10062 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10063 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10064 for (size_t i = 0; i < ret.datalen; i++) {
10065 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10069 static jclass LDKSignOrCreationError_SignError_class = NULL;
10070 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
10071 static jclass LDKSignOrCreationError_CreationError_class = NULL;
10072 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
10073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
10074 LDKSignOrCreationError_SignError_class =
10075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
10076 CHECK(LDKSignOrCreationError_SignError_class != NULL);
10077 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
10078 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
10079 LDKSignOrCreationError_CreationError_class =
10080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
10081 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
10082 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
10083 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
10085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10086 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
10088 case LDKSignOrCreationError_SignError: {
10089 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
10091 case LDKSignOrCreationError_CreationError: {
10092 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
10093 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
10098 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10099 CHECK(owner->result_ok);
10100 return Invoice_clone(&*owner->contents.result);
10102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10103 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
10104 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10105 int64_t ret_ref = 0;
10106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10109 ret_ref = (uintptr_t)ret_var.inner;
10110 if (ret_var.is_owned) {
10116 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10117 CHECK(!owner->result_ok);
10118 return SignOrCreationError_clone(&*owner->contents.err);
10120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10121 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
10122 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10123 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10124 int64_t ret_ref = (uintptr_t)ret_copy;
10128 typedef struct LDKFilter_JCalls {
10129 atomic_size_t refcnt;
10132 jmethodID register_tx_meth;
10133 jmethodID register_output_meth;
10134 } LDKFilter_JCalls;
10135 static void LDKFilter_JCalls_free(void* this_arg) {
10136 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10137 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10139 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10140 if (get_jenv_res == JNI_EDETACHED) {
10141 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10143 DO_ASSERT(get_jenv_res == JNI_OK);
10145 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10146 if (get_jenv_res == JNI_EDETACHED) {
10147 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10152 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
10153 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10155 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10156 if (get_jenv_res == JNI_EDETACHED) {
10157 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10159 DO_ASSERT(get_jenv_res == JNI_OK);
10161 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10162 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10163 LDKu8slice script_pubkey_var = script_pubkey;
10164 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
10165 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
10166 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10167 CHECK(obj != NULL);
10168 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
10169 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10170 (*env)->ExceptionDescribe(env);
10171 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
10173 if (get_jenv_res == JNI_EDETACHED) {
10174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10177 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
10178 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10180 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10181 if (get_jenv_res == JNI_EDETACHED) {
10182 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10184 DO_ASSERT(get_jenv_res == JNI_OK);
10186 LDKWatchedOutput output_var = output;
10187 int64_t output_ref = 0;
10188 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10189 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10190 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
10191 output_ref = (uintptr_t)output_var.inner;
10192 if (output_var.is_owned) {
10195 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10196 CHECK(obj != NULL);
10197 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
10198 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10199 (*env)->ExceptionDescribe(env);
10200 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
10202 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10203 CHECK_ACCESS(ret_ptr);
10204 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
10206 if (get_jenv_res == JNI_EDETACHED) {
10207 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10211 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10212 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10213 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10215 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
10216 jclass c = (*env)->GetObjectClass(env, o);
10218 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10219 atomic_init(&calls->refcnt, 1);
10220 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10221 calls->o = (*env)->NewWeakGlobalRef(env, o);
10222 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
10223 CHECK(calls->register_tx_meth != NULL);
10224 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
10225 CHECK(calls->register_output_meth != NULL);
10228 .this_arg = (void*) calls,
10229 .register_tx = register_tx_LDKFilter_jcall,
10230 .register_output = register_output_LDKFilter_jcall,
10231 .free = LDKFilter_JCalls_free,
10235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
10236 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10237 *res_ptr = LDKFilter_init(env, clz, o);
10238 return (uint64_t)res_ptr;
10240 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) {
10241 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10242 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10243 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10244 unsigned char txid_arr[32];
10245 CHECK((*env)->GetArrayLength(env, txid) == 32);
10246 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10247 unsigned char (*txid_ref)[32] = &txid_arr;
10248 LDKu8slice script_pubkey_ref;
10249 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10250 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
10251 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10252 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
10255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
10256 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10257 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10258 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10259 LDKWatchedOutput output_conv;
10260 output_conv.inner = (void*)(output & (~1));
10261 output_conv.is_owned = (output & 1) || (output == 0);
10262 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10263 output_conv = WatchedOutput_clone(&output_conv);
10264 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10265 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10266 int64_t ret_ref = (uintptr_t)ret_copy;
10270 static jclass LDKCOption_FilterZ_Some_class = NULL;
10271 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
10272 static jclass LDKCOption_FilterZ_None_class = NULL;
10273 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
10274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
10275 LDKCOption_FilterZ_Some_class =
10276 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
10277 CHECK(LDKCOption_FilterZ_Some_class != NULL);
10278 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
10279 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
10280 LDKCOption_FilterZ_None_class =
10281 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
10282 CHECK(LDKCOption_FilterZ_None_class != NULL);
10283 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
10284 CHECK(LDKCOption_FilterZ_None_meth != NULL);
10286 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10287 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
10289 case LDKCOption_FilterZ_Some: {
10290 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10291 *some_ret = obj->some;
10292 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10293 if ((*some_ret).free == LDKFilter_JCalls_free) {
10294 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10295 LDKFilter_JCalls_cloned(&(*some_ret));
10297 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
10299 case LDKCOption_FilterZ_None: {
10300 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
10305 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10306 CHECK(owner->result_ok);
10307 return &*owner->contents.result;
10309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10310 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10311 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10312 int64_t ret_ref = 0;
10313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10316 ret_ref = (uintptr_t)ret_var.inner & ~1;
10320 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10321 CHECK(!owner->result_ok);
10322 return *owner->contents.err;
10324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10325 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10326 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10329 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10330 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10331 for (size_t i = 0; i < ret.datalen; i++) {
10332 ret.data[i] = OutPoint_clone(&orig->data[i]);
10336 typedef struct LDKMessageSendEventsProvider_JCalls {
10337 atomic_size_t refcnt;
10340 jmethodID get_and_clear_pending_msg_events_meth;
10341 } LDKMessageSendEventsProvider_JCalls;
10342 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
10343 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10344 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10346 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10347 if (get_jenv_res == JNI_EDETACHED) {
10348 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10350 DO_ASSERT(get_jenv_res == JNI_OK);
10352 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10353 if (get_jenv_res == JNI_EDETACHED) {
10354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10359 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
10360 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10362 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10363 if (get_jenv_res == JNI_EDETACHED) {
10364 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10366 DO_ASSERT(get_jenv_res == JNI_OK);
10368 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10369 CHECK(obj != NULL);
10370 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
10371 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10372 (*env)->ExceptionDescribe(env);
10373 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
10375 LDKCVec_MessageSendEventZ ret_constr;
10376 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10377 if (ret_constr.datalen > 0)
10378 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10380 ret_constr.data = NULL;
10381 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10382 for (size_t s = 0; s < ret_constr.datalen; s++) {
10383 int64_t ret_conv_18 = ret_vals[s];
10384 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
10385 CHECK_ACCESS(ret_conv_18_ptr);
10386 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10387 FREE((void*)ret_conv_18);
10388 ret_constr.data[s] = ret_conv_18_conv;
10390 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10391 if (get_jenv_res == JNI_EDETACHED) {
10392 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10396 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10397 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10398 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10400 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10401 jclass c = (*env)->GetObjectClass(env, o);
10403 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10404 atomic_init(&calls->refcnt, 1);
10405 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10406 calls->o = (*env)->NewWeakGlobalRef(env, o);
10407 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10408 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10410 LDKMessageSendEventsProvider ret = {
10411 .this_arg = (void*) calls,
10412 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10413 .free = LDKMessageSendEventsProvider_JCalls_free,
10417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10418 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10419 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10420 return (uint64_t)res_ptr;
10422 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10423 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10424 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10425 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10426 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10427 int64_tArray ret_arr = NULL;
10428 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10429 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10430 for (size_t s = 0; s < ret_var.datalen; s++) {
10431 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10432 *ret_conv_18_copy = ret_var.data[s];
10433 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
10434 ret_arr_ptr[s] = ret_conv_18_ref;
10436 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10437 FREE(ret_var.data);
10441 typedef struct LDKEventHandler_JCalls {
10442 atomic_size_t refcnt;
10445 jmethodID handle_event_meth;
10446 } LDKEventHandler_JCalls;
10447 static void LDKEventHandler_JCalls_free(void* this_arg) {
10448 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10449 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10451 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10452 if (get_jenv_res == JNI_EDETACHED) {
10453 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10455 DO_ASSERT(get_jenv_res == JNI_OK);
10457 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10458 if (get_jenv_res == JNI_EDETACHED) {
10459 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10464 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10465 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10467 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10468 if (get_jenv_res == JNI_EDETACHED) {
10469 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10471 DO_ASSERT(get_jenv_res == JNI_OK);
10473 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10474 *ret_event = Event_clone(event);
10475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10476 CHECK(obj != NULL);
10477 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10478 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10479 (*env)->ExceptionDescribe(env);
10480 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10482 if (get_jenv_res == JNI_EDETACHED) {
10483 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10486 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10487 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10488 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10490 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10491 jclass c = (*env)->GetObjectClass(env, o);
10493 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10494 atomic_init(&calls->refcnt, 1);
10495 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10496 calls->o = (*env)->NewWeakGlobalRef(env, o);
10497 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10498 CHECK(calls->handle_event_meth != NULL);
10500 LDKEventHandler ret = {
10501 .this_arg = (void*) calls,
10502 .handle_event = handle_event_LDKEventHandler_jcall,
10503 .free = LDKEventHandler_JCalls_free,
10507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10508 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10509 *res_ptr = LDKEventHandler_init(env, clz, o);
10510 return (uint64_t)res_ptr;
10512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10513 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10514 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10515 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10516 LDKEvent* event_conv = (LDKEvent*)event;
10517 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10520 typedef struct LDKEventsProvider_JCalls {
10521 atomic_size_t refcnt;
10524 jmethodID process_pending_events_meth;
10525 } LDKEventsProvider_JCalls;
10526 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10527 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10528 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10530 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10531 if (get_jenv_res == JNI_EDETACHED) {
10532 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10534 DO_ASSERT(get_jenv_res == JNI_OK);
10536 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10537 if (get_jenv_res == JNI_EDETACHED) {
10538 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10543 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10544 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10546 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10547 if (get_jenv_res == JNI_EDETACHED) {
10548 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10550 DO_ASSERT(get_jenv_res == JNI_OK);
10552 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10553 *handler_ret = handler;
10554 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10555 CHECK(obj != NULL);
10556 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10557 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10558 (*env)->ExceptionDescribe(env);
10559 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10561 if (get_jenv_res == JNI_EDETACHED) {
10562 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10565 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10566 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10567 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10569 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10570 jclass c = (*env)->GetObjectClass(env, o);
10572 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10573 atomic_init(&calls->refcnt, 1);
10574 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10575 calls->o = (*env)->NewWeakGlobalRef(env, o);
10576 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10577 CHECK(calls->process_pending_events_meth != NULL);
10579 LDKEventsProvider ret = {
10580 .this_arg = (void*) calls,
10581 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10582 .free = LDKEventsProvider_JCalls_free,
10586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10587 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10588 *res_ptr = LDKEventsProvider_init(env, clz, o);
10589 return (uint64_t)res_ptr;
10591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10592 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10593 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10594 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10595 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10596 CHECK_ACCESS(handler_ptr);
10597 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10598 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10599 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10600 LDKEventHandler_JCalls_cloned(&handler_conv);
10602 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10605 typedef struct LDKScore_JCalls {
10606 atomic_size_t refcnt;
10609 jmethodID channel_penalty_msat_meth;
10610 jmethodID payment_path_failed_meth;
10611 jmethodID payment_path_successful_meth;
10612 jmethodID probe_failed_meth;
10613 jmethodID probe_successful_meth;
10614 jmethodID write_meth;
10616 static void LDKScore_JCalls_free(void* this_arg) {
10617 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10618 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10620 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10621 if (get_jenv_res == JNI_EDETACHED) {
10622 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10624 DO_ASSERT(get_jenv_res == JNI_OK);
10626 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10627 if (get_jenv_res == JNI_EDETACHED) {
10628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10633 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
10634 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10637 if (get_jenv_res == JNI_EDETACHED) {
10638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10640 DO_ASSERT(get_jenv_res == JNI_OK);
10642 int64_t short_channel_id_conv = short_channel_id;
10643 LDKNodeId source_var = *source;
10644 int64_t source_ref = 0;
10645 source_var = NodeId_clone(&source_var);
10646 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10647 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10648 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10649 source_ref = (uintptr_t)source_var.inner;
10650 if (source_var.is_owned) {
10653 LDKNodeId target_var = *target;
10654 int64_t target_ref = 0;
10655 target_var = NodeId_clone(&target_var);
10656 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10657 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10658 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10659 target_ref = (uintptr_t)target_var.inner;
10660 if (target_var.is_owned) {
10663 LDKChannelUsage usage_var = usage;
10664 int64_t usage_ref = 0;
10665 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10666 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10667 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10668 usage_ref = (uintptr_t)usage_var.inner;
10669 if (usage_var.is_owned) {
10672 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10673 CHECK(obj != NULL);
10674 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
10675 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10676 (*env)->ExceptionDescribe(env);
10677 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10679 if (get_jenv_res == JNI_EDETACHED) {
10680 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10684 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10685 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10687 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10688 if (get_jenv_res == JNI_EDETACHED) {
10689 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10691 DO_ASSERT(get_jenv_res == JNI_OK);
10693 LDKCVec_RouteHopZ path_var = path;
10694 int64_tArray path_arr = NULL;
10695 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10696 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10697 for (size_t k = 0; k < path_var.datalen; k++) {
10698 LDKRouteHop path_conv_10_var = path_var.data[k];
10699 int64_t path_conv_10_ref = 0;
10700 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10701 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10702 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10703 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10704 if (path_conv_10_var.is_owned) {
10705 path_conv_10_ref |= 1;
10707 path_arr_ptr[k] = path_conv_10_ref;
10709 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10710 FREE(path_var.data);
10711 int64_t short_channel_id_conv = short_channel_id;
10712 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10713 CHECK(obj != NULL);
10714 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
10715 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10716 (*env)->ExceptionDescribe(env);
10717 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10719 if (get_jenv_res == JNI_EDETACHED) {
10720 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10723 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10724 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10727 if (get_jenv_res == JNI_EDETACHED) {
10728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10730 DO_ASSERT(get_jenv_res == JNI_OK);
10732 LDKCVec_RouteHopZ path_var = path;
10733 int64_tArray path_arr = NULL;
10734 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10735 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10736 for (size_t k = 0; k < path_var.datalen; k++) {
10737 LDKRouteHop path_conv_10_var = path_var.data[k];
10738 int64_t path_conv_10_ref = 0;
10739 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10740 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10741 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10742 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10743 if (path_conv_10_var.is_owned) {
10744 path_conv_10_ref |= 1;
10746 path_arr_ptr[k] = path_conv_10_ref;
10748 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10749 FREE(path_var.data);
10750 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10751 CHECK(obj != NULL);
10752 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
10753 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10754 (*env)->ExceptionDescribe(env);
10755 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
10757 if (get_jenv_res == JNI_EDETACHED) {
10758 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10761 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10762 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10764 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10765 if (get_jenv_res == JNI_EDETACHED) {
10766 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10768 DO_ASSERT(get_jenv_res == JNI_OK);
10770 LDKCVec_RouteHopZ path_var = path;
10771 int64_tArray path_arr = NULL;
10772 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10773 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10774 for (size_t k = 0; k < path_var.datalen; k++) {
10775 LDKRouteHop path_conv_10_var = path_var.data[k];
10776 int64_t path_conv_10_ref = 0;
10777 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10778 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10779 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10780 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10781 if (path_conv_10_var.is_owned) {
10782 path_conv_10_ref |= 1;
10784 path_arr_ptr[k] = path_conv_10_ref;
10786 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10787 FREE(path_var.data);
10788 int64_t short_channel_id_conv = short_channel_id;
10789 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10790 CHECK(obj != NULL);
10791 (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
10792 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10793 (*env)->ExceptionDescribe(env);
10794 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
10796 if (get_jenv_res == JNI_EDETACHED) {
10797 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10800 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10801 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10803 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10804 if (get_jenv_res == JNI_EDETACHED) {
10805 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10807 DO_ASSERT(get_jenv_res == JNI_OK);
10809 LDKCVec_RouteHopZ path_var = path;
10810 int64_tArray path_arr = NULL;
10811 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10812 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10813 for (size_t k = 0; k < path_var.datalen; k++) {
10814 LDKRouteHop path_conv_10_var = path_var.data[k];
10815 int64_t path_conv_10_ref = 0;
10816 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10817 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10818 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10819 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10820 if (path_conv_10_var.is_owned) {
10821 path_conv_10_ref |= 1;
10823 path_arr_ptr[k] = path_conv_10_ref;
10825 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10826 FREE(path_var.data);
10827 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10828 CHECK(obj != NULL);
10829 (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
10830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10831 (*env)->ExceptionDescribe(env);
10832 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
10834 if (get_jenv_res == JNI_EDETACHED) {
10835 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10838 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10839 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10841 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10842 if (get_jenv_res == JNI_EDETACHED) {
10843 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10845 DO_ASSERT(get_jenv_res == JNI_OK);
10847 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10848 CHECK(obj != NULL);
10849 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10850 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10851 (*env)->ExceptionDescribe(env);
10852 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10854 LDKCVec_u8Z ret_ref;
10855 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10856 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10857 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10858 if (get_jenv_res == JNI_EDETACHED) {
10859 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10863 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10864 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10865 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10867 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10868 jclass c = (*env)->GetObjectClass(env, o);
10870 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10871 atomic_init(&calls->refcnt, 1);
10872 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10873 calls->o = (*env)->NewWeakGlobalRef(env, o);
10874 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
10875 CHECK(calls->channel_penalty_msat_meth != NULL);
10876 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10877 CHECK(calls->payment_path_failed_meth != NULL);
10878 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
10879 CHECK(calls->payment_path_successful_meth != NULL);
10880 calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
10881 CHECK(calls->probe_failed_meth != NULL);
10882 calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
10883 CHECK(calls->probe_successful_meth != NULL);
10884 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10885 CHECK(calls->write_meth != NULL);
10888 .this_arg = (void*) calls,
10889 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10890 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10891 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10892 .probe_failed = probe_failed_LDKScore_jcall,
10893 .probe_successful = probe_successful_LDKScore_jcall,
10894 .write = write_LDKScore_jcall,
10895 .free = LDKScore_JCalls_free,
10899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10900 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10901 *res_ptr = LDKScore_init(env, clz, o);
10902 return (uint64_t)res_ptr;
10904 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) {
10905 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10906 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10907 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10908 LDKNodeId source_conv;
10909 source_conv.inner = (void*)(source & (~1));
10910 source_conv.is_owned = false;
10911 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10912 LDKNodeId target_conv;
10913 target_conv.inner = (void*)(target & (~1));
10914 target_conv.is_owned = false;
10915 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10916 LDKChannelUsage usage_conv;
10917 usage_conv.inner = (void*)(usage & (~1));
10918 usage_conv.is_owned = (usage & 1) || (usage == 0);
10919 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10920 usage_conv = ChannelUsage_clone(&usage_conv);
10921 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10925 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) {
10926 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10927 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10928 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10929 LDKCVec_RouteHopZ path_constr;
10930 path_constr.datalen = (*env)->GetArrayLength(env, path);
10931 if (path_constr.datalen > 0)
10932 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10934 path_constr.data = NULL;
10935 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10936 for (size_t k = 0; k < path_constr.datalen; k++) {
10937 int64_t path_conv_10 = path_vals[k];
10938 LDKRouteHop path_conv_10_conv;
10939 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10940 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10941 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10942 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10943 path_constr.data[k] = path_conv_10_conv;
10945 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10946 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10950 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10951 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10952 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10953 LDKCVec_RouteHopZ path_constr;
10954 path_constr.datalen = (*env)->GetArrayLength(env, path);
10955 if (path_constr.datalen > 0)
10956 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10958 path_constr.data = NULL;
10959 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10960 for (size_t k = 0; k < path_constr.datalen; k++) {
10961 int64_t path_conv_10 = path_vals[k];
10962 LDKRouteHop path_conv_10_conv;
10963 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10964 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10965 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10966 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10967 path_constr.data[k] = path_conv_10_conv;
10969 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10970 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10974 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10975 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10976 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10977 LDKCVec_RouteHopZ path_constr;
10978 path_constr.datalen = (*env)->GetArrayLength(env, path);
10979 if (path_constr.datalen > 0)
10980 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10982 path_constr.data = NULL;
10983 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10984 for (size_t k = 0; k < path_constr.datalen; k++) {
10985 int64_t path_conv_10 = path_vals[k];
10986 LDKRouteHop path_conv_10_conv;
10987 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10988 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10989 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10990 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10991 path_constr.data[k] = path_conv_10_conv;
10993 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10994 (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10998 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10999 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11000 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
11001 LDKCVec_RouteHopZ path_constr;
11002 path_constr.datalen = (*env)->GetArrayLength(env, path);
11003 if (path_constr.datalen > 0)
11004 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11006 path_constr.data = NULL;
11007 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
11008 for (size_t k = 0; k < path_constr.datalen; k++) {
11009 int64_t path_conv_10 = path_vals[k];
11010 LDKRouteHop path_conv_10_conv;
11011 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
11012 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
11013 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11014 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11015 path_constr.data[k] = path_conv_10_conv;
11017 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
11018 (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
11021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11022 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11023 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11024 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
11025 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11026 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11027 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11028 CVec_u8Z_free(ret_var);
11032 typedef struct LDKPersister_JCalls {
11033 atomic_size_t refcnt;
11036 jmethodID persist_manager_meth;
11037 jmethodID persist_graph_meth;
11038 jmethodID persist_scorer_meth;
11039 } LDKPersister_JCalls;
11040 static void LDKPersister_JCalls_free(void* this_arg) {
11041 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11042 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11045 if (get_jenv_res == JNI_EDETACHED) {
11046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11048 DO_ASSERT(get_jenv_res == JNI_OK);
11050 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11051 if (get_jenv_res == JNI_EDETACHED) {
11052 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11057 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11058 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11060 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11061 if (get_jenv_res == JNI_EDETACHED) {
11062 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11064 DO_ASSERT(get_jenv_res == JNI_OK);
11066 LDKChannelManager channel_manager_var = *channel_manager;
11067 int64_t channel_manager_ref = 0;
11068 // WARNING: we may need a move here but no clone is available for LDKChannelManager
11069 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11070 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11071 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11072 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
11073 if (channel_manager_var.is_owned) {
11074 channel_manager_ref |= 1;
11076 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11077 CHECK(obj != NULL);
11078 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
11079 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11080 (*env)->ExceptionDescribe(env);
11081 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
11083 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11084 CHECK_ACCESS(ret_ptr);
11085 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11087 if (get_jenv_res == JNI_EDETACHED) {
11088 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11092 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11093 LDKPersister_JCalls *j_calls = (LDKPersister_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 LDKNetworkGraph network_graph_var = *network_graph;
11102 int64_t network_graph_ref = 0;
11103 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11104 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11105 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11106 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11107 network_graph_ref = (uintptr_t)network_graph_var.inner;
11108 if (network_graph_var.is_owned) {
11109 network_graph_ref |= 1;
11111 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11112 CHECK(obj != NULL);
11113 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
11114 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11115 (*env)->ExceptionDescribe(env);
11116 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
11118 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11119 CHECK_ACCESS(ret_ptr);
11120 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11122 if (get_jenv_res == JNI_EDETACHED) {
11123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11127 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
11128 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11130 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11131 if (get_jenv_res == JNI_EDETACHED) {
11132 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11134 DO_ASSERT(get_jenv_res == JNI_OK);
11136 LDKMultiThreadedLockableScore scorer_var = *scorer;
11137 int64_t scorer_ref = 0;
11138 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
11139 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11140 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11141 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
11142 scorer_ref = (uintptr_t)scorer_var.inner;
11143 if (scorer_var.is_owned) {
11146 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11147 CHECK(obj != NULL);
11148 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
11149 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11150 (*env)->ExceptionDescribe(env);
11151 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
11153 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11154 CHECK_ACCESS(ret_ptr);
11155 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11157 if (get_jenv_res == JNI_EDETACHED) {
11158 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11162 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11163 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11164 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11166 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
11167 jclass c = (*env)->GetObjectClass(env, o);
11169 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11170 atomic_init(&calls->refcnt, 1);
11171 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11172 calls->o = (*env)->NewWeakGlobalRef(env, o);
11173 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
11174 CHECK(calls->persist_manager_meth != NULL);
11175 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
11176 CHECK(calls->persist_graph_meth != NULL);
11177 calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
11178 CHECK(calls->persist_scorer_meth != NULL);
11180 LDKPersister ret = {
11181 .this_arg = (void*) calls,
11182 .persist_manager = persist_manager_LDKPersister_jcall,
11183 .persist_graph = persist_graph_LDKPersister_jcall,
11184 .persist_scorer = persist_scorer_LDKPersister_jcall,
11185 .free = LDKPersister_JCalls_free,
11189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
11190 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11191 *res_ptr = LDKPersister_init(env, clz, o);
11192 return (uint64_t)res_ptr;
11194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
11195 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11196 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11197 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11198 LDKChannelManager channel_manager_conv;
11199 channel_manager_conv.inner = (void*)(channel_manager & (~1));
11200 channel_manager_conv.is_owned = false;
11201 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11202 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11203 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
11204 return (int64_t)ret_conv;
11207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
11208 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11209 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11210 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11211 LDKNetworkGraph network_graph_conv;
11212 network_graph_conv.inner = (void*)(network_graph & (~1));
11213 network_graph_conv.is_owned = false;
11214 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
11215 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11216 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
11217 return (int64_t)ret_conv;
11220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
11221 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11222 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11223 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11224 LDKMultiThreadedLockableScore scorer_conv;
11225 scorer_conv.inner = (void*)(scorer & (~1));
11226 scorer_conv.is_owned = false;
11227 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
11228 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11229 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
11230 return (int64_t)ret_conv;
11233 typedef struct LDKListen_JCalls {
11234 atomic_size_t refcnt;
11237 jmethodID filtered_block_connected_meth;
11238 jmethodID block_connected_meth;
11239 jmethodID block_disconnected_meth;
11240 } LDKListen_JCalls;
11241 static void LDKListen_JCalls_free(void* this_arg) {
11242 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11243 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11245 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11246 if (get_jenv_res == JNI_EDETACHED) {
11247 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11249 DO_ASSERT(get_jenv_res == JNI_OK);
11251 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11252 if (get_jenv_res == JNI_EDETACHED) {
11253 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11258 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11259 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11261 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11262 if (get_jenv_res == JNI_EDETACHED) {
11263 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11265 DO_ASSERT(get_jenv_res == JNI_OK);
11267 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11268 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11269 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11270 int64_tArray txdata_arr = NULL;
11271 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11272 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11273 for (size_t c = 0; c < txdata_var.datalen; c++) {
11274 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11275 *txdata_conv_28_conv = txdata_var.data[c];
11276 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11278 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11279 FREE(txdata_var.data);
11280 int32_t height_conv = height;
11281 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11282 CHECK(obj != NULL);
11283 (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
11284 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11285 (*env)->ExceptionDescribe(env);
11286 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
11288 if (get_jenv_res == JNI_EDETACHED) {
11289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11292 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11293 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11295 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11296 if (get_jenv_res == JNI_EDETACHED) {
11297 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11299 DO_ASSERT(get_jenv_res == JNI_OK);
11301 LDKu8slice block_var = block;
11302 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
11303 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
11304 int32_t height_conv = height;
11305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11306 CHECK(obj != NULL);
11307 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
11308 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11309 (*env)->ExceptionDescribe(env);
11310 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
11312 if (get_jenv_res == JNI_EDETACHED) {
11313 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11316 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11317 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11319 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11320 if (get_jenv_res == JNI_EDETACHED) {
11321 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11323 DO_ASSERT(get_jenv_res == JNI_OK);
11325 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11326 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11327 int32_t height_conv = height;
11328 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11329 CHECK(obj != NULL);
11330 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
11331 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11332 (*env)->ExceptionDescribe(env);
11333 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
11335 if (get_jenv_res == JNI_EDETACHED) {
11336 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11339 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11340 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11341 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11343 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
11344 jclass c = (*env)->GetObjectClass(env, o);
11346 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11347 atomic_init(&calls->refcnt, 1);
11348 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11349 calls->o = (*env)->NewWeakGlobalRef(env, o);
11350 calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
11351 CHECK(calls->filtered_block_connected_meth != NULL);
11352 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
11353 CHECK(calls->block_connected_meth != NULL);
11354 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
11355 CHECK(calls->block_disconnected_meth != NULL);
11358 .this_arg = (void*) calls,
11359 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11360 .block_connected = block_connected_LDKListen_jcall,
11361 .block_disconnected = block_disconnected_LDKListen_jcall,
11362 .free = LDKListen_JCalls_free,
11366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
11367 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11368 *res_ptr = LDKListen_init(env, clz, o);
11369 return (uint64_t)res_ptr;
11371 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) {
11372 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11373 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11374 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11375 unsigned char header_arr[80];
11376 CHECK((*env)->GetArrayLength(env, header) == 80);
11377 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11378 unsigned char (*header_ref)[80] = &header_arr;
11379 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11380 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11381 if (txdata_constr.datalen > 0)
11382 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11384 txdata_constr.data = NULL;
11385 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11386 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11387 int64_t txdata_conv_28 = txdata_vals[c];
11388 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11389 CHECK_ACCESS(txdata_conv_28_ptr);
11390 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11391 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11392 txdata_constr.data[c] = txdata_conv_28_conv;
11394 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11395 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11398 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) {
11399 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11400 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11401 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11402 LDKu8slice block_ref;
11403 block_ref.datalen = (*env)->GetArrayLength(env, block);
11404 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
11405 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11406 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
11409 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) {
11410 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11411 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11412 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11413 unsigned char header_arr[80];
11414 CHECK((*env)->GetArrayLength(env, header) == 80);
11415 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11416 unsigned char (*header_ref)[80] = &header_arr;
11417 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11420 typedef struct LDKConfirm_JCalls {
11421 atomic_size_t refcnt;
11424 jmethodID transactions_confirmed_meth;
11425 jmethodID transaction_unconfirmed_meth;
11426 jmethodID best_block_updated_meth;
11427 jmethodID get_relevant_txids_meth;
11428 } LDKConfirm_JCalls;
11429 static void LDKConfirm_JCalls_free(void* this_arg) {
11430 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11431 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11433 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11434 if (get_jenv_res == JNI_EDETACHED) {
11435 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11437 DO_ASSERT(get_jenv_res == JNI_OK);
11439 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11440 if (get_jenv_res == JNI_EDETACHED) {
11441 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11446 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11447 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11449 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11450 if (get_jenv_res == JNI_EDETACHED) {
11451 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11453 DO_ASSERT(get_jenv_res == JNI_OK);
11455 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11456 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11457 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11458 int64_tArray txdata_arr = NULL;
11459 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11460 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11461 for (size_t c = 0; c < txdata_var.datalen; c++) {
11462 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11463 *txdata_conv_28_conv = txdata_var.data[c];
11464 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11466 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11467 FREE(txdata_var.data);
11468 int32_t height_conv = height;
11469 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11470 CHECK(obj != NULL);
11471 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
11472 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11473 (*env)->ExceptionDescribe(env);
11474 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
11476 if (get_jenv_res == JNI_EDETACHED) {
11477 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11480 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11481 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11484 if (get_jenv_res == JNI_EDETACHED) {
11485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11487 DO_ASSERT(get_jenv_res == JNI_OK);
11489 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11490 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11491 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11492 CHECK(obj != NULL);
11493 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
11494 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11495 (*env)->ExceptionDescribe(env);
11496 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
11498 if (get_jenv_res == JNI_EDETACHED) {
11499 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11502 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11503 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11505 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11506 if (get_jenv_res == JNI_EDETACHED) {
11507 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11509 DO_ASSERT(get_jenv_res == JNI_OK);
11511 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11512 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11513 int32_t height_conv = height;
11514 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11515 CHECK(obj != NULL);
11516 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
11517 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11518 (*env)->ExceptionDescribe(env);
11519 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
11521 if (get_jenv_res == JNI_EDETACHED) {
11522 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11525 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11526 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11528 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11529 if (get_jenv_res == JNI_EDETACHED) {
11530 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11532 DO_ASSERT(get_jenv_res == JNI_OK);
11534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11535 CHECK(obj != NULL);
11536 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
11537 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11538 (*env)->ExceptionDescribe(env);
11539 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
11541 LDKCVec_TxidZ ret_constr;
11542 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11543 if (ret_constr.datalen > 0)
11544 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11546 ret_constr.data = NULL;
11547 for (size_t i = 0; i < ret_constr.datalen; i++) {
11548 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
11549 LDKThirtyTwoBytes ret_conv_8_ref;
11550 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
11551 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
11552 ret_constr.data[i] = ret_conv_8_ref;
11554 if (get_jenv_res == JNI_EDETACHED) {
11555 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11559 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11560 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11561 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11563 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
11564 jclass c = (*env)->GetObjectClass(env, o);
11566 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11567 atomic_init(&calls->refcnt, 1);
11568 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11569 calls->o = (*env)->NewWeakGlobalRef(env, o);
11570 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
11571 CHECK(calls->transactions_confirmed_meth != NULL);
11572 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
11573 CHECK(calls->transaction_unconfirmed_meth != NULL);
11574 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
11575 CHECK(calls->best_block_updated_meth != NULL);
11576 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
11577 CHECK(calls->get_relevant_txids_meth != NULL);
11580 .this_arg = (void*) calls,
11581 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11582 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11583 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11584 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11585 .free = LDKConfirm_JCalls_free,
11589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
11590 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11591 *res_ptr = LDKConfirm_init(env, clz, o);
11592 return (uint64_t)res_ptr;
11594 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) {
11595 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11596 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11597 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11598 unsigned char header_arr[80];
11599 CHECK((*env)->GetArrayLength(env, header) == 80);
11600 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11601 unsigned char (*header_ref)[80] = &header_arr;
11602 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11603 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11604 if (txdata_constr.datalen > 0)
11605 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11607 txdata_constr.data = NULL;
11608 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11609 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11610 int64_t txdata_conv_28 = txdata_vals[c];
11611 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11612 CHECK_ACCESS(txdata_conv_28_ptr);
11613 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11614 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11615 txdata_constr.data[c] = txdata_conv_28_conv;
11617 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11618 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
11622 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11623 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11624 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11625 unsigned char txid_arr[32];
11626 CHECK((*env)->GetArrayLength(env, txid) == 32);
11627 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11628 unsigned char (*txid_ref)[32] = &txid_arr;
11629 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11632 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) {
11633 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11634 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11635 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11636 unsigned char header_arr[80];
11637 CHECK((*env)->GetArrayLength(env, header) == 80);
11638 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11639 unsigned char (*header_ref)[80] = &header_arr;
11640 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11643 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
11644 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11645 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11646 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11647 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11648 jobjectArray ret_arr = NULL;
11649 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11651 for (size_t i = 0; i < ret_var.datalen; i++) {
11652 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
11653 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
11654 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11657 FREE(ret_var.data);
11661 typedef struct LDKPersist_JCalls {
11662 atomic_size_t refcnt;
11665 jmethodID persist_new_channel_meth;
11666 jmethodID update_persisted_channel_meth;
11667 } LDKPersist_JCalls;
11668 static void LDKPersist_JCalls_free(void* this_arg) {
11669 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11670 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11672 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11673 if (get_jenv_res == JNI_EDETACHED) {
11674 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11676 DO_ASSERT(get_jenv_res == JNI_OK);
11678 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11679 if (get_jenv_res == JNI_EDETACHED) {
11680 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11685 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11686 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11688 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11689 if (get_jenv_res == JNI_EDETACHED) {
11690 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11692 DO_ASSERT(get_jenv_res == JNI_OK);
11694 LDKOutPoint channel_id_var = channel_id;
11695 int64_t channel_id_ref = 0;
11696 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11697 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11698 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11699 channel_id_ref = (uintptr_t)channel_id_var.inner;
11700 if (channel_id_var.is_owned) {
11701 channel_id_ref |= 1;
11703 LDKChannelMonitor data_var = *data;
11704 int64_t data_ref = 0;
11705 data_var = ChannelMonitor_clone(&data_var);
11706 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11707 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11708 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11709 data_ref = (uintptr_t)data_var.inner;
11710 if (data_var.is_owned) {
11713 LDKMonitorUpdateId update_id_var = update_id;
11714 int64_t update_id_ref = 0;
11715 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11716 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11717 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11718 update_id_ref = (uintptr_t)update_id_var.inner;
11719 if (update_id_var.is_owned) {
11720 update_id_ref |= 1;
11722 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11723 CHECK(obj != NULL);
11724 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
11725 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11726 (*env)->ExceptionDescribe(env);
11727 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
11729 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11730 CHECK_ACCESS(ret_ptr);
11731 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11733 if (get_jenv_res == JNI_EDETACHED) {
11734 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11738 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11739 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11741 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11742 if (get_jenv_res == JNI_EDETACHED) {
11743 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11745 DO_ASSERT(get_jenv_res == JNI_OK);
11747 LDKOutPoint channel_id_var = channel_id;
11748 int64_t channel_id_ref = 0;
11749 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11750 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11751 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11752 channel_id_ref = (uintptr_t)channel_id_var.inner;
11753 if (channel_id_var.is_owned) {
11754 channel_id_ref |= 1;
11756 LDKChannelMonitorUpdate update_var = *update;
11757 int64_t update_ref = 0;
11758 if ((uintptr_t)update_var.inner > 4096) {
11759 update_var = ChannelMonitorUpdate_clone(&update_var);
11760 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11761 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11762 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11763 update_ref = (uintptr_t)update_var.inner;
11764 if (update_var.is_owned) {
11768 LDKChannelMonitor data_var = *data;
11769 int64_t data_ref = 0;
11770 data_var = ChannelMonitor_clone(&data_var);
11771 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11772 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11773 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11774 data_ref = (uintptr_t)data_var.inner;
11775 if (data_var.is_owned) {
11778 LDKMonitorUpdateId update_id_var = update_id;
11779 int64_t update_id_ref = 0;
11780 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11781 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11782 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11783 update_id_ref = (uintptr_t)update_id_var.inner;
11784 if (update_id_var.is_owned) {
11785 update_id_ref |= 1;
11787 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11788 CHECK(obj != NULL);
11789 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
11790 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11791 (*env)->ExceptionDescribe(env);
11792 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
11794 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11795 CHECK_ACCESS(ret_ptr);
11796 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11798 if (get_jenv_res == JNI_EDETACHED) {
11799 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11803 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11804 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11805 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11807 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
11808 jclass c = (*env)->GetObjectClass(env, o);
11810 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11811 atomic_init(&calls->refcnt, 1);
11812 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11813 calls->o = (*env)->NewWeakGlobalRef(env, o);
11814 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
11815 CHECK(calls->persist_new_channel_meth != NULL);
11816 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
11817 CHECK(calls->update_persisted_channel_meth != NULL);
11820 .this_arg = (void*) calls,
11821 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11822 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11823 .free = LDKPersist_JCalls_free,
11827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
11828 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11829 *res_ptr = LDKPersist_init(env, clz, o);
11830 return (uint64_t)res_ptr;
11832 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) {
11833 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11834 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11835 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11836 LDKOutPoint channel_id_conv;
11837 channel_id_conv.inner = (void*)(channel_id & (~1));
11838 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11839 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11840 channel_id_conv = OutPoint_clone(&channel_id_conv);
11841 LDKChannelMonitor data_conv;
11842 data_conv.inner = (void*)(data & (~1));
11843 data_conv.is_owned = false;
11844 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11845 LDKMonitorUpdateId update_id_conv;
11846 update_id_conv.inner = (void*)(update_id & (~1));
11847 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11848 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11849 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11850 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11851 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
11852 return (int64_t)ret_conv;
11855 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) {
11856 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11857 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11858 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11859 LDKOutPoint channel_id_conv;
11860 channel_id_conv.inner = (void*)(channel_id & (~1));
11861 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11862 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11863 channel_id_conv = OutPoint_clone(&channel_id_conv);
11864 LDKChannelMonitorUpdate update_conv;
11865 update_conv.inner = (void*)(update & (~1));
11866 update_conv.is_owned = false;
11867 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11868 LDKChannelMonitor data_conv;
11869 data_conv.inner = (void*)(data & (~1));
11870 data_conv.is_owned = false;
11871 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11872 LDKMonitorUpdateId update_id_conv;
11873 update_id_conv.inner = (void*)(update_id & (~1));
11874 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11875 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11876 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11877 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11878 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
11879 return (int64_t)ret_conv;
11882 typedef struct LDKChannelMessageHandler_JCalls {
11883 atomic_size_t refcnt;
11886 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11887 jmethodID handle_open_channel_meth;
11888 jmethodID handle_accept_channel_meth;
11889 jmethodID handle_funding_created_meth;
11890 jmethodID handle_funding_signed_meth;
11891 jmethodID handle_channel_ready_meth;
11892 jmethodID handle_shutdown_meth;
11893 jmethodID handle_closing_signed_meth;
11894 jmethodID handle_update_add_htlc_meth;
11895 jmethodID handle_update_fulfill_htlc_meth;
11896 jmethodID handle_update_fail_htlc_meth;
11897 jmethodID handle_update_fail_malformed_htlc_meth;
11898 jmethodID handle_commitment_signed_meth;
11899 jmethodID handle_revoke_and_ack_meth;
11900 jmethodID handle_update_fee_meth;
11901 jmethodID handle_announcement_signatures_meth;
11902 jmethodID peer_disconnected_meth;
11903 jmethodID peer_connected_meth;
11904 jmethodID handle_channel_reestablish_meth;
11905 jmethodID handle_channel_update_meth;
11906 jmethodID handle_error_meth;
11907 } LDKChannelMessageHandler_JCalls;
11908 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11909 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11910 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11912 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11913 if (get_jenv_res == JNI_EDETACHED) {
11914 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11916 DO_ASSERT(get_jenv_res == JNI_OK);
11918 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11919 if (get_jenv_res == JNI_EDETACHED) {
11920 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11925 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
11926 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11928 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11929 if (get_jenv_res == JNI_EDETACHED) {
11930 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11932 DO_ASSERT(get_jenv_res == JNI_OK);
11934 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11935 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11936 LDKInitFeatures their_features_var = their_features;
11937 int64_t their_features_ref = 0;
11938 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11939 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11940 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11941 their_features_ref = (uintptr_t)their_features_var.inner;
11942 if (their_features_var.is_owned) {
11943 their_features_ref |= 1;
11945 LDKOpenChannel msg_var = *msg;
11946 int64_t msg_ref = 0;
11947 msg_var = OpenChannel_clone(&msg_var);
11948 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11949 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11950 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11951 msg_ref = (uintptr_t)msg_var.inner;
11952 if (msg_var.is_owned) {
11955 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11956 CHECK(obj != NULL);
11957 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11958 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11959 (*env)->ExceptionDescribe(env);
11960 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11962 if (get_jenv_res == JNI_EDETACHED) {
11963 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11966 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11967 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11969 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11970 if (get_jenv_res == JNI_EDETACHED) {
11971 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11973 DO_ASSERT(get_jenv_res == JNI_OK);
11975 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11976 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11977 LDKInitFeatures their_features_var = their_features;
11978 int64_t their_features_ref = 0;
11979 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11980 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11981 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11982 their_features_ref = (uintptr_t)their_features_var.inner;
11983 if (their_features_var.is_owned) {
11984 their_features_ref |= 1;
11986 LDKAcceptChannel msg_var = *msg;
11987 int64_t msg_ref = 0;
11988 msg_var = AcceptChannel_clone(&msg_var);
11989 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11990 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11991 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11992 msg_ref = (uintptr_t)msg_var.inner;
11993 if (msg_var.is_owned) {
11996 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11997 CHECK(obj != NULL);
11998 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11999 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12000 (*env)->ExceptionDescribe(env);
12001 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
12003 if (get_jenv_res == JNI_EDETACHED) {
12004 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12007 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12010 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12011 if (get_jenv_res == JNI_EDETACHED) {
12012 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12014 DO_ASSERT(get_jenv_res == JNI_OK);
12016 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12017 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12018 LDKFundingCreated msg_var = *msg;
12019 int64_t msg_ref = 0;
12020 msg_var = FundingCreated_clone(&msg_var);
12021 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12022 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12023 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12024 msg_ref = (uintptr_t)msg_var.inner;
12025 if (msg_var.is_owned) {
12028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12029 CHECK(obj != NULL);
12030 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
12031 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12032 (*env)->ExceptionDescribe(env);
12033 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
12035 if (get_jenv_res == JNI_EDETACHED) {
12036 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12039 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12040 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12043 if (get_jenv_res == JNI_EDETACHED) {
12044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12046 DO_ASSERT(get_jenv_res == JNI_OK);
12048 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12049 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12050 LDKFundingSigned msg_var = *msg;
12051 int64_t msg_ref = 0;
12052 msg_var = FundingSigned_clone(&msg_var);
12053 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12054 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12056 msg_ref = (uintptr_t)msg_var.inner;
12057 if (msg_var.is_owned) {
12060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12061 CHECK(obj != NULL);
12062 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
12063 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12064 (*env)->ExceptionDescribe(env);
12065 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
12067 if (get_jenv_res == JNI_EDETACHED) {
12068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12071 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12075 if (get_jenv_res == JNI_EDETACHED) {
12076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12078 DO_ASSERT(get_jenv_res == JNI_OK);
12080 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12081 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12082 LDKChannelReady msg_var = *msg;
12083 int64_t msg_ref = 0;
12084 msg_var = ChannelReady_clone(&msg_var);
12085 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12086 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12087 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12088 msg_ref = (uintptr_t)msg_var.inner;
12089 if (msg_var.is_owned) {
12092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12093 CHECK(obj != NULL);
12094 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
12095 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12096 (*env)->ExceptionDescribe(env);
12097 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
12099 if (get_jenv_res == JNI_EDETACHED) {
12100 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12103 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
12104 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12106 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12107 if (get_jenv_res == JNI_EDETACHED) {
12108 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12110 DO_ASSERT(get_jenv_res == JNI_OK);
12112 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12113 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12114 LDKInitFeatures their_features_var = *their_features;
12115 int64_t their_features_ref = 0;
12116 their_features_var = InitFeatures_clone(&their_features_var);
12117 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12118 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12119 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
12120 their_features_ref = (uintptr_t)their_features_var.inner;
12121 if (their_features_var.is_owned) {
12122 their_features_ref |= 1;
12124 LDKShutdown msg_var = *msg;
12125 int64_t msg_ref = 0;
12126 msg_var = Shutdown_clone(&msg_var);
12127 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12128 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12129 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12130 msg_ref = (uintptr_t)msg_var.inner;
12131 if (msg_var.is_owned) {
12134 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12135 CHECK(obj != NULL);
12136 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
12137 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12138 (*env)->ExceptionDescribe(env);
12139 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
12141 if (get_jenv_res == JNI_EDETACHED) {
12142 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12145 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12146 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12148 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12149 if (get_jenv_res == JNI_EDETACHED) {
12150 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12152 DO_ASSERT(get_jenv_res == JNI_OK);
12154 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12155 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12156 LDKClosingSigned msg_var = *msg;
12157 int64_t msg_ref = 0;
12158 msg_var = ClosingSigned_clone(&msg_var);
12159 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12160 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12161 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12162 msg_ref = (uintptr_t)msg_var.inner;
12163 if (msg_var.is_owned) {
12166 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12167 CHECK(obj != NULL);
12168 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
12169 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12170 (*env)->ExceptionDescribe(env);
12171 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
12173 if (get_jenv_res == JNI_EDETACHED) {
12174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12177 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12178 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12180 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12181 if (get_jenv_res == JNI_EDETACHED) {
12182 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12184 DO_ASSERT(get_jenv_res == JNI_OK);
12186 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12187 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12188 LDKUpdateAddHTLC msg_var = *msg;
12189 int64_t msg_ref = 0;
12190 msg_var = UpdateAddHTLC_clone(&msg_var);
12191 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12192 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12194 msg_ref = (uintptr_t)msg_var.inner;
12195 if (msg_var.is_owned) {
12198 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12199 CHECK(obj != NULL);
12200 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
12201 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12202 (*env)->ExceptionDescribe(env);
12203 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
12205 if (get_jenv_res == JNI_EDETACHED) {
12206 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12209 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12210 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12212 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12213 if (get_jenv_res == JNI_EDETACHED) {
12214 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12216 DO_ASSERT(get_jenv_res == JNI_OK);
12218 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12219 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12220 LDKUpdateFulfillHTLC msg_var = *msg;
12221 int64_t msg_ref = 0;
12222 msg_var = UpdateFulfillHTLC_clone(&msg_var);
12223 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12224 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12225 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12226 msg_ref = (uintptr_t)msg_var.inner;
12227 if (msg_var.is_owned) {
12230 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12231 CHECK(obj != NULL);
12232 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
12233 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12234 (*env)->ExceptionDescribe(env);
12235 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
12237 if (get_jenv_res == JNI_EDETACHED) {
12238 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12241 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12242 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12244 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12245 if (get_jenv_res == JNI_EDETACHED) {
12246 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12248 DO_ASSERT(get_jenv_res == JNI_OK);
12250 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12251 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12252 LDKUpdateFailHTLC msg_var = *msg;
12253 int64_t msg_ref = 0;
12254 msg_var = UpdateFailHTLC_clone(&msg_var);
12255 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12256 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12257 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12258 msg_ref = (uintptr_t)msg_var.inner;
12259 if (msg_var.is_owned) {
12262 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12263 CHECK(obj != NULL);
12264 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
12265 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12266 (*env)->ExceptionDescribe(env);
12267 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
12269 if (get_jenv_res == JNI_EDETACHED) {
12270 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12273 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12274 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12277 if (get_jenv_res == JNI_EDETACHED) {
12278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12280 DO_ASSERT(get_jenv_res == JNI_OK);
12282 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12283 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12284 LDKUpdateFailMalformedHTLC msg_var = *msg;
12285 int64_t msg_ref = 0;
12286 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12287 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12288 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12289 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12290 msg_ref = (uintptr_t)msg_var.inner;
12291 if (msg_var.is_owned) {
12294 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12295 CHECK(obj != NULL);
12296 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
12297 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12298 (*env)->ExceptionDescribe(env);
12299 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
12301 if (get_jenv_res == JNI_EDETACHED) {
12302 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12305 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12306 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12308 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12309 if (get_jenv_res == JNI_EDETACHED) {
12310 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12312 DO_ASSERT(get_jenv_res == JNI_OK);
12314 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12315 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12316 LDKCommitmentSigned msg_var = *msg;
12317 int64_t msg_ref = 0;
12318 msg_var = CommitmentSigned_clone(&msg_var);
12319 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12320 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12321 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12322 msg_ref = (uintptr_t)msg_var.inner;
12323 if (msg_var.is_owned) {
12326 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12327 CHECK(obj != NULL);
12328 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
12329 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12330 (*env)->ExceptionDescribe(env);
12331 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
12333 if (get_jenv_res == JNI_EDETACHED) {
12334 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12337 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12338 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12340 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12341 if (get_jenv_res == JNI_EDETACHED) {
12342 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12344 DO_ASSERT(get_jenv_res == JNI_OK);
12346 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12347 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12348 LDKRevokeAndACK msg_var = *msg;
12349 int64_t msg_ref = 0;
12350 msg_var = RevokeAndACK_clone(&msg_var);
12351 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12352 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12353 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12354 msg_ref = (uintptr_t)msg_var.inner;
12355 if (msg_var.is_owned) {
12358 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12359 CHECK(obj != NULL);
12360 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
12361 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12362 (*env)->ExceptionDescribe(env);
12363 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
12365 if (get_jenv_res == JNI_EDETACHED) {
12366 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12369 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12370 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12372 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12373 if (get_jenv_res == JNI_EDETACHED) {
12374 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12376 DO_ASSERT(get_jenv_res == JNI_OK);
12378 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12379 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12380 LDKUpdateFee msg_var = *msg;
12381 int64_t msg_ref = 0;
12382 msg_var = UpdateFee_clone(&msg_var);
12383 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12384 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12385 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12386 msg_ref = (uintptr_t)msg_var.inner;
12387 if (msg_var.is_owned) {
12390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12391 CHECK(obj != NULL);
12392 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
12393 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12394 (*env)->ExceptionDescribe(env);
12395 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
12397 if (get_jenv_res == JNI_EDETACHED) {
12398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12401 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12405 if (get_jenv_res == JNI_EDETACHED) {
12406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12408 DO_ASSERT(get_jenv_res == JNI_OK);
12410 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12411 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12412 LDKAnnouncementSignatures msg_var = *msg;
12413 int64_t msg_ref = 0;
12414 msg_var = AnnouncementSignatures_clone(&msg_var);
12415 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12416 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12417 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12418 msg_ref = (uintptr_t)msg_var.inner;
12419 if (msg_var.is_owned) {
12422 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12423 CHECK(obj != NULL);
12424 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
12425 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12426 (*env)->ExceptionDescribe(env);
12427 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
12429 if (get_jenv_res == JNI_EDETACHED) {
12430 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12433 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
12434 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12436 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12437 if (get_jenv_res == JNI_EDETACHED) {
12438 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12440 DO_ASSERT(get_jenv_res == JNI_OK);
12442 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12443 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12444 jboolean no_connection_possible_conv = no_connection_possible;
12445 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12446 CHECK(obj != NULL);
12447 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
12448 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12449 (*env)->ExceptionDescribe(env);
12450 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
12452 if (get_jenv_res == JNI_EDETACHED) {
12453 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12456 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
12457 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12459 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12460 if (get_jenv_res == JNI_EDETACHED) {
12461 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12463 DO_ASSERT(get_jenv_res == JNI_OK);
12465 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12466 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12467 LDKInit msg_var = *msg;
12468 int64_t msg_ref = 0;
12469 msg_var = Init_clone(&msg_var);
12470 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12471 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12472 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12473 msg_ref = (uintptr_t)msg_var.inner;
12474 if (msg_var.is_owned) {
12477 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12478 CHECK(obj != NULL);
12479 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
12480 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12481 (*env)->ExceptionDescribe(env);
12482 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
12484 if (get_jenv_res == JNI_EDETACHED) {
12485 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12488 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12489 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12491 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12492 if (get_jenv_res == JNI_EDETACHED) {
12493 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12495 DO_ASSERT(get_jenv_res == JNI_OK);
12497 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12498 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12499 LDKChannelReestablish msg_var = *msg;
12500 int64_t msg_ref = 0;
12501 msg_var = ChannelReestablish_clone(&msg_var);
12502 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12503 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12504 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12505 msg_ref = (uintptr_t)msg_var.inner;
12506 if (msg_var.is_owned) {
12509 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12510 CHECK(obj != NULL);
12511 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
12512 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12513 (*env)->ExceptionDescribe(env);
12514 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
12516 if (get_jenv_res == JNI_EDETACHED) {
12517 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12520 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12521 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12523 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12524 if (get_jenv_res == JNI_EDETACHED) {
12525 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12527 DO_ASSERT(get_jenv_res == JNI_OK);
12529 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12530 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12531 LDKChannelUpdate msg_var = *msg;
12532 int64_t msg_ref = 0;
12533 msg_var = ChannelUpdate_clone(&msg_var);
12534 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12535 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12536 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12537 msg_ref = (uintptr_t)msg_var.inner;
12538 if (msg_var.is_owned) {
12541 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12542 CHECK(obj != NULL);
12543 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
12544 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12545 (*env)->ExceptionDescribe(env);
12546 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
12548 if (get_jenv_res == JNI_EDETACHED) {
12549 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12552 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12553 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12555 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12556 if (get_jenv_res == JNI_EDETACHED) {
12557 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12559 DO_ASSERT(get_jenv_res == JNI_OK);
12561 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12562 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12563 LDKErrorMessage msg_var = *msg;
12564 int64_t msg_ref = 0;
12565 msg_var = ErrorMessage_clone(&msg_var);
12566 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12567 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12568 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12569 msg_ref = (uintptr_t)msg_var.inner;
12570 if (msg_var.is_owned) {
12573 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12574 CHECK(obj != NULL);
12575 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
12576 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12577 (*env)->ExceptionDescribe(env);
12578 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
12580 if (get_jenv_res == JNI_EDETACHED) {
12581 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12584 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12585 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12586 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12587 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12589 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12590 jclass c = (*env)->GetObjectClass(env, o);
12592 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12593 atomic_init(&calls->refcnt, 1);
12594 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12595 calls->o = (*env)->NewWeakGlobalRef(env, o);
12596 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
12597 CHECK(calls->handle_open_channel_meth != NULL);
12598 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
12599 CHECK(calls->handle_accept_channel_meth != NULL);
12600 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
12601 CHECK(calls->handle_funding_created_meth != NULL);
12602 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
12603 CHECK(calls->handle_funding_signed_meth != NULL);
12604 calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
12605 CHECK(calls->handle_channel_ready_meth != NULL);
12606 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
12607 CHECK(calls->handle_shutdown_meth != NULL);
12608 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
12609 CHECK(calls->handle_closing_signed_meth != NULL);
12610 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
12611 CHECK(calls->handle_update_add_htlc_meth != NULL);
12612 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
12613 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
12614 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
12615 CHECK(calls->handle_update_fail_htlc_meth != NULL);
12616 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
12617 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
12618 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
12619 CHECK(calls->handle_commitment_signed_meth != NULL);
12620 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
12621 CHECK(calls->handle_revoke_and_ack_meth != NULL);
12622 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
12623 CHECK(calls->handle_update_fee_meth != NULL);
12624 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
12625 CHECK(calls->handle_announcement_signatures_meth != NULL);
12626 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
12627 CHECK(calls->peer_disconnected_meth != NULL);
12628 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12629 CHECK(calls->peer_connected_meth != NULL);
12630 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
12631 CHECK(calls->handle_channel_reestablish_meth != NULL);
12632 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
12633 CHECK(calls->handle_channel_update_meth != NULL);
12634 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
12635 CHECK(calls->handle_error_meth != NULL);
12637 LDKChannelMessageHandler ret = {
12638 .this_arg = (void*) calls,
12639 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12640 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12641 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12642 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12643 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12644 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12645 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12646 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12647 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12648 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12649 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12650 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12651 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12652 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12653 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12654 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12655 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12656 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12657 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12658 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12659 .free = LDKChannelMessageHandler_JCalls_free,
12660 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12662 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12666 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12667 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12668 return (uint64_t)res_ptr;
12670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12671 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
12672 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12673 DO_ASSERT((res_ptr & 1) == 0);
12674 return (int64_t)(res_ptr | 1);
12676 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) {
12677 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12678 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12679 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12680 LDKPublicKey their_node_id_ref;
12681 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12682 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12683 LDKInitFeatures their_features_conv;
12684 their_features_conv.inner = (void*)(their_features & (~1));
12685 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12686 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12687 their_features_conv = InitFeatures_clone(&their_features_conv);
12688 LDKOpenChannel msg_conv;
12689 msg_conv.inner = (void*)(msg & (~1));
12690 msg_conv.is_owned = false;
12691 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12692 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12695 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) {
12696 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12697 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12698 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12699 LDKPublicKey their_node_id_ref;
12700 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12701 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12702 LDKInitFeatures their_features_conv;
12703 their_features_conv.inner = (void*)(their_features & (~1));
12704 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12705 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12706 their_features_conv = InitFeatures_clone(&their_features_conv);
12707 LDKAcceptChannel msg_conv;
12708 msg_conv.inner = (void*)(msg & (~1));
12709 msg_conv.is_owned = false;
12710 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12711 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12714 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) {
12715 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12716 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12717 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12718 LDKPublicKey their_node_id_ref;
12719 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12720 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12721 LDKFundingCreated msg_conv;
12722 msg_conv.inner = (void*)(msg & (~1));
12723 msg_conv.is_owned = false;
12724 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12725 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12728 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) {
12729 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12730 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12731 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12732 LDKPublicKey their_node_id_ref;
12733 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12734 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12735 LDKFundingSigned msg_conv;
12736 msg_conv.inner = (void*)(msg & (~1));
12737 msg_conv.is_owned = false;
12738 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12739 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12742 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) {
12743 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12744 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12745 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12746 LDKPublicKey their_node_id_ref;
12747 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12748 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12749 LDKChannelReady msg_conv;
12750 msg_conv.inner = (void*)(msg & (~1));
12751 msg_conv.is_owned = false;
12752 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12753 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12756 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) {
12757 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12758 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12759 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12760 LDKPublicKey their_node_id_ref;
12761 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12762 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12763 LDKInitFeatures their_features_conv;
12764 their_features_conv.inner = (void*)(their_features & (~1));
12765 their_features_conv.is_owned = false;
12766 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12767 LDKShutdown msg_conv;
12768 msg_conv.inner = (void*)(msg & (~1));
12769 msg_conv.is_owned = false;
12770 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12771 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
12774 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) {
12775 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12776 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12777 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12778 LDKPublicKey their_node_id_ref;
12779 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12780 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12781 LDKClosingSigned msg_conv;
12782 msg_conv.inner = (void*)(msg & (~1));
12783 msg_conv.is_owned = false;
12784 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12785 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12788 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) {
12789 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12790 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12791 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12792 LDKPublicKey their_node_id_ref;
12793 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12794 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12795 LDKUpdateAddHTLC msg_conv;
12796 msg_conv.inner = (void*)(msg & (~1));
12797 msg_conv.is_owned = false;
12798 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12799 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12802 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) {
12803 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12804 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12805 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12806 LDKPublicKey their_node_id_ref;
12807 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12808 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12809 LDKUpdateFulfillHTLC msg_conv;
12810 msg_conv.inner = (void*)(msg & (~1));
12811 msg_conv.is_owned = false;
12812 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12813 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12816 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) {
12817 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12818 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12819 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12820 LDKPublicKey their_node_id_ref;
12821 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12822 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12823 LDKUpdateFailHTLC msg_conv;
12824 msg_conv.inner = (void*)(msg & (~1));
12825 msg_conv.is_owned = false;
12826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12827 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12830 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) {
12831 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12832 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12833 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12834 LDKPublicKey their_node_id_ref;
12835 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12836 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12837 LDKUpdateFailMalformedHTLC msg_conv;
12838 msg_conv.inner = (void*)(msg & (~1));
12839 msg_conv.is_owned = false;
12840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12841 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12844 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) {
12845 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12846 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12847 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12848 LDKPublicKey their_node_id_ref;
12849 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12850 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12851 LDKCommitmentSigned msg_conv;
12852 msg_conv.inner = (void*)(msg & (~1));
12853 msg_conv.is_owned = false;
12854 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12855 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12858 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) {
12859 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12860 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12861 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12862 LDKPublicKey their_node_id_ref;
12863 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12864 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12865 LDKRevokeAndACK msg_conv;
12866 msg_conv.inner = (void*)(msg & (~1));
12867 msg_conv.is_owned = false;
12868 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12869 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12872 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) {
12873 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12874 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12875 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12876 LDKPublicKey their_node_id_ref;
12877 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12878 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12879 LDKUpdateFee msg_conv;
12880 msg_conv.inner = (void*)(msg & (~1));
12881 msg_conv.is_owned = false;
12882 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12883 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12886 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) {
12887 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12888 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12889 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12890 LDKPublicKey their_node_id_ref;
12891 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12892 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12893 LDKAnnouncementSignatures msg_conv;
12894 msg_conv.inner = (void*)(msg & (~1));
12895 msg_conv.is_owned = false;
12896 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12897 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12900 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) {
12901 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12902 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12903 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12904 LDKPublicKey their_node_id_ref;
12905 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12906 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12907 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
12910 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) {
12911 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12912 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12913 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12914 LDKPublicKey their_node_id_ref;
12915 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12916 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12918 msg_conv.inner = (void*)(msg & (~1));
12919 msg_conv.is_owned = false;
12920 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12921 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12924 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) {
12925 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12926 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12927 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12928 LDKPublicKey their_node_id_ref;
12929 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12930 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12931 LDKChannelReestablish msg_conv;
12932 msg_conv.inner = (void*)(msg & (~1));
12933 msg_conv.is_owned = false;
12934 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12935 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12938 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) {
12939 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12940 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12941 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12942 LDKPublicKey their_node_id_ref;
12943 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12944 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12945 LDKChannelUpdate msg_conv;
12946 msg_conv.inner = (void*)(msg & (~1));
12947 msg_conv.is_owned = false;
12948 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12949 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12952 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) {
12953 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12954 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12955 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12956 LDKPublicKey their_node_id_ref;
12957 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12958 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12959 LDKErrorMessage msg_conv;
12960 msg_conv.inner = (void*)(msg & (~1));
12961 msg_conv.is_owned = false;
12962 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12963 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12966 typedef struct LDKRoutingMessageHandler_JCalls {
12967 atomic_size_t refcnt;
12970 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12971 jmethodID handle_node_announcement_meth;
12972 jmethodID handle_channel_announcement_meth;
12973 jmethodID handle_channel_update_meth;
12974 jmethodID get_next_channel_announcements_meth;
12975 jmethodID get_next_node_announcements_meth;
12976 jmethodID peer_connected_meth;
12977 jmethodID handle_reply_channel_range_meth;
12978 jmethodID handle_reply_short_channel_ids_end_meth;
12979 jmethodID handle_query_channel_range_meth;
12980 jmethodID handle_query_short_channel_ids_meth;
12981 } LDKRoutingMessageHandler_JCalls;
12982 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12983 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12984 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12986 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12987 if (get_jenv_res == JNI_EDETACHED) {
12988 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12990 DO_ASSERT(get_jenv_res == JNI_OK);
12992 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12993 if (get_jenv_res == JNI_EDETACHED) {
12994 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12999 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
13000 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13002 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13003 if (get_jenv_res == JNI_EDETACHED) {
13004 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13006 DO_ASSERT(get_jenv_res == JNI_OK);
13008 LDKNodeAnnouncement msg_var = *msg;
13009 int64_t msg_ref = 0;
13010 msg_var = NodeAnnouncement_clone(&msg_var);
13011 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13012 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13013 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13014 msg_ref = (uintptr_t)msg_var.inner;
13015 if (msg_var.is_owned) {
13018 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13019 CHECK(obj != NULL);
13020 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
13021 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13022 (*env)->ExceptionDescribe(env);
13023 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
13025 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13026 CHECK_ACCESS(ret_ptr);
13027 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13029 if (get_jenv_res == JNI_EDETACHED) {
13030 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13034 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13035 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13037 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13038 if (get_jenv_res == JNI_EDETACHED) {
13039 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13041 DO_ASSERT(get_jenv_res == JNI_OK);
13043 LDKChannelAnnouncement msg_var = *msg;
13044 int64_t msg_ref = 0;
13045 msg_var = ChannelAnnouncement_clone(&msg_var);
13046 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13047 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13048 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13049 msg_ref = (uintptr_t)msg_var.inner;
13050 if (msg_var.is_owned) {
13053 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13054 CHECK(obj != NULL);
13055 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
13056 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13057 (*env)->ExceptionDescribe(env);
13058 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
13060 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13061 CHECK_ACCESS(ret_ptr);
13062 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13064 if (get_jenv_res == JNI_EDETACHED) {
13065 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13069 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13070 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13073 if (get_jenv_res == JNI_EDETACHED) {
13074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13076 DO_ASSERT(get_jenv_res == JNI_OK);
13078 LDKChannelUpdate msg_var = *msg;
13079 int64_t msg_ref = 0;
13080 msg_var = ChannelUpdate_clone(&msg_var);
13081 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13082 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13083 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13084 msg_ref = (uintptr_t)msg_var.inner;
13085 if (msg_var.is_owned) {
13088 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13089 CHECK(obj != NULL);
13090 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
13091 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13092 (*env)->ExceptionDescribe(env);
13093 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
13095 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13096 CHECK_ACCESS(ret_ptr);
13097 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13099 if (get_jenv_res == JNI_EDETACHED) {
13100 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13104 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
13105 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13107 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13108 if (get_jenv_res == JNI_EDETACHED) {
13109 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13111 DO_ASSERT(get_jenv_res == JNI_OK);
13113 int64_t starting_point_conv = starting_point;
13114 int8_t batch_amount_conv = batch_amount;
13115 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13116 CHECK(obj != NULL);
13117 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
13118 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13119 (*env)->ExceptionDescribe(env);
13120 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
13122 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
13123 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13124 if (ret_constr.datalen > 0)
13125 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13127 ret_constr.data = NULL;
13128 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13129 for (size_t h = 0; h < ret_constr.datalen; h++) {
13130 int64_t ret_conv_59 = ret_vals[h];
13131 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
13132 CHECK_ACCESS(ret_conv_59_ptr);
13133 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
13134 FREE((void*)ret_conv_59);
13135 ret_constr.data[h] = ret_conv_59_conv;
13137 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13138 if (get_jenv_res == JNI_EDETACHED) {
13139 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13143 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
13144 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13146 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13147 if (get_jenv_res == JNI_EDETACHED) {
13148 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13150 DO_ASSERT(get_jenv_res == JNI_OK);
13152 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
13153 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
13154 int8_t batch_amount_conv = batch_amount;
13155 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13156 CHECK(obj != NULL);
13157 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
13158 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13159 (*env)->ExceptionDescribe(env);
13160 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
13162 LDKCVec_NodeAnnouncementZ ret_constr;
13163 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13164 if (ret_constr.datalen > 0)
13165 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13167 ret_constr.data = NULL;
13168 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13169 for (size_t s = 0; s < ret_constr.datalen; s++) {
13170 int64_t ret_conv_18 = ret_vals[s];
13171 LDKNodeAnnouncement ret_conv_18_conv;
13172 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
13173 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
13174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
13175 ret_constr.data[s] = ret_conv_18_conv;
13177 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13178 if (get_jenv_res == JNI_EDETACHED) {
13179 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13183 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
13184 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13186 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13187 if (get_jenv_res == JNI_EDETACHED) {
13188 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13190 DO_ASSERT(get_jenv_res == JNI_OK);
13192 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13193 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13194 LDKInit init_var = *init;
13195 int64_t init_ref = 0;
13196 init_var = Init_clone(&init_var);
13197 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13198 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13199 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13200 init_ref = (uintptr_t)init_var.inner;
13201 if (init_var.is_owned) {
13204 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13205 CHECK(obj != NULL);
13206 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
13207 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13208 (*env)->ExceptionDescribe(env);
13209 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
13211 if (get_jenv_res == JNI_EDETACHED) {
13212 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13215 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13216 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13218 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13219 if (get_jenv_res == JNI_EDETACHED) {
13220 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13222 DO_ASSERT(get_jenv_res == JNI_OK);
13224 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13225 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13226 LDKReplyChannelRange msg_var = msg;
13227 int64_t msg_ref = 0;
13228 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13229 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13230 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13231 msg_ref = (uintptr_t)msg_var.inner;
13232 if (msg_var.is_owned) {
13235 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13236 CHECK(obj != NULL);
13237 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
13238 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13239 (*env)->ExceptionDescribe(env);
13240 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
13242 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13243 CHECK_ACCESS(ret_ptr);
13244 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13246 if (get_jenv_res == JNI_EDETACHED) {
13247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13251 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13252 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13254 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13255 if (get_jenv_res == JNI_EDETACHED) {
13256 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13258 DO_ASSERT(get_jenv_res == JNI_OK);
13260 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13261 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13262 LDKReplyShortChannelIdsEnd msg_var = msg;
13263 int64_t msg_ref = 0;
13264 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13265 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13266 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13267 msg_ref = (uintptr_t)msg_var.inner;
13268 if (msg_var.is_owned) {
13271 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13272 CHECK(obj != NULL);
13273 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
13274 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13275 (*env)->ExceptionDescribe(env);
13276 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
13278 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13279 CHECK_ACCESS(ret_ptr);
13280 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13282 if (get_jenv_res == JNI_EDETACHED) {
13283 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13287 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13288 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13291 if (get_jenv_res == JNI_EDETACHED) {
13292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13294 DO_ASSERT(get_jenv_res == JNI_OK);
13296 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13297 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13298 LDKQueryChannelRange msg_var = msg;
13299 int64_t msg_ref = 0;
13300 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13301 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13302 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13303 msg_ref = (uintptr_t)msg_var.inner;
13304 if (msg_var.is_owned) {
13307 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13308 CHECK(obj != NULL);
13309 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
13310 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13311 (*env)->ExceptionDescribe(env);
13312 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
13314 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13315 CHECK_ACCESS(ret_ptr);
13316 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13318 if (get_jenv_res == JNI_EDETACHED) {
13319 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13323 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13324 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13326 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13327 if (get_jenv_res == JNI_EDETACHED) {
13328 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13330 DO_ASSERT(get_jenv_res == JNI_OK);
13332 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13333 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13334 LDKQueryShortChannelIds msg_var = msg;
13335 int64_t msg_ref = 0;
13336 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13337 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13338 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13339 msg_ref = (uintptr_t)msg_var.inner;
13340 if (msg_var.is_owned) {
13343 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13344 CHECK(obj != NULL);
13345 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
13346 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13347 (*env)->ExceptionDescribe(env);
13348 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
13350 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13351 CHECK_ACCESS(ret_ptr);
13352 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13354 if (get_jenv_res == JNI_EDETACHED) {
13355 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13359 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13360 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13361 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13362 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13364 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13365 jclass c = (*env)->GetObjectClass(env, o);
13367 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13368 atomic_init(&calls->refcnt, 1);
13369 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13370 calls->o = (*env)->NewWeakGlobalRef(env, o);
13371 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
13372 CHECK(calls->handle_node_announcement_meth != NULL);
13373 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
13374 CHECK(calls->handle_channel_announcement_meth != NULL);
13375 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
13376 CHECK(calls->handle_channel_update_meth != NULL);
13377 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
13378 CHECK(calls->get_next_channel_announcements_meth != NULL);
13379 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
13380 CHECK(calls->get_next_node_announcements_meth != NULL);
13381 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
13382 CHECK(calls->peer_connected_meth != NULL);
13383 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
13384 CHECK(calls->handle_reply_channel_range_meth != NULL);
13385 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
13386 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
13387 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
13388 CHECK(calls->handle_query_channel_range_meth != NULL);
13389 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
13390 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
13392 LDKRoutingMessageHandler ret = {
13393 .this_arg = (void*) calls,
13394 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13395 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13396 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13397 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
13398 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
13399 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13400 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13401 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13402 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13403 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13404 .free = LDKRoutingMessageHandler_JCalls_free,
13405 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
13407 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13411 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13412 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
13413 return (uint64_t)res_ptr;
13415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
13416 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
13417 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
13418 DO_ASSERT((res_ptr & 1) == 0);
13419 return (int64_t)(res_ptr | 1);
13421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13422 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13423 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13424 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13425 LDKNodeAnnouncement msg_conv;
13426 msg_conv.inner = (void*)(msg & (~1));
13427 msg_conv.is_owned = false;
13428 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13429 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13430 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13431 return (int64_t)ret_conv;
13434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13435 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13436 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13437 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13438 LDKChannelAnnouncement msg_conv;
13439 msg_conv.inner = (void*)(msg & (~1));
13440 msg_conv.is_owned = false;
13441 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13442 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13443 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13444 return (int64_t)ret_conv;
13447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13448 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13449 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13450 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13451 LDKChannelUpdate msg_conv;
13452 msg_conv.inner = (void*)(msg & (~1));
13453 msg_conv.is_owned = false;
13454 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13455 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13456 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13457 return (int64_t)ret_conv;
13460 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) {
13461 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13462 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13463 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13464 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
13465 int64_tArray ret_arr = NULL;
13466 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13467 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13468 for (size_t h = 0; h < ret_var.datalen; h++) {
13469 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13470 *ret_conv_59_conv = ret_var.data[h];
13471 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
13473 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13474 FREE(ret_var.data);
13478 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) {
13479 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13480 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13481 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13482 LDKPublicKey starting_point_ref;
13483 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
13484 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
13485 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
13486 int64_tArray ret_arr = NULL;
13487 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13488 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13489 for (size_t s = 0; s < ret_var.datalen; s++) {
13490 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
13491 int64_t ret_conv_18_ref = 0;
13492 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13493 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
13495 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
13496 if (ret_conv_18_var.is_owned) {
13497 ret_conv_18_ref |= 1;
13499 ret_arr_ptr[s] = ret_conv_18_ref;
13501 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13502 FREE(ret_var.data);
13506 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) {
13507 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13508 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13509 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13510 LDKPublicKey their_node_id_ref;
13511 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13512 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13514 init_conv.inner = (void*)(init & (~1));
13515 init_conv.is_owned = false;
13516 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13517 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13520 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) {
13521 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13522 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13523 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13524 LDKPublicKey their_node_id_ref;
13525 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13526 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13527 LDKReplyChannelRange msg_conv;
13528 msg_conv.inner = (void*)(msg & (~1));
13529 msg_conv.is_owned = (msg & 1) || (msg == 0);
13530 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13531 msg_conv = ReplyChannelRange_clone(&msg_conv);
13532 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13533 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13534 return (int64_t)ret_conv;
13537 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) {
13538 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13539 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13540 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13541 LDKPublicKey their_node_id_ref;
13542 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13543 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13544 LDKReplyShortChannelIdsEnd msg_conv;
13545 msg_conv.inner = (void*)(msg & (~1));
13546 msg_conv.is_owned = (msg & 1) || (msg == 0);
13547 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13548 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13549 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13550 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13551 return (int64_t)ret_conv;
13554 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) {
13555 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13556 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13557 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13558 LDKPublicKey their_node_id_ref;
13559 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13560 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13561 LDKQueryChannelRange msg_conv;
13562 msg_conv.inner = (void*)(msg & (~1));
13563 msg_conv.is_owned = (msg & 1) || (msg == 0);
13564 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13565 msg_conv = QueryChannelRange_clone(&msg_conv);
13566 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13567 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13568 return (int64_t)ret_conv;
13571 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) {
13572 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13573 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13574 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13575 LDKPublicKey their_node_id_ref;
13576 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13577 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13578 LDKQueryShortChannelIds msg_conv;
13579 msg_conv.inner = (void*)(msg & (~1));
13580 msg_conv.is_owned = (msg & 1) || (msg == 0);
13581 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13582 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13583 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13584 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13585 return (int64_t)ret_conv;
13588 typedef struct LDKCustomMessageReader_JCalls {
13589 atomic_size_t refcnt;
13592 jmethodID read_meth;
13593 } LDKCustomMessageReader_JCalls;
13594 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13595 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13596 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13598 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13599 if (get_jenv_res == JNI_EDETACHED) {
13600 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13602 DO_ASSERT(get_jenv_res == JNI_OK);
13604 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13605 if (get_jenv_res == JNI_EDETACHED) {
13606 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13611 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13612 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13614 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13615 if (get_jenv_res == JNI_EDETACHED) {
13616 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13618 DO_ASSERT(get_jenv_res == JNI_OK);
13620 int16_t message_type_conv = message_type;
13621 LDKu8slice buffer_var = buffer;
13622 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
13623 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
13624 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13625 CHECK(obj != NULL);
13626 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
13627 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13628 (*env)->ExceptionDescribe(env);
13629 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
13631 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13632 CHECK_ACCESS(ret_ptr);
13633 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13635 if (get_jenv_res == JNI_EDETACHED) {
13636 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13640 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13641 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13642 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13644 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
13645 jclass c = (*env)->GetObjectClass(env, o);
13647 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13648 atomic_init(&calls->refcnt, 1);
13649 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13650 calls->o = (*env)->NewWeakGlobalRef(env, o);
13651 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
13652 CHECK(calls->read_meth != NULL);
13654 LDKCustomMessageReader ret = {
13655 .this_arg = (void*) calls,
13656 .read = read_LDKCustomMessageReader_jcall,
13657 .free = LDKCustomMessageReader_JCalls_free,
13661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
13662 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13663 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
13664 return (uint64_t)res_ptr;
13666 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) {
13667 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13668 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13669 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13670 LDKu8slice buffer_ref;
13671 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
13672 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
13673 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13674 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13675 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
13676 return (int64_t)ret_conv;
13679 typedef struct LDKCustomMessageHandler_JCalls {
13680 atomic_size_t refcnt;
13683 LDKCustomMessageReader_JCalls* CustomMessageReader;
13684 jmethodID handle_custom_message_meth;
13685 jmethodID get_and_clear_pending_msg_meth;
13686 } LDKCustomMessageHandler_JCalls;
13687 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13688 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13689 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13691 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13692 if (get_jenv_res == JNI_EDETACHED) {
13693 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13695 DO_ASSERT(get_jenv_res == JNI_OK);
13697 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13698 if (get_jenv_res == JNI_EDETACHED) {
13699 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13704 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13705 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13707 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13708 if (get_jenv_res == JNI_EDETACHED) {
13709 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13711 DO_ASSERT(get_jenv_res == JNI_OK);
13713 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13715 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
13716 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
13717 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13718 CHECK(obj != NULL);
13719 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
13720 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13721 (*env)->ExceptionDescribe(env);
13722 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
13724 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13725 CHECK_ACCESS(ret_ptr);
13726 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13728 if (get_jenv_res == JNI_EDETACHED) {
13729 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13733 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13734 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13736 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13737 if (get_jenv_res == JNI_EDETACHED) {
13738 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13740 DO_ASSERT(get_jenv_res == JNI_OK);
13742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13743 CHECK(obj != NULL);
13744 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
13745 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13746 (*env)->ExceptionDescribe(env);
13747 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
13749 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13750 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13751 if (ret_constr.datalen > 0)
13752 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13754 ret_constr.data = NULL;
13755 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13756 for (size_t z = 0; z < ret_constr.datalen; z++) {
13757 int64_t ret_conv_25 = ret_vals[z];
13758 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
13759 CHECK_ACCESS(ret_conv_25_ptr);
13760 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13761 FREE((void*)ret_conv_25);
13762 ret_constr.data[z] = ret_conv_25_conv;
13764 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13765 if (get_jenv_res == JNI_EDETACHED) {
13766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13770 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13771 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13772 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13773 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13775 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13776 jclass c = (*env)->GetObjectClass(env, o);
13778 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13779 atomic_init(&calls->refcnt, 1);
13780 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13781 calls->o = (*env)->NewWeakGlobalRef(env, o);
13782 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
13783 CHECK(calls->handle_custom_message_meth != NULL);
13784 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
13785 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
13787 LDKCustomMessageHandler ret = {
13788 .this_arg = (void*) calls,
13789 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13790 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13791 .free = LDKCustomMessageHandler_JCalls_free,
13792 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
13794 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13798 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13799 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
13800 return (uint64_t)res_ptr;
13802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
13803 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
13804 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
13805 DO_ASSERT((res_ptr & 1) == 0);
13806 return (int64_t)(res_ptr | 1);
13808 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) {
13809 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13810 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13811 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13812 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
13813 CHECK_ACCESS(msg_ptr);
13814 LDKType msg_conv = *(LDKType*)(msg_ptr);
13815 if (msg_conv.free == LDKType_JCalls_free) {
13816 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13817 LDKType_JCalls_cloned(&msg_conv);
13819 LDKPublicKey sender_node_id_ref;
13820 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
13821 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
13822 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13823 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13824 return (int64_t)ret_conv;
13827 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
13828 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13829 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13830 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13831 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13832 int64_tArray ret_arr = NULL;
13833 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13834 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13835 for (size_t z = 0; z < ret_var.datalen; z++) {
13836 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13837 *ret_conv_25_conv = ret_var.data[z];
13838 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
13840 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13841 FREE(ret_var.data);
13845 typedef struct LDKSocketDescriptor_JCalls {
13846 atomic_size_t refcnt;
13849 jmethodID send_data_meth;
13850 jmethodID disconnect_socket_meth;
13852 jmethodID hash_meth;
13853 } LDKSocketDescriptor_JCalls;
13854 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13855 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13856 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13858 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13859 if (get_jenv_res == JNI_EDETACHED) {
13860 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13862 DO_ASSERT(get_jenv_res == JNI_OK);
13864 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13865 if (get_jenv_res == JNI_EDETACHED) {
13866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13871 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13872 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13874 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13875 if (get_jenv_res == JNI_EDETACHED) {
13876 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13878 DO_ASSERT(get_jenv_res == JNI_OK);
13880 LDKu8slice data_var = data;
13881 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
13882 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
13883 jboolean resume_read_conv = resume_read;
13884 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13885 CHECK(obj != NULL);
13886 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
13887 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13888 (*env)->ExceptionDescribe(env);
13889 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
13891 if (get_jenv_res == JNI_EDETACHED) {
13892 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13896 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13897 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13899 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13900 if (get_jenv_res == JNI_EDETACHED) {
13901 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13903 DO_ASSERT(get_jenv_res == JNI_OK);
13905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13906 CHECK(obj != NULL);
13907 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
13908 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13909 (*env)->ExceptionDescribe(env);
13910 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
13912 if (get_jenv_res == JNI_EDETACHED) {
13913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13916 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13917 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13920 if (get_jenv_res == JNI_EDETACHED) {
13921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13923 DO_ASSERT(get_jenv_res == JNI_OK);
13925 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13926 *other_arg_clone = SocketDescriptor_clone(other_arg);
13927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13928 CHECK(obj != NULL);
13929 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
13930 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13931 (*env)->ExceptionDescribe(env);
13932 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
13934 if (get_jenv_res == JNI_EDETACHED) {
13935 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13939 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13940 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13942 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13943 if (get_jenv_res == JNI_EDETACHED) {
13944 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13946 DO_ASSERT(get_jenv_res == JNI_OK);
13948 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13949 CHECK(obj != NULL);
13950 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
13951 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13952 (*env)->ExceptionDescribe(env);
13953 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
13955 if (get_jenv_res == JNI_EDETACHED) {
13956 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13960 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13961 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13962 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13964 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
13965 jclass c = (*env)->GetObjectClass(env, o);
13967 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13968 atomic_init(&calls->refcnt, 1);
13969 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13970 calls->o = (*env)->NewWeakGlobalRef(env, o);
13971 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
13972 CHECK(calls->send_data_meth != NULL);
13973 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
13974 CHECK(calls->disconnect_socket_meth != NULL);
13975 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
13976 CHECK(calls->eq_meth != NULL);
13977 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
13978 CHECK(calls->hash_meth != NULL);
13980 LDKSocketDescriptor ret = {
13981 .this_arg = (void*) calls,
13982 .send_data = send_data_LDKSocketDescriptor_jcall,
13983 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13984 .eq = eq_LDKSocketDescriptor_jcall,
13985 .hash = hash_LDKSocketDescriptor_jcall,
13986 .cloned = LDKSocketDescriptor_JCalls_cloned,
13987 .free = LDKSocketDescriptor_JCalls_free,
13991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
13992 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13993 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
13994 return (uint64_t)res_ptr;
13996 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) {
13997 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13998 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13999 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14000 LDKu8slice data_ref;
14001 data_ref.datalen = (*env)->GetArrayLength(env, data);
14002 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14003 int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14004 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
14009 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14010 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14011 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14012 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14016 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14017 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14018 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14019 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14023 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
14024 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
14025 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
14026 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
14027 static jclass LDKEffectiveCapacity_Total_class = NULL;
14028 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
14029 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
14030 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
14031 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
14032 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
14033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
14034 LDKEffectiveCapacity_ExactLiquidity_class =
14035 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
14036 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
14037 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
14038 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
14039 LDKEffectiveCapacity_MaximumHTLC_class =
14040 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
14041 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
14042 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
14043 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
14044 LDKEffectiveCapacity_Total_class =
14045 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
14046 CHECK(LDKEffectiveCapacity_Total_class != NULL);
14047 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
14048 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
14049 LDKEffectiveCapacity_Infinite_class =
14050 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
14051 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
14052 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
14053 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
14054 LDKEffectiveCapacity_Unknown_class =
14055 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
14056 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
14057 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
14058 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
14060 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14061 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
14063 case LDKEffectiveCapacity_ExactLiquidity: {
14064 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14065 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
14067 case LDKEffectiveCapacity_MaximumHTLC: {
14068 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
14069 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
14071 case LDKEffectiveCapacity_Total: {
14072 int64_t capacity_msat_conv = obj->total.capacity_msat;
14073 int64_t htlc_maximum_msat_ref = ((uintptr_t)&obj->total.htlc_maximum_msat) | 1;
14074 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
14076 case LDKEffectiveCapacity_Infinite: {
14077 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
14079 case LDKEffectiveCapacity_Unknown: {
14080 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
14085 typedef struct LDKLockableScore_JCalls {
14086 atomic_size_t refcnt;
14089 jmethodID lock_meth;
14090 } LDKLockableScore_JCalls;
14091 static void LDKLockableScore_JCalls_free(void* this_arg) {
14092 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14093 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14095 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14096 if (get_jenv_res == JNI_EDETACHED) {
14097 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14099 DO_ASSERT(get_jenv_res == JNI_OK);
14101 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14102 if (get_jenv_res == JNI_EDETACHED) {
14103 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14108 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
14109 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14111 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14112 if (get_jenv_res == JNI_EDETACHED) {
14113 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14115 DO_ASSERT(get_jenv_res == JNI_OK);
14117 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14118 CHECK(obj != NULL);
14119 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
14120 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14121 (*env)->ExceptionDescribe(env);
14122 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
14124 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14125 CHECK_ACCESS(ret_ptr);
14126 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
14127 if (ret_conv.free == LDKScore_JCalls_free) {
14128 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14129 LDKScore_JCalls_cloned(&ret_conv);
14130 }// WARNING: we may need a move here but no clone is available for LDKScore
14132 if (get_jenv_res == JNI_EDETACHED) {
14133 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14137 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
14138 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
14139 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14141 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
14142 jclass c = (*env)->GetObjectClass(env, o);
14144 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
14145 atomic_init(&calls->refcnt, 1);
14146 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14147 calls->o = (*env)->NewWeakGlobalRef(env, o);
14148 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
14149 CHECK(calls->lock_meth != NULL);
14151 LDKLockableScore ret = {
14152 .this_arg = (void*) calls,
14153 .lock = lock_LDKLockableScore_jcall,
14154 .free = LDKLockableScore_JCalls_free,
14158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
14159 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
14160 *res_ptr = LDKLockableScore_init(env, clz, o);
14161 return (uint64_t)res_ptr;
14163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
14164 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14165 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14166 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14167 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
14168 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
14169 return (int64_t)ret_ret;
14172 static jclass LDKGossipSync_P2P_class = NULL;
14173 static jmethodID LDKGossipSync_P2P_meth = NULL;
14174 static jclass LDKGossipSync_Rapid_class = NULL;
14175 static jmethodID LDKGossipSync_Rapid_meth = NULL;
14176 static jclass LDKGossipSync_None_class = NULL;
14177 static jmethodID LDKGossipSync_None_meth = NULL;
14178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
14179 LDKGossipSync_P2P_class =
14180 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
14181 CHECK(LDKGossipSync_P2P_class != NULL);
14182 LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
14183 CHECK(LDKGossipSync_P2P_meth != NULL);
14184 LDKGossipSync_Rapid_class =
14185 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
14186 CHECK(LDKGossipSync_Rapid_class != NULL);
14187 LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
14188 CHECK(LDKGossipSync_Rapid_meth != NULL);
14189 LDKGossipSync_None_class =
14190 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
14191 CHECK(LDKGossipSync_None_class != NULL);
14192 LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
14193 CHECK(LDKGossipSync_None_meth != NULL);
14195 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14196 LDKGossipSync *obj = (LDKGossipSync*)(ptr & ~1);
14198 case LDKGossipSync_P2P: {
14199 LDKP2PGossipSync p2p_var = obj->p2p;
14200 int64_t p2p_ref = 0;
14201 CHECK((((uintptr_t)p2p_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14202 CHECK((((uintptr_t)&p2p_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14203 CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14204 p2p_ref = (uintptr_t)p2p_var.inner & ~1;
14205 return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
14207 case LDKGossipSync_Rapid: {
14208 LDKRapidGossipSync rapid_var = obj->rapid;
14209 int64_t rapid_ref = 0;
14210 CHECK((((uintptr_t)rapid_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14211 CHECK((((uintptr_t)&rapid_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14212 CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14213 rapid_ref = (uintptr_t)rapid_var.inner & ~1;
14214 return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
14216 case LDKGossipSync_None: {
14217 return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
14222 static jclass LDKFallback_SegWitProgram_class = NULL;
14223 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
14224 static jclass LDKFallback_PubKeyHash_class = NULL;
14225 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
14226 static jclass LDKFallback_ScriptHash_class = NULL;
14227 static jmethodID LDKFallback_ScriptHash_meth = NULL;
14228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
14229 LDKFallback_SegWitProgram_class =
14230 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
14231 CHECK(LDKFallback_SegWitProgram_class != NULL);
14232 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
14233 CHECK(LDKFallback_SegWitProgram_meth != NULL);
14234 LDKFallback_PubKeyHash_class =
14235 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
14236 CHECK(LDKFallback_PubKeyHash_class != NULL);
14237 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
14238 CHECK(LDKFallback_PubKeyHash_meth != NULL);
14239 LDKFallback_ScriptHash_class =
14240 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
14241 CHECK(LDKFallback_ScriptHash_class != NULL);
14242 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
14243 CHECK(LDKFallback_ScriptHash_meth != NULL);
14245 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14246 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
14248 case LDKFallback_SegWitProgram: {
14249 uint8_t version_val = obj->seg_wit_program.version._0;
14250 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14251 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
14252 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
14253 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
14255 case LDKFallback_PubKeyHash: {
14256 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
14257 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
14258 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
14260 case LDKFallback_ScriptHash: {
14261 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
14262 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
14263 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
14268 typedef struct LDKPayer_JCalls {
14269 atomic_size_t refcnt;
14272 jmethodID node_id_meth;
14273 jmethodID first_hops_meth;
14274 jmethodID send_payment_meth;
14275 jmethodID send_spontaneous_payment_meth;
14276 jmethodID retry_payment_meth;
14277 jmethodID abandon_payment_meth;
14279 static void LDKPayer_JCalls_free(void* this_arg) {
14280 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14281 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14283 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14284 if (get_jenv_res == JNI_EDETACHED) {
14285 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14287 DO_ASSERT(get_jenv_res == JNI_OK);
14289 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14290 if (get_jenv_res == JNI_EDETACHED) {
14291 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14296 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
14297 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14299 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14300 if (get_jenv_res == JNI_EDETACHED) {
14301 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14303 DO_ASSERT(get_jenv_res == JNI_OK);
14305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14306 CHECK(obj != NULL);
14307 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
14308 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14309 (*env)->ExceptionDescribe(env);
14310 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
14312 LDKPublicKey ret_ref;
14313 CHECK((*env)->GetArrayLength(env, ret) == 33);
14314 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
14315 if (get_jenv_res == JNI_EDETACHED) {
14316 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14320 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
14321 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14323 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14324 if (get_jenv_res == JNI_EDETACHED) {
14325 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14327 DO_ASSERT(get_jenv_res == JNI_OK);
14329 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14330 CHECK(obj != NULL);
14331 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
14332 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14333 (*env)->ExceptionDescribe(env);
14334 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
14336 LDKCVec_ChannelDetailsZ ret_constr;
14337 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14338 if (ret_constr.datalen > 0)
14339 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14341 ret_constr.data = NULL;
14342 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14343 for (size_t q = 0; q < ret_constr.datalen; q++) {
14344 int64_t ret_conv_16 = ret_vals[q];
14345 LDKChannelDetails ret_conv_16_conv;
14346 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
14347 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
14348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
14349 ret_constr.data[q] = ret_conv_16_conv;
14351 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14352 if (get_jenv_res == JNI_EDETACHED) {
14353 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14357 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
14358 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14360 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14361 if (get_jenv_res == JNI_EDETACHED) {
14362 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14364 DO_ASSERT(get_jenv_res == JNI_OK);
14366 LDKRoute route_var = *route;
14367 int64_t route_ref = 0;
14368 route_var = Route_clone(&route_var);
14369 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14370 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14371 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14372 route_ref = (uintptr_t)route_var.inner;
14373 if (route_var.is_owned) {
14376 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14377 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
14378 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14379 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
14380 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14381 CHECK(obj != NULL);
14382 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
14383 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14384 (*env)->ExceptionDescribe(env);
14385 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
14387 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14388 CHECK_ACCESS(ret_ptr);
14389 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14391 if (get_jenv_res == JNI_EDETACHED) {
14392 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14396 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
14397 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14399 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14400 if (get_jenv_res == JNI_EDETACHED) {
14401 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14403 DO_ASSERT(get_jenv_res == JNI_OK);
14405 LDKRoute route_var = *route;
14406 int64_t route_ref = 0;
14407 route_var = Route_clone(&route_var);
14408 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14409 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14410 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14411 route_ref = (uintptr_t)route_var.inner;
14412 if (route_var.is_owned) {
14415 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14416 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
14417 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14418 CHECK(obj != NULL);
14419 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
14420 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14421 (*env)->ExceptionDescribe(env);
14422 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
14424 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14425 CHECK_ACCESS(ret_ptr);
14426 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14428 if (get_jenv_res == JNI_EDETACHED) {
14429 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14433 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
14434 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14436 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14437 if (get_jenv_res == JNI_EDETACHED) {
14438 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14440 DO_ASSERT(get_jenv_res == JNI_OK);
14442 LDKRoute route_var = *route;
14443 int64_t route_ref = 0;
14444 route_var = Route_clone(&route_var);
14445 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14446 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14447 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14448 route_ref = (uintptr_t)route_var.inner;
14449 if (route_var.is_owned) {
14452 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14453 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14454 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14455 CHECK(obj != NULL);
14456 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
14457 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14458 (*env)->ExceptionDescribe(env);
14459 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
14461 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14462 CHECK_ACCESS(ret_ptr);
14463 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
14465 if (get_jenv_res == JNI_EDETACHED) {
14466 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14470 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
14471 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14473 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14474 if (get_jenv_res == JNI_EDETACHED) {
14475 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14477 DO_ASSERT(get_jenv_res == JNI_OK);
14479 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14480 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14481 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14482 CHECK(obj != NULL);
14483 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
14484 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14485 (*env)->ExceptionDescribe(env);
14486 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
14488 if (get_jenv_res == JNI_EDETACHED) {
14489 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14492 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
14493 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
14494 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14496 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
14497 jclass c = (*env)->GetObjectClass(env, o);
14499 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
14500 atomic_init(&calls->refcnt, 1);
14501 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14502 calls->o = (*env)->NewWeakGlobalRef(env, o);
14503 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
14504 CHECK(calls->node_id_meth != NULL);
14505 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
14506 CHECK(calls->first_hops_meth != NULL);
14507 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
14508 CHECK(calls->send_payment_meth != NULL);
14509 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
14510 CHECK(calls->send_spontaneous_payment_meth != NULL);
14511 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
14512 CHECK(calls->retry_payment_meth != NULL);
14513 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
14514 CHECK(calls->abandon_payment_meth != NULL);
14517 .this_arg = (void*) calls,
14518 .node_id = node_id_LDKPayer_jcall,
14519 .first_hops = first_hops_LDKPayer_jcall,
14520 .send_payment = send_payment_LDKPayer_jcall,
14521 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
14522 .retry_payment = retry_payment_LDKPayer_jcall,
14523 .abandon_payment = abandon_payment_LDKPayer_jcall,
14524 .free = LDKPayer_JCalls_free,
14528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
14529 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
14530 *res_ptr = LDKPayer_init(env, clz, o);
14531 return (uint64_t)res_ptr;
14533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14534 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14535 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14536 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14537 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
14542 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
14543 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14544 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14545 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14546 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
14547 int64_tArray ret_arr = NULL;
14548 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14549 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14550 for (size_t q = 0; q < ret_var.datalen; q++) {
14551 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14552 int64_t ret_conv_16_ref = 0;
14553 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14554 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
14556 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
14557 if (ret_conv_16_var.is_owned) {
14558 ret_conv_16_ref |= 1;
14560 ret_arr_ptr[q] = ret_conv_16_ref;
14562 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14563 FREE(ret_var.data);
14567 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) {
14568 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14569 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14570 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14571 LDKRoute route_conv;
14572 route_conv.inner = (void*)(route & (~1));
14573 route_conv.is_owned = false;
14574 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14575 LDKThirtyTwoBytes payment_hash_ref;
14576 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14577 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14578 LDKThirtyTwoBytes payment_secret_ref;
14579 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14580 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14581 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14582 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
14583 return (int64_t)ret_conv;
14586 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) {
14587 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14588 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14589 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14590 LDKRoute route_conv;
14591 route_conv.inner = (void*)(route & (~1));
14592 route_conv.is_owned = false;
14593 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14594 LDKThirtyTwoBytes payment_preimage_ref;
14595 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14596 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14597 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14598 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
14599 return (int64_t)ret_conv;
14602 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) {
14603 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14604 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14605 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14606 LDKRoute route_conv;
14607 route_conv.inner = (void*)(route & (~1));
14608 route_conv.is_owned = false;
14609 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14610 LDKThirtyTwoBytes payment_id_ref;
14611 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14612 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14613 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14614 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
14615 return (int64_t)ret_conv;
14618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
14619 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14621 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14622 LDKThirtyTwoBytes payment_id_ref;
14623 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14624 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14625 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
14628 typedef struct LDKRouter_JCalls {
14629 atomic_size_t refcnt;
14632 jmethodID find_route_meth;
14633 } LDKRouter_JCalls;
14634 static void LDKRouter_JCalls_free(void* this_arg) {
14635 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14636 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14638 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14639 if (get_jenv_res == JNI_EDETACHED) {
14640 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14642 DO_ASSERT(get_jenv_res == JNI_OK);
14644 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14645 if (get_jenv_res == JNI_EDETACHED) {
14646 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14651 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) {
14652 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14654 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14655 if (get_jenv_res == JNI_EDETACHED) {
14656 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14658 DO_ASSERT(get_jenv_res == JNI_OK);
14660 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
14661 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
14662 LDKRouteParameters route_params_var = *route_params;
14663 int64_t route_params_ref = 0;
14664 route_params_var = RouteParameters_clone(&route_params_var);
14665 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14666 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14667 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
14668 route_params_ref = (uintptr_t)route_params_var.inner;
14669 if (route_params_var.is_owned) {
14670 route_params_ref |= 1;
14672 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14673 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
14674 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
14675 int64_tArray first_hops_arr = NULL;
14676 if (first_hops != NULL) {
14677 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
14678 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
14679 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
14680 for (size_t q = 0; q < first_hops_var.datalen; q++) {
14681 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
14682 int64_t first_hops_conv_16_ref = 0;
14683 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14684 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14685 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
14686 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
14687 if (first_hops_conv_16_var.is_owned) {
14688 first_hops_conv_16_ref |= 1;
14690 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
14692 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
14694 // WARNING: This object doesn't live past this scope, needs clone!
14695 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
14696 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14697 CHECK(obj != NULL);
14698 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);
14699 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14700 (*env)->ExceptionDescribe(env);
14701 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
14703 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14704 CHECK_ACCESS(ret_ptr);
14705 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
14707 if (get_jenv_res == JNI_EDETACHED) {
14708 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14712 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14713 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14714 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14716 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14717 jclass c = (*env)->GetObjectClass(env, o);
14719 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14720 atomic_init(&calls->refcnt, 1);
14721 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14722 calls->o = (*env)->NewWeakGlobalRef(env, o);
14723 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14724 CHECK(calls->find_route_meth != NULL);
14727 .this_arg = (void*) calls,
14728 .find_route = find_route_LDKRouter_jcall,
14729 .free = LDKRouter_JCalls_free,
14733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14734 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14735 *res_ptr = LDKRouter_init(env, clz, o);
14736 return (uint64_t)res_ptr;
14738 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) {
14739 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14740 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14741 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14742 LDKPublicKey payer_ref;
14743 CHECK((*env)->GetArrayLength(env, payer) == 33);
14744 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14745 LDKRouteParameters route_params_conv;
14746 route_params_conv.inner = (void*)(route_params & (~1));
14747 route_params_conv.is_owned = false;
14748 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14749 unsigned char payment_hash_arr[32];
14750 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14751 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14752 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14753 LDKCVec_ChannelDetailsZ first_hops_constr;
14754 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14755 if (first_hops != NULL) {
14756 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14757 if (first_hops_constr.datalen > 0)
14758 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14760 first_hops_constr.data = NULL;
14761 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14762 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14763 int64_t first_hops_conv_16 = first_hops_vals[q];
14764 LDKChannelDetails first_hops_conv_16_conv;
14765 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
14766 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
14767 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14768 first_hops_constr.data[q] = first_hops_conv_16_conv;
14770 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14771 first_hops_ptr = &first_hops_constr;
14773 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14774 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14775 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14776 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14777 *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);
14778 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14779 return (int64_t)ret_conv;
14782 static jclass LDKRetry_Attempts_class = NULL;
14783 static jmethodID LDKRetry_Attempts_meth = NULL;
14784 static jclass LDKRetry_Timeout_class = NULL;
14785 static jmethodID LDKRetry_Timeout_meth = NULL;
14786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14787 LDKRetry_Attempts_class =
14788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14789 CHECK(LDKRetry_Attempts_class != NULL);
14790 LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14791 CHECK(LDKRetry_Attempts_meth != NULL);
14792 LDKRetry_Timeout_class =
14793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14794 CHECK(LDKRetry_Timeout_class != NULL);
14795 LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14796 CHECK(LDKRetry_Timeout_meth != NULL);
14798 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14799 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
14801 case LDKRetry_Attempts: {
14802 int64_t attempts_conv = obj->attempts;
14803 return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14805 case LDKRetry_Timeout: {
14806 int64_t timeout_conv = obj->timeout;
14807 return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14812 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14813 LDKStr ret_str = _ldk_get_compiled_version();
14814 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14819 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14820 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14821 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14826 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14827 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14828 *ret_copy = Bech32Error_clone(arg);
14829 int64_t ret_ref = (uintptr_t)ret_copy;
14832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14833 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14834 int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14839 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14840 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14841 *ret_copy = Bech32Error_clone(orig_conv);
14842 int64_t ret_ref = (uintptr_t)ret_copy;
14846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14847 if ((o & 1) != 0) return;
14848 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14849 CHECK_ACCESS(o_ptr);
14850 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14852 Bech32Error_free(o_conv);
14855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14856 LDKTransaction _res_ref;
14857 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14858 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14859 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14860 _res_ref.data_is_owned = true;
14861 Transaction_free(_res_ref);
14864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14865 LDKCVec_u8Z script_pubkey_ref;
14866 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14867 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14868 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14869 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14870 *ret_ref = TxOut_new(script_pubkey_ref, value);
14871 return (int64_t)ret_ref;
14874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14875 if ((_res & 1) != 0) return;
14876 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14877 CHECK_ACCESS(_res_ptr);
14878 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14880 TxOut_free(_res_conv);
14883 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14884 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14885 *ret_ref = TxOut_clone(arg);
14886 return (int64_t)ret_ref;
14888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14889 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14890 int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14895 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14896 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14897 *ret_ref = TxOut_clone(orig_conv);
14898 return (int64_t)ret_ref;
14901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14902 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14907 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14908 *ret_conv = CResult_NoneNoneZ_ok();
14909 return (int64_t)ret_conv;
14912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14913 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14914 *ret_conv = CResult_NoneNoneZ_err();
14915 return (int64_t)ret_conv;
14918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14919 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14920 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14925 if ((_res & 1) != 0) return;
14926 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14927 CHECK_ACCESS(_res_ptr);
14928 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14930 CResult_NoneNoneZ_free(_res_conv);
14933 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14934 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14935 *ret_conv = CResult_NoneNoneZ_clone(arg);
14936 return (int64_t)ret_conv;
14938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14939 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14940 int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14945 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14946 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14947 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14948 return (int64_t)ret_conv;
14951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14952 LDKCounterpartyCommitmentSecrets o_conv;
14953 o_conv.inner = (void*)(o & (~1));
14954 o_conv.is_owned = (o & 1) || (o == 0);
14955 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14956 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14957 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14958 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14959 return (int64_t)ret_conv;
14962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14963 LDKDecodeError e_conv;
14964 e_conv.inner = (void*)(e & (~1));
14965 e_conv.is_owned = (e & 1) || (e == 0);
14966 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14967 e_conv = DecodeError_clone(&e_conv);
14968 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14969 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14970 return (int64_t)ret_conv;
14973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14974 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14975 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14980 if ((_res & 1) != 0) return;
14981 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14982 CHECK_ACCESS(_res_ptr);
14983 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14985 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14988 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14989 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14990 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14991 return (int64_t)ret_conv;
14993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14994 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14995 int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15000 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
15001 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15002 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
15003 return (int64_t)ret_conv;
15006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15007 LDKSecretKey o_ref;
15008 CHECK((*env)->GetArrayLength(env, o) == 32);
15009 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
15010 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15011 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
15012 return (int64_t)ret_conv;
15015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15016 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15017 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15018 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
15019 return (int64_t)ret_conv;
15022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15023 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
15024 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
15028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15029 if ((_res & 1) != 0) return;
15030 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15031 CHECK_ACCESS(_res_ptr);
15032 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
15034 CResult_SecretKeyErrorZ_free(_res_conv);
15037 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
15038 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15039 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
15040 return (int64_t)ret_conv;
15042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15043 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
15044 int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
15048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15049 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
15050 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15051 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
15052 return (int64_t)ret_conv;
15055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15056 LDKPublicKey o_ref;
15057 CHECK((*env)->GetArrayLength(env, o) == 33);
15058 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
15059 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15060 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
15061 return (int64_t)ret_conv;
15064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15065 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15066 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15067 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
15068 return (int64_t)ret_conv;
15071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15072 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
15073 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
15077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15078 if ((_res & 1) != 0) return;
15079 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15080 CHECK_ACCESS(_res_ptr);
15081 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
15083 CResult_PublicKeyErrorZ_free(_res_conv);
15086 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
15087 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15088 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
15089 return (int64_t)ret_conv;
15091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15092 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
15093 int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
15097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15098 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
15099 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15100 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
15101 return (int64_t)ret_conv;
15104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15105 LDKTxCreationKeys o_conv;
15106 o_conv.inner = (void*)(o & (~1));
15107 o_conv.is_owned = (o & 1) || (o == 0);
15108 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15109 o_conv = TxCreationKeys_clone(&o_conv);
15110 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15111 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
15112 return (int64_t)ret_conv;
15115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15116 LDKDecodeError e_conv;
15117 e_conv.inner = (void*)(e & (~1));
15118 e_conv.is_owned = (e & 1) || (e == 0);
15119 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15120 e_conv = DecodeError_clone(&e_conv);
15121 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15122 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
15123 return (int64_t)ret_conv;
15126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15127 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
15128 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
15132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15133 if ((_res & 1) != 0) return;
15134 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15135 CHECK_ACCESS(_res_ptr);
15136 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
15138 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
15141 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
15142 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15143 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
15144 return (int64_t)ret_conv;
15146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15147 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
15148 int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
15152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15153 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
15154 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15155 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
15156 return (int64_t)ret_conv;
15159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15160 LDKChannelPublicKeys o_conv;
15161 o_conv.inner = (void*)(o & (~1));
15162 o_conv.is_owned = (o & 1) || (o == 0);
15163 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15164 o_conv = ChannelPublicKeys_clone(&o_conv);
15165 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15166 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
15167 return (int64_t)ret_conv;
15170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15171 LDKDecodeError e_conv;
15172 e_conv.inner = (void*)(e & (~1));
15173 e_conv.is_owned = (e & 1) || (e == 0);
15174 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15175 e_conv = DecodeError_clone(&e_conv);
15176 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15177 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
15178 return (int64_t)ret_conv;
15181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15182 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
15183 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
15187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15188 if ((_res & 1) != 0) return;
15189 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15190 CHECK_ACCESS(_res_ptr);
15191 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
15193 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
15196 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
15197 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15198 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
15199 return (int64_t)ret_conv;
15201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15202 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
15203 int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
15207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15208 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
15209 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15210 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
15211 return (int64_t)ret_conv;
15214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15215 LDKTxCreationKeys o_conv;
15216 o_conv.inner = (void*)(o & (~1));
15217 o_conv.is_owned = (o & 1) || (o == 0);
15218 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15219 o_conv = TxCreationKeys_clone(&o_conv);
15220 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15221 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
15222 return (int64_t)ret_conv;
15225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15226 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15227 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15228 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
15229 return (int64_t)ret_conv;
15232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15233 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
15234 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
15238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15239 if ((_res & 1) != 0) return;
15240 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15241 CHECK_ACCESS(_res_ptr);
15242 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
15244 CResult_TxCreationKeysErrorZ_free(_res_conv);
15247 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
15248 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15249 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
15250 return (int64_t)ret_conv;
15252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15253 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
15254 int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
15258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15259 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
15260 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15261 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
15262 return (int64_t)ret_conv;
15265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
15266 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15267 *ret_copy = COption_u32Z_some(o);
15268 int64_t ret_ref = (uintptr_t)ret_copy;
15272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
15273 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15274 *ret_copy = COption_u32Z_none();
15275 int64_t ret_ref = (uintptr_t)ret_copy;
15279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15280 if ((_res & 1) != 0) return;
15281 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15282 CHECK_ACCESS(_res_ptr);
15283 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
15285 COption_u32Z_free(_res_conv);
15288 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
15289 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15290 *ret_copy = COption_u32Z_clone(arg);
15291 int64_t ret_ref = (uintptr_t)ret_copy;
15294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15295 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
15296 int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
15300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15301 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
15302 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15303 *ret_copy = COption_u32Z_clone(orig_conv);
15304 int64_t ret_ref = (uintptr_t)ret_copy;
15308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15309 LDKHTLCOutputInCommitment o_conv;
15310 o_conv.inner = (void*)(o & (~1));
15311 o_conv.is_owned = (o & 1) || (o == 0);
15312 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15313 o_conv = HTLCOutputInCommitment_clone(&o_conv);
15314 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15315 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
15316 return (int64_t)ret_conv;
15319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15320 LDKDecodeError e_conv;
15321 e_conv.inner = (void*)(e & (~1));
15322 e_conv.is_owned = (e & 1) || (e == 0);
15323 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15324 e_conv = DecodeError_clone(&e_conv);
15325 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15326 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
15327 return (int64_t)ret_conv;
15330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15331 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
15332 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15337 if ((_res & 1) != 0) return;
15338 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15339 CHECK_ACCESS(_res_ptr);
15340 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15342 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15345 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15346 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15347 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15348 return (int64_t)ret_conv;
15350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15351 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
15352 int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15357 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
15358 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15359 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15360 return (int64_t)ret_conv;
15363 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
15364 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
15368 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
15369 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
15373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
15374 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
15375 COption_NoneZ_free(_res_conv);
15378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15379 LDKCounterpartyChannelTransactionParameters o_conv;
15380 o_conv.inner = (void*)(o & (~1));
15381 o_conv.is_owned = (o & 1) || (o == 0);
15382 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15383 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15384 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15385 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15386 return (int64_t)ret_conv;
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15390 LDKDecodeError e_conv;
15391 e_conv.inner = (void*)(e & (~1));
15392 e_conv.is_owned = (e & 1) || (e == 0);
15393 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15394 e_conv = DecodeError_clone(&e_conv);
15395 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15396 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15397 return (int64_t)ret_conv;
15400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15401 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15402 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15407 if ((_res & 1) != 0) return;
15408 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15409 CHECK_ACCESS(_res_ptr);
15410 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15412 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15415 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15416 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15417 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15418 return (int64_t)ret_conv;
15420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15421 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15422 int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15427 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15428 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15429 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15430 return (int64_t)ret_conv;
15433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15434 LDKChannelTransactionParameters o_conv;
15435 o_conv.inner = (void*)(o & (~1));
15436 o_conv.is_owned = (o & 1) || (o == 0);
15437 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15438 o_conv = ChannelTransactionParameters_clone(&o_conv);
15439 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15440 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15441 return (int64_t)ret_conv;
15444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15445 LDKDecodeError e_conv;
15446 e_conv.inner = (void*)(e & (~1));
15447 e_conv.is_owned = (e & 1) || (e == 0);
15448 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15449 e_conv = DecodeError_clone(&e_conv);
15450 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15451 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15452 return (int64_t)ret_conv;
15455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15456 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15457 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15462 if ((_res & 1) != 0) return;
15463 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15464 CHECK_ACCESS(_res_ptr);
15465 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15467 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15470 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15471 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15472 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15473 return (int64_t)ret_conv;
15475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15476 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15477 int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15482 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15483 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15484 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15485 return (int64_t)ret_conv;
15488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15489 LDKCVec_SignatureZ _res_constr;
15490 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15491 if (_res_constr.datalen > 0)
15492 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15494 _res_constr.data = NULL;
15495 for (size_t i = 0; i < _res_constr.datalen; i++) {
15496 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15497 LDKSignature _res_conv_8_ref;
15498 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
15499 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
15500 _res_constr.data[i] = _res_conv_8_ref;
15502 CVec_SignatureZ_free(_res_constr);
15505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15506 LDKHolderCommitmentTransaction o_conv;
15507 o_conv.inner = (void*)(o & (~1));
15508 o_conv.is_owned = (o & 1) || (o == 0);
15509 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15510 o_conv = HolderCommitmentTransaction_clone(&o_conv);
15511 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15512 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15513 return (int64_t)ret_conv;
15516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15517 LDKDecodeError e_conv;
15518 e_conv.inner = (void*)(e & (~1));
15519 e_conv.is_owned = (e & 1) || (e == 0);
15520 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15521 e_conv = DecodeError_clone(&e_conv);
15522 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15523 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15524 return (int64_t)ret_conv;
15527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15528 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
15529 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15534 if ((_res & 1) != 0) return;
15535 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15536 CHECK_ACCESS(_res_ptr);
15537 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15539 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15542 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15543 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15544 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15545 return (int64_t)ret_conv;
15547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15548 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15549 int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15554 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15555 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15556 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15557 return (int64_t)ret_conv;
15560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15561 LDKBuiltCommitmentTransaction o_conv;
15562 o_conv.inner = (void*)(o & (~1));
15563 o_conv.is_owned = (o & 1) || (o == 0);
15564 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15565 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15566 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15567 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15568 return (int64_t)ret_conv;
15571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15572 LDKDecodeError e_conv;
15573 e_conv.inner = (void*)(e & (~1));
15574 e_conv.is_owned = (e & 1) || (e == 0);
15575 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15576 e_conv = DecodeError_clone(&e_conv);
15577 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15578 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15579 return (int64_t)ret_conv;
15582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15583 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
15584 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15589 if ((_res & 1) != 0) return;
15590 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15591 CHECK_ACCESS(_res_ptr);
15592 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15594 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15597 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15598 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15599 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15600 return (int64_t)ret_conv;
15602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15603 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15604 int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15609 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15610 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15611 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15612 return (int64_t)ret_conv;
15615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15616 LDKTrustedClosingTransaction o_conv;
15617 o_conv.inner = (void*)(o & (~1));
15618 o_conv.is_owned = (o & 1) || (o == 0);
15619 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15620 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15621 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15622 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15623 return (int64_t)ret_conv;
15626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15627 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15628 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15629 return (int64_t)ret_conv;
15632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15633 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
15634 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15639 if ((_res & 1) != 0) return;
15640 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15641 CHECK_ACCESS(_res_ptr);
15642 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15644 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15648 LDKCommitmentTransaction o_conv;
15649 o_conv.inner = (void*)(o & (~1));
15650 o_conv.is_owned = (o & 1) || (o == 0);
15651 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15652 o_conv = CommitmentTransaction_clone(&o_conv);
15653 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15654 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15655 return (int64_t)ret_conv;
15658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15659 LDKDecodeError e_conv;
15660 e_conv.inner = (void*)(e & (~1));
15661 e_conv.is_owned = (e & 1) || (e == 0);
15662 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15663 e_conv = DecodeError_clone(&e_conv);
15664 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15665 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15666 return (int64_t)ret_conv;
15669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15670 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
15671 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15676 if ((_res & 1) != 0) return;
15677 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15678 CHECK_ACCESS(_res_ptr);
15679 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15681 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15684 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15685 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15686 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15687 return (int64_t)ret_conv;
15689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15690 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
15691 int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15696 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
15697 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15698 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15699 return (int64_t)ret_conv;
15702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15703 LDKTrustedCommitmentTransaction o_conv;
15704 o_conv.inner = (void*)(o & (~1));
15705 o_conv.is_owned = (o & 1) || (o == 0);
15706 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15707 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15708 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15709 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15710 return (int64_t)ret_conv;
15713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15714 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15715 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15716 return (int64_t)ret_conv;
15719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15720 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
15721 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15726 if ((_res & 1) != 0) return;
15727 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15728 CHECK_ACCESS(_res_ptr);
15729 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15731 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
15735 LDKCVec_SignatureZ o_constr;
15736 o_constr.datalen = (*env)->GetArrayLength(env, o);
15737 if (o_constr.datalen > 0)
15738 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15740 o_constr.data = NULL;
15741 for (size_t i = 0; i < o_constr.datalen; i++) {
15742 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15743 LDKSignature o_conv_8_ref;
15744 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
15745 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
15746 o_constr.data[i] = o_conv_8_ref;
15748 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15749 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15750 return (int64_t)ret_conv;
15753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
15754 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15755 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15756 return (int64_t)ret_conv;
15759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15760 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
15761 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15766 if ((_res & 1) != 0) return;
15767 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15768 CHECK_ACCESS(_res_ptr);
15769 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15771 CResult_CVec_SignatureZNoneZ_free(_res_conv);
15774 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15775 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15776 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15777 return (int64_t)ret_conv;
15779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15780 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
15781 int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15786 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
15787 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15788 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15789 return (int64_t)ret_conv;
15792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15793 LDKShutdownScript 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 = ShutdownScript_clone(&o_conv);
15798 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15799 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15800 return (int64_t)ret_conv;
15803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15810 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15811 return (int64_t)ret_conv;
15814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15815 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15816 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15826 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15829 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15830 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15831 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15832 return (int64_t)ret_conv;
15834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15835 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15836 int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15841 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15842 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15843 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15844 return (int64_t)ret_conv;
15847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15848 LDKShutdownScript o_conv;
15849 o_conv.inner = (void*)(o & (~1));
15850 o_conv.is_owned = (o & 1) || (o == 0);
15851 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15852 o_conv = ShutdownScript_clone(&o_conv);
15853 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15854 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15855 return (int64_t)ret_conv;
15858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15859 LDKInvalidShutdownScript e_conv;
15860 e_conv.inner = (void*)(e & (~1));
15861 e_conv.is_owned = (e & 1) || (e == 0);
15862 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15863 e_conv = InvalidShutdownScript_clone(&e_conv);
15864 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15865 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15866 return (int64_t)ret_conv;
15869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15870 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15871 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15876 if ((_res & 1) != 0) return;
15877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15878 CHECK_ACCESS(_res_ptr);
15879 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15881 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15884 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15885 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15886 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15887 return (int64_t)ret_conv;
15889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15890 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15891 int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15896 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15897 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15898 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15899 return (int64_t)ret_conv;
15902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15903 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15904 *ret_conv = CResult_NoneErrorZ_ok();
15905 return (int64_t)ret_conv;
15908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15909 LDKIOError e_conv = LDKIOError_from_java(env, e);
15910 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15911 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15912 return (int64_t)ret_conv;
15915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15916 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15917 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
15921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15922 if ((_res & 1) != 0) return;
15923 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15924 CHECK_ACCESS(_res_ptr);
15925 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15927 CResult_NoneErrorZ_free(_res_conv);
15930 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15931 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15932 *ret_conv = CResult_NoneErrorZ_clone(arg);
15933 return (int64_t)ret_conv;
15935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15936 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15937 int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15942 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15943 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15944 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15945 return (int64_t)ret_conv;
15948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15949 LDKRouteHop o_conv;
15950 o_conv.inner = (void*)(o & (~1));
15951 o_conv.is_owned = (o & 1) || (o == 0);
15952 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15953 o_conv = RouteHop_clone(&o_conv);
15954 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15955 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15956 return (int64_t)ret_conv;
15959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15960 LDKDecodeError e_conv;
15961 e_conv.inner = (void*)(e & (~1));
15962 e_conv.is_owned = (e & 1) || (e == 0);
15963 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15964 e_conv = DecodeError_clone(&e_conv);
15965 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15966 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15967 return (int64_t)ret_conv;
15970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15971 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15972 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15977 if ((_res & 1) != 0) return;
15978 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15979 CHECK_ACCESS(_res_ptr);
15980 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15982 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15985 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15986 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15987 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15988 return (int64_t)ret_conv;
15990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15991 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15992 int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15997 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15998 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15999 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
16000 return (int64_t)ret_conv;
16003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16004 LDKCVec_RouteHopZ _res_constr;
16005 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16006 if (_res_constr.datalen > 0)
16007 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16009 _res_constr.data = NULL;
16010 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16011 for (size_t k = 0; k < _res_constr.datalen; k++) {
16012 int64_t _res_conv_10 = _res_vals[k];
16013 LDKRouteHop _res_conv_10_conv;
16014 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
16015 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
16016 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
16017 _res_constr.data[k] = _res_conv_10_conv;
16019 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16020 CVec_RouteHopZ_free(_res_constr);
16023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16024 LDKCVec_CVec_RouteHopZZ _res_constr;
16025 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16026 if (_res_constr.datalen > 0)
16027 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
16029 _res_constr.data = NULL;
16030 for (size_t m = 0; m < _res_constr.datalen; m++) {
16031 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
16032 LDKCVec_RouteHopZ _res_conv_12_constr;
16033 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
16034 if (_res_conv_12_constr.datalen > 0)
16035 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16037 _res_conv_12_constr.data = NULL;
16038 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
16039 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
16040 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
16041 LDKRouteHop _res_conv_12_conv_10_conv;
16042 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
16043 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
16044 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
16045 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
16047 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
16048 _res_constr.data[m] = _res_conv_12_constr;
16050 CVec_CVec_RouteHopZZ_free(_res_constr);
16053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16055 o_conv.inner = (void*)(o & (~1));
16056 o_conv.is_owned = (o & 1) || (o == 0);
16057 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16058 o_conv = Route_clone(&o_conv);
16059 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16060 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
16061 return (int64_t)ret_conv;
16064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16065 LDKDecodeError e_conv;
16066 e_conv.inner = (void*)(e & (~1));
16067 e_conv.is_owned = (e & 1) || (e == 0);
16068 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16069 e_conv = DecodeError_clone(&e_conv);
16070 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16071 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
16072 return (int64_t)ret_conv;
16075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16076 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
16077 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
16081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16082 if ((_res & 1) != 0) return;
16083 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16084 CHECK_ACCESS(_res_ptr);
16085 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
16087 CResult_RouteDecodeErrorZ_free(_res_conv);
16090 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
16091 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16092 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
16093 return (int64_t)ret_conv;
16095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16096 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
16097 int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
16101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16102 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
16103 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16104 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
16105 return (int64_t)ret_conv;
16108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16109 LDKRouteParameters o_conv;
16110 o_conv.inner = (void*)(o & (~1));
16111 o_conv.is_owned = (o & 1) || (o == 0);
16112 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16113 o_conv = RouteParameters_clone(&o_conv);
16114 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16115 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
16116 return (int64_t)ret_conv;
16119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16120 LDKDecodeError e_conv;
16121 e_conv.inner = (void*)(e & (~1));
16122 e_conv.is_owned = (e & 1) || (e == 0);
16123 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16124 e_conv = DecodeError_clone(&e_conv);
16125 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16126 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
16127 return (int64_t)ret_conv;
16130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16131 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
16132 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
16136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16137 if ((_res & 1) != 0) return;
16138 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16139 CHECK_ACCESS(_res_ptr);
16140 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
16142 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
16145 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
16146 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16147 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
16148 return (int64_t)ret_conv;
16150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16151 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
16152 int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
16156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16157 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
16158 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16159 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
16160 return (int64_t)ret_conv;
16163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16164 LDKCVec_RouteHintZ _res_constr;
16165 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16166 if (_res_constr.datalen > 0)
16167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16169 _res_constr.data = NULL;
16170 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16171 for (size_t l = 0; l < _res_constr.datalen; l++) {
16172 int64_t _res_conv_11 = _res_vals[l];
16173 LDKRouteHint _res_conv_11_conv;
16174 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
16175 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
16176 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
16177 _res_constr.data[l] = _res_conv_11_conv;
16179 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16180 CVec_RouteHintZ_free(_res_constr);
16183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
16184 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16185 *ret_copy = COption_u64Z_some(o);
16186 int64_t ret_ref = (uintptr_t)ret_copy;
16190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
16191 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16192 *ret_copy = COption_u64Z_none();
16193 int64_t ret_ref = (uintptr_t)ret_copy;
16197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_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 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16203 COption_u64Z_free(_res_conv);
16206 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16207 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16208 *ret_copy = COption_u64Z_clone(arg);
16209 int64_t ret_ref = (uintptr_t)ret_copy;
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16213 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
16214 int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16219 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
16220 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16221 *ret_copy = COption_u64Z_clone(orig_conv);
16222 int64_t ret_ref = (uintptr_t)ret_copy;
16226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16227 LDKCVec_u64Z _res_constr;
16228 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16229 if (_res_constr.datalen > 0)
16230 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16232 _res_constr.data = NULL;
16233 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16234 for (size_t g = 0; g < _res_constr.datalen; g++) {
16235 int64_t _res_conv_6 = _res_vals[g];
16236 _res_constr.data[g] = _res_conv_6;
16238 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16239 CVec_u64Z_free(_res_constr);
16242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16243 LDKPaymentParameters o_conv;
16244 o_conv.inner = (void*)(o & (~1));
16245 o_conv.is_owned = (o & 1) || (o == 0);
16246 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16247 o_conv = PaymentParameters_clone(&o_conv);
16248 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16249 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
16250 return (int64_t)ret_conv;
16253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16254 LDKDecodeError e_conv;
16255 e_conv.inner = (void*)(e & (~1));
16256 e_conv.is_owned = (e & 1) || (e == 0);
16257 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16258 e_conv = DecodeError_clone(&e_conv);
16259 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16260 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
16261 return (int64_t)ret_conv;
16264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16265 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
16266 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
16270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16271 if ((_res & 1) != 0) return;
16272 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16273 CHECK_ACCESS(_res_ptr);
16274 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
16276 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
16279 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
16280 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16281 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
16282 return (int64_t)ret_conv;
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16285 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
16286 int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
16290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16291 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
16292 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16293 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
16294 return (int64_t)ret_conv;
16297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16298 LDKCVec_RouteHintHopZ _res_constr;
16299 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16300 if (_res_constr.datalen > 0)
16301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
16303 _res_constr.data = NULL;
16304 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16305 for (size_t o = 0; o < _res_constr.datalen; o++) {
16306 int64_t _res_conv_14 = _res_vals[o];
16307 LDKRouteHintHop _res_conv_14_conv;
16308 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
16309 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
16310 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16311 _res_constr.data[o] = _res_conv_14_conv;
16313 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16314 CVec_RouteHintHopZ_free(_res_constr);
16317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16318 LDKRouteHint o_conv;
16319 o_conv.inner = (void*)(o & (~1));
16320 o_conv.is_owned = (o & 1) || (o == 0);
16321 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16322 o_conv = RouteHint_clone(&o_conv);
16323 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16324 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
16325 return (int64_t)ret_conv;
16328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16329 LDKDecodeError e_conv;
16330 e_conv.inner = (void*)(e & (~1));
16331 e_conv.is_owned = (e & 1) || (e == 0);
16332 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16333 e_conv = DecodeError_clone(&e_conv);
16334 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16335 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
16336 return (int64_t)ret_conv;
16339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16340 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
16341 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
16345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16346 if ((_res & 1) != 0) return;
16347 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16348 CHECK_ACCESS(_res_ptr);
16349 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
16351 CResult_RouteHintDecodeErrorZ_free(_res_conv);
16354 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
16355 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16356 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
16357 return (int64_t)ret_conv;
16359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16360 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
16361 int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
16365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16366 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
16367 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16368 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
16369 return (int64_t)ret_conv;
16372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16373 LDKRouteHintHop o_conv;
16374 o_conv.inner = (void*)(o & (~1));
16375 o_conv.is_owned = (o & 1) || (o == 0);
16376 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16377 o_conv = RouteHintHop_clone(&o_conv);
16378 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16379 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
16380 return (int64_t)ret_conv;
16383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16384 LDKDecodeError e_conv;
16385 e_conv.inner = (void*)(e & (~1));
16386 e_conv.is_owned = (e & 1) || (e == 0);
16387 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16388 e_conv = DecodeError_clone(&e_conv);
16389 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16390 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
16391 return (int64_t)ret_conv;
16394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16395 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
16396 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
16400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16401 if ((_res & 1) != 0) return;
16402 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16403 CHECK_ACCESS(_res_ptr);
16404 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
16406 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
16409 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
16410 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16411 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
16412 return (int64_t)ret_conv;
16414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16415 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
16416 int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
16420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16421 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
16422 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16423 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
16424 return (int64_t)ret_conv;
16427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16428 LDKCVec_ChannelDetailsZ _res_constr;
16429 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16430 if (_res_constr.datalen > 0)
16431 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16433 _res_constr.data = NULL;
16434 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16435 for (size_t q = 0; q < _res_constr.datalen; q++) {
16436 int64_t _res_conv_16 = _res_vals[q];
16437 LDKChannelDetails _res_conv_16_conv;
16438 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16439 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16440 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16441 _res_constr.data[q] = _res_conv_16_conv;
16443 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16444 CVec_ChannelDetailsZ_free(_res_constr);
16447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16449 o_conv.inner = (void*)(o & (~1));
16450 o_conv.is_owned = (o & 1) || (o == 0);
16451 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16452 o_conv = Route_clone(&o_conv);
16453 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16454 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16455 return (int64_t)ret_conv;
16458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16459 LDKLightningError e_conv;
16460 e_conv.inner = (void*)(e & (~1));
16461 e_conv.is_owned = (e & 1) || (e == 0);
16462 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16463 e_conv = LightningError_clone(&e_conv);
16464 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16465 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16466 return (int64_t)ret_conv;
16469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16470 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
16471 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16476 if ((_res & 1) != 0) return;
16477 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16478 CHECK_ACCESS(_res_ptr);
16479 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16481 CResult_RouteLightningErrorZ_free(_res_conv);
16484 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16485 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16486 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16487 return (int64_t)ret_conv;
16489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16490 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
16491 int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16496 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
16497 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16498 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16499 return (int64_t)ret_conv;
16502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16503 LDKCVec_PublicKeyZ _res_constr;
16504 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16505 if (_res_constr.datalen > 0)
16506 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16508 _res_constr.data = NULL;
16509 for (size_t i = 0; i < _res_constr.datalen; i++) {
16510 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16511 LDKPublicKey _res_conv_8_ref;
16512 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
16513 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
16514 _res_constr.data[i] = _res_conv_8_ref;
16516 CVec_PublicKeyZ_free(_res_constr);
16519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16520 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16521 CHECK_ACCESS(o_ptr);
16522 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
16523 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
16524 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16525 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
16526 return (int64_t)ret_conv;
16529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16530 LDKDecodeError e_conv;
16531 e_conv.inner = (void*)(e & (~1));
16532 e_conv.is_owned = (e & 1) || (e == 0);
16533 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16534 e_conv = DecodeError_clone(&e_conv);
16535 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16536 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
16537 return (int64_t)ret_conv;
16540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16541 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
16542 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
16546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16547 if ((_res & 1) != 0) return;
16548 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16549 CHECK_ACCESS(_res_ptr);
16550 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
16552 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
16555 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
16556 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16557 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
16558 return (int64_t)ret_conv;
16560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16561 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
16562 int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
16566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16567 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
16568 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16569 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
16570 return (int64_t)ret_conv;
16573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16574 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16575 CHECK_ACCESS(o_ptr);
16576 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
16577 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
16578 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16579 *ret_copy = COption_ClosureReasonZ_some(o_conv);
16580 int64_t ret_ref = (uintptr_t)ret_copy;
16584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
16585 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16586 *ret_copy = COption_ClosureReasonZ_none();
16587 int64_t ret_ref = (uintptr_t)ret_copy;
16591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16592 if ((_res & 1) != 0) return;
16593 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16594 CHECK_ACCESS(_res_ptr);
16595 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16597 COption_ClosureReasonZ_free(_res_conv);
16600 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16601 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16602 *ret_copy = COption_ClosureReasonZ_clone(arg);
16603 int64_t ret_ref = (uintptr_t)ret_copy;
16606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16607 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
16608 int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16613 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
16614 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16615 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16616 int64_t ret_ref = (uintptr_t)ret_copy;
16620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16621 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16622 CHECK_ACCESS(o_ptr);
16623 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16624 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
16625 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16626 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16627 return (int64_t)ret_conv;
16630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16631 LDKDecodeError e_conv;
16632 e_conv.inner = (void*)(e & (~1));
16633 e_conv.is_owned = (e & 1) || (e == 0);
16634 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16635 e_conv = DecodeError_clone(&e_conv);
16636 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16637 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
16638 return (int64_t)ret_conv;
16641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16642 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
16643 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
16647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16648 if ((_res & 1) != 0) return;
16649 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16650 CHECK_ACCESS(_res_ptr);
16651 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16653 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16656 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16657 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16658 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16659 return (int64_t)ret_conv;
16661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16662 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16663 int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16668 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16669 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16670 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16671 return (int64_t)ret_conv;
16674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16675 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16676 CHECK_ACCESS(o_ptr);
16677 LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
16678 o_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)o) & ~1));
16679 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16680 *ret_copy = COption_HTLCDestinationZ_some(o_conv);
16681 int64_t ret_ref = (uintptr_t)ret_copy;
16685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
16686 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16687 *ret_copy = COption_HTLCDestinationZ_none();
16688 int64_t ret_ref = (uintptr_t)ret_copy;
16692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16693 if ((_res & 1) != 0) return;
16694 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16695 CHECK_ACCESS(_res_ptr);
16696 LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
16698 COption_HTLCDestinationZ_free(_res_conv);
16701 static inline uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
16702 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16703 *ret_copy = COption_HTLCDestinationZ_clone(arg);
16704 int64_t ret_ref = (uintptr_t)ret_copy;
16707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16708 LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)arg;
16709 int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
16713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16714 LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)orig;
16715 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16716 *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
16717 int64_t ret_ref = (uintptr_t)ret_copy;
16721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16722 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16723 CHECK_ACCESS(o_ptr);
16724 LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
16725 o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)(((uintptr_t)o) & ~1));
16726 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16727 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
16728 return (int64_t)ret_conv;
16731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16732 LDKDecodeError e_conv;
16733 e_conv.inner = (void*)(e & (~1));
16734 e_conv.is_owned = (e & 1) || (e == 0);
16735 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16736 e_conv = DecodeError_clone(&e_conv);
16737 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16738 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
16739 return (int64_t)ret_conv;
16742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16743 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(o & ~1);
16744 jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
16748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16749 if ((_res & 1) != 0) return;
16750 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16751 CHECK_ACCESS(_res_ptr);
16752 LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
16754 CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
16757 static inline uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
16758 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16759 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
16760 return (int64_t)ret_conv;
16762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16763 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(arg & ~1);
16764 int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
16768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16769 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(orig & ~1);
16770 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16771 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
16772 return (int64_t)ret_conv;
16775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16776 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16777 CHECK_ACCESS(o_ptr);
16778 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16779 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16780 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16781 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16782 int64_t ret_ref = (uintptr_t)ret_copy;
16786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16787 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16788 *ret_copy = COption_NetworkUpdateZ_none();
16789 int64_t ret_ref = (uintptr_t)ret_copy;
16793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16794 if ((_res & 1) != 0) return;
16795 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16796 CHECK_ACCESS(_res_ptr);
16797 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16799 COption_NetworkUpdateZ_free(_res_conv);
16802 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16803 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16804 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16805 int64_t ret_ref = (uintptr_t)ret_copy;
16808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16809 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16810 int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16815 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16816 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16817 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16818 int64_t ret_ref = (uintptr_t)ret_copy;
16822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16823 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16824 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16825 if (_res_constr.datalen > 0)
16826 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16828 _res_constr.data = NULL;
16829 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16830 for (size_t b = 0; b < _res_constr.datalen; b++) {
16831 int64_t _res_conv_27 = _res_vals[b];
16832 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16833 CHECK_ACCESS(_res_conv_27_ptr);
16834 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16835 FREE((void*)_res_conv_27);
16836 _res_constr.data[b] = _res_conv_27_conv;
16838 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16839 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16843 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16844 CHECK_ACCESS(o_ptr);
16845 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16846 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16847 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16848 *ret_copy = COption_EventZ_some(o_conv);
16849 int64_t ret_ref = (uintptr_t)ret_copy;
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16854 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16855 *ret_copy = COption_EventZ_none();
16856 int64_t ret_ref = (uintptr_t)ret_copy;
16860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16861 if ((_res & 1) != 0) return;
16862 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16863 CHECK_ACCESS(_res_ptr);
16864 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16866 COption_EventZ_free(_res_conv);
16869 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16870 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16871 *ret_copy = COption_EventZ_clone(arg);
16872 int64_t ret_ref = (uintptr_t)ret_copy;
16875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16876 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16877 int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
16881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16882 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16883 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16884 *ret_copy = COption_EventZ_clone(orig_conv);
16885 int64_t ret_ref = (uintptr_t)ret_copy;
16889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16890 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16891 CHECK_ACCESS(o_ptr);
16892 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16893 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16894 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16895 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16896 return (int64_t)ret_conv;
16899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16900 LDKDecodeError e_conv;
16901 e_conv.inner = (void*)(e & (~1));
16902 e_conv.is_owned = (e & 1) || (e == 0);
16903 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16904 e_conv = DecodeError_clone(&e_conv);
16905 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16906 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16907 return (int64_t)ret_conv;
16910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16911 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16912 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16917 if ((_res & 1) != 0) return;
16918 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16919 CHECK_ACCESS(_res_ptr);
16920 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16922 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16925 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16926 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16927 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16928 return (int64_t)ret_conv;
16930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16931 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16932 int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16937 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16938 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16939 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16940 return (int64_t)ret_conv;
16943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16944 LDKCVec_MessageSendEventZ _res_constr;
16945 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16946 if (_res_constr.datalen > 0)
16947 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16949 _res_constr.data = NULL;
16950 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16951 for (size_t s = 0; s < _res_constr.datalen; s++) {
16952 int64_t _res_conv_18 = _res_vals[s];
16953 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16954 CHECK_ACCESS(_res_conv_18_ptr);
16955 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16956 FREE((void*)_res_conv_18);
16957 _res_constr.data[s] = _res_conv_18_conv;
16959 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16960 CVec_MessageSendEventZ_free(_res_constr);
16963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16964 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16965 CHECK_ACCESS(o_ptr);
16966 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
16967 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
16968 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16969 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
16970 return (int64_t)ret_conv;
16973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16974 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
16975 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16976 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
16977 return (int64_t)ret_conv;
16980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16981 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
16982 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
16986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16987 if ((_res & 1) != 0) return;
16988 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16989 CHECK_ACCESS(_res_ptr);
16990 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
16992 CResult_TxOutAccessErrorZ_free(_res_conv);
16995 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
16996 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16997 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
16998 return (int64_t)ret_conv;
17000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17001 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
17002 int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
17006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17007 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
17008 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17009 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
17010 return (int64_t)ret_conv;
17013 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
17014 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17015 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
17016 return ((int64_t)ret_conv);
17018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17019 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
17020 int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
17024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17025 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
17026 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17027 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
17028 return ((int64_t)ret_conv);
17031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
17032 LDKTransaction b_ref;
17033 b_ref.datalen = (*env)->GetArrayLength(env, b);
17034 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
17035 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
17036 b_ref.data_is_owned = true;
17037 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17038 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
17039 return ((int64_t)ret_conv);
17042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17043 if ((_res & 1) != 0) return;
17044 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17045 CHECK_ACCESS(_res_ptr);
17046 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
17048 C2Tuple_usizeTransactionZ_free(_res_conv);
17051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17052 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
17053 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17054 if (_res_constr.datalen > 0)
17055 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17057 _res_constr.data = NULL;
17058 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17059 for (size_t c = 0; c < _res_constr.datalen; c++) {
17060 int64_t _res_conv_28 = _res_vals[c];
17061 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
17062 CHECK_ACCESS(_res_conv_28_ptr);
17063 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
17064 FREE((void*)_res_conv_28);
17065 _res_constr.data[c] = _res_conv_28_conv;
17067 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17068 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
17071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17072 LDKCVec_TxidZ _res_constr;
17073 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17074 if (_res_constr.datalen > 0)
17075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
17077 _res_constr.data = NULL;
17078 for (size_t i = 0; i < _res_constr.datalen; i++) {
17079 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17080 LDKThirtyTwoBytes _res_conv_8_ref;
17081 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17082 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17083 _res_constr.data[i] = _res_conv_8_ref;
17085 CVec_TxidZ_free(_res_constr);
17088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
17089 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17090 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
17091 return (int64_t)ret_conv;
17094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
17095 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
17096 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17097 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
17098 return (int64_t)ret_conv;
17101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17102 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
17103 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
17107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17108 if ((_res & 1) != 0) return;
17109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17110 CHECK_ACCESS(_res_ptr);
17111 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
17113 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
17116 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
17117 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17118 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
17119 return (int64_t)ret_conv;
17121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17122 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
17123 int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
17127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17128 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
17129 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17130 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
17131 return (int64_t)ret_conv;
17134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17135 LDKCVec_MonitorEventZ _res_constr;
17136 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17137 if (_res_constr.datalen > 0)
17138 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17140 _res_constr.data = NULL;
17141 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17142 for (size_t o = 0; o < _res_constr.datalen; o++) {
17143 int64_t _res_conv_14 = _res_vals[o];
17144 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
17145 CHECK_ACCESS(_res_conv_14_ptr);
17146 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
17147 FREE((void*)_res_conv_14);
17148 _res_constr.data[o] = _res_conv_14_conv;
17150 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17151 CVec_MonitorEventZ_free(_res_constr);
17154 static inline uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
17155 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17156 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
17157 return ((int64_t)ret_conv);
17159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17160 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(arg & ~1);
17161 int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
17165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17166 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(orig & ~1);
17167 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17168 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
17169 return ((int64_t)ret_conv);
17172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
17173 LDKOutPoint a_conv;
17174 a_conv.inner = (void*)(a & (~1));
17175 a_conv.is_owned = (a & 1) || (a == 0);
17176 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17177 a_conv = OutPoint_clone(&a_conv);
17178 LDKCVec_MonitorEventZ b_constr;
17179 b_constr.datalen = (*env)->GetArrayLength(env, b);
17180 if (b_constr.datalen > 0)
17181 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17183 b_constr.data = NULL;
17184 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
17185 for (size_t o = 0; o < b_constr.datalen; o++) {
17186 int64_t b_conv_14 = b_vals[o];
17187 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
17188 CHECK_ACCESS(b_conv_14_ptr);
17189 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
17190 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
17191 b_constr.data[o] = b_conv_14_conv;
17193 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
17194 LDKPublicKey c_ref;
17195 CHECK((*env)->GetArrayLength(env, c) == 33);
17196 (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
17197 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17198 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
17199 return ((int64_t)ret_conv);
17202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17203 if ((_res & 1) != 0) return;
17204 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17205 CHECK_ACCESS(_res_ptr);
17206 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
17208 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
17211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17212 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
17213 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17214 if (_res_constr.datalen > 0)
17215 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
17217 _res_constr.data = NULL;
17218 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17219 for (size_t x = 0; x < _res_constr.datalen; x++) {
17220 int64_t _res_conv_49 = _res_vals[x];
17221 void* _res_conv_49_ptr = (void*)(((uintptr_t)_res_conv_49) & ~1);
17222 CHECK_ACCESS(_res_conv_49_ptr);
17223 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
17224 FREE((void*)_res_conv_49);
17225 _res_constr.data[x] = _res_conv_49_conv;
17227 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17228 CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
17231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17232 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17233 CHECK_ACCESS(o_ptr);
17234 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
17235 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
17236 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17237 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
17238 int64_t ret_ref = (uintptr_t)ret_copy;
17242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
17243 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17244 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
17245 int64_t ret_ref = (uintptr_t)ret_copy;
17249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17250 if ((_res & 1) != 0) return;
17251 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17252 CHECK_ACCESS(_res_ptr);
17253 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
17255 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
17258 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
17259 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17260 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
17261 int64_t ret_ref = (uintptr_t)ret_copy;
17264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17265 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
17266 int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
17270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17271 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
17272 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17273 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
17274 int64_t ret_ref = (uintptr_t)ret_copy;
17278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17279 LDKFixedPenaltyScorer o_conv;
17280 o_conv.inner = (void*)(o & (~1));
17281 o_conv.is_owned = (o & 1) || (o == 0);
17282 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17283 o_conv = FixedPenaltyScorer_clone(&o_conv);
17284 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17285 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17286 return (int64_t)ret_conv;
17289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17290 LDKDecodeError e_conv;
17291 e_conv.inner = (void*)(e & (~1));
17292 e_conv.is_owned = (e & 1) || (e == 0);
17293 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17294 e_conv = DecodeError_clone(&e_conv);
17295 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17296 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17297 return (int64_t)ret_conv;
17300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17301 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
17302 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17307 if ((_res & 1) != 0) return;
17308 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17309 CHECK_ACCESS(_res_ptr);
17310 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17312 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17315 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17316 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17317 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17318 return (int64_t)ret_conv;
17320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17321 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
17322 int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17327 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
17328 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17329 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17330 return (int64_t)ret_conv;
17333 static inline uintptr_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17334 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17335 *ret_conv = C2Tuple_u64u64Z_clone(arg);
17336 return ((int64_t)ret_conv);
17338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17339 LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)(arg & ~1);
17340 int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17345 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
17346 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17347 *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17348 return ((int64_t)ret_conv);
17351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17352 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17353 *ret_conv = C2Tuple_u64u64Z_new(a, b);
17354 return ((int64_t)ret_conv);
17357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17358 if ((_res & 1) != 0) return;
17359 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17360 CHECK_ACCESS(_res_ptr);
17361 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17363 C2Tuple_u64u64Z_free(_res_conv);
17366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17367 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17368 CHECK_ACCESS(o_ptr);
17369 LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17370 o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)(((uintptr_t)o) & ~1));
17371 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17372 *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17373 int64_t ret_ref = (uintptr_t)ret_copy;
17377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
17378 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17379 *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17380 int64_t ret_ref = (uintptr_t)ret_copy;
17384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17385 if ((_res & 1) != 0) return;
17386 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17387 CHECK_ACCESS(_res_ptr);
17388 LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17390 COption_C2Tuple_u64u64ZZ_free(_res_conv);
17393 static inline uintptr_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17394 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17395 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17396 int64_t ret_ref = (uintptr_t)ret_copy;
17399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17400 LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)arg;
17401 int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17406 LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)orig;
17407 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17408 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17409 int64_t ret_ref = (uintptr_t)ret_copy;
17413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17414 LDKCVec_NodeIdZ _res_constr;
17415 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17416 if (_res_constr.datalen > 0)
17417 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17419 _res_constr.data = NULL;
17420 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17421 for (size_t i = 0; i < _res_constr.datalen; i++) {
17422 int64_t _res_conv_8 = _res_vals[i];
17423 LDKNodeId _res_conv_8_conv;
17424 _res_conv_8_conv.inner = (void*)(_res_conv_8 & (~1));
17425 _res_conv_8_conv.is_owned = (_res_conv_8 & 1) || (_res_conv_8 == 0);
17426 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17427 _res_constr.data[i] = _res_conv_8_conv;
17429 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17430 CVec_NodeIdZ_free(_res_constr);
17433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17434 LDKProbabilisticScorer o_conv;
17435 o_conv.inner = (void*)(o & (~1));
17436 o_conv.is_owned = (o & 1) || (o == 0);
17437 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17438 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
17439 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17440 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
17441 return (int64_t)ret_conv;
17444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17445 LDKDecodeError e_conv;
17446 e_conv.inner = (void*)(e & (~1));
17447 e_conv.is_owned = (e & 1) || (e == 0);
17448 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17449 e_conv = DecodeError_clone(&e_conv);
17450 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17451 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
17452 return (int64_t)ret_conv;
17455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17456 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
17457 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
17461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17462 if ((_res & 1) != 0) return;
17463 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17464 CHECK_ACCESS(_res_ptr);
17465 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
17467 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
17470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17471 LDKInitFeatures o_conv;
17472 o_conv.inner = (void*)(o & (~1));
17473 o_conv.is_owned = (o & 1) || (o == 0);
17474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17475 o_conv = InitFeatures_clone(&o_conv);
17476 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17477 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
17478 return (int64_t)ret_conv;
17481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17482 LDKDecodeError e_conv;
17483 e_conv.inner = (void*)(e & (~1));
17484 e_conv.is_owned = (e & 1) || (e == 0);
17485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17486 e_conv = DecodeError_clone(&e_conv);
17487 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17488 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
17489 return (int64_t)ret_conv;
17492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17493 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
17494 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
17498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17499 if ((_res & 1) != 0) return;
17500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17501 CHECK_ACCESS(_res_ptr);
17502 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
17504 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
17507 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17508 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17509 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
17510 return (int64_t)ret_conv;
17512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17513 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
17514 int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17519 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
17520 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17521 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
17522 return (int64_t)ret_conv;
17525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17526 LDKChannelFeatures o_conv;
17527 o_conv.inner = (void*)(o & (~1));
17528 o_conv.is_owned = (o & 1) || (o == 0);
17529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17530 o_conv = ChannelFeatures_clone(&o_conv);
17531 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17532 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
17533 return (int64_t)ret_conv;
17536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17537 LDKDecodeError e_conv;
17538 e_conv.inner = (void*)(e & (~1));
17539 e_conv.is_owned = (e & 1) || (e == 0);
17540 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17541 e_conv = DecodeError_clone(&e_conv);
17542 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17543 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
17544 return (int64_t)ret_conv;
17547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17548 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
17549 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
17553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17554 if ((_res & 1) != 0) return;
17555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17556 CHECK_ACCESS(_res_ptr);
17557 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
17559 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
17562 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17563 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17564 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
17565 return (int64_t)ret_conv;
17567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17568 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
17569 int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17574 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
17575 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17576 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
17577 return (int64_t)ret_conv;
17580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17581 LDKNodeFeatures o_conv;
17582 o_conv.inner = (void*)(o & (~1));
17583 o_conv.is_owned = (o & 1) || (o == 0);
17584 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17585 o_conv = NodeFeatures_clone(&o_conv);
17586 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17587 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
17588 return (int64_t)ret_conv;
17591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17592 LDKDecodeError e_conv;
17593 e_conv.inner = (void*)(e & (~1));
17594 e_conv.is_owned = (e & 1) || (e == 0);
17595 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17596 e_conv = DecodeError_clone(&e_conv);
17597 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17598 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
17599 return (int64_t)ret_conv;
17602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17603 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
17604 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
17608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17609 if ((_res & 1) != 0) return;
17610 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17611 CHECK_ACCESS(_res_ptr);
17612 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
17614 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
17617 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17618 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17619 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
17620 return (int64_t)ret_conv;
17622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17623 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
17624 int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17629 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
17630 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17631 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
17632 return (int64_t)ret_conv;
17635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17636 LDKInvoiceFeatures o_conv;
17637 o_conv.inner = (void*)(o & (~1));
17638 o_conv.is_owned = (o & 1) || (o == 0);
17639 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17640 o_conv = InvoiceFeatures_clone(&o_conv);
17641 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17642 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
17643 return (int64_t)ret_conv;
17646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17647 LDKDecodeError e_conv;
17648 e_conv.inner = (void*)(e & (~1));
17649 e_conv.is_owned = (e & 1) || (e == 0);
17650 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17651 e_conv = DecodeError_clone(&e_conv);
17652 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17653 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
17654 return (int64_t)ret_conv;
17657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17658 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
17659 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
17663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17664 if ((_res & 1) != 0) return;
17665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17666 CHECK_ACCESS(_res_ptr);
17667 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
17669 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
17672 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17673 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17674 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
17675 return (int64_t)ret_conv;
17677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17678 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
17679 int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17684 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
17685 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17686 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
17687 return (int64_t)ret_conv;
17690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17691 LDKChannelTypeFeatures o_conv;
17692 o_conv.inner = (void*)(o & (~1));
17693 o_conv.is_owned = (o & 1) || (o == 0);
17694 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17695 o_conv = ChannelTypeFeatures_clone(&o_conv);
17696 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17697 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
17698 return (int64_t)ret_conv;
17701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17702 LDKDecodeError e_conv;
17703 e_conv.inner = (void*)(e & (~1));
17704 e_conv.is_owned = (e & 1) || (e == 0);
17705 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17706 e_conv = DecodeError_clone(&e_conv);
17707 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17708 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
17709 return (int64_t)ret_conv;
17712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17713 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
17714 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
17718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17719 if ((_res & 1) != 0) return;
17720 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17721 CHECK_ACCESS(_res_ptr);
17722 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
17724 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
17727 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17728 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17729 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
17730 return (int64_t)ret_conv;
17732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17733 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
17734 int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17739 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
17740 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17741 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
17742 return (int64_t)ret_conv;
17745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17747 o_conv.inner = (void*)(o & (~1));
17748 o_conv.is_owned = (o & 1) || (o == 0);
17749 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17750 o_conv = NodeId_clone(&o_conv);
17751 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17752 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
17753 return (int64_t)ret_conv;
17756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17757 LDKDecodeError e_conv;
17758 e_conv.inner = (void*)(e & (~1));
17759 e_conv.is_owned = (e & 1) || (e == 0);
17760 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17761 e_conv = DecodeError_clone(&e_conv);
17762 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17763 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
17764 return (int64_t)ret_conv;
17767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17768 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
17769 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
17773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17774 if ((_res & 1) != 0) return;
17775 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17776 CHECK_ACCESS(_res_ptr);
17777 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
17779 CResult_NodeIdDecodeErrorZ_free(_res_conv);
17782 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
17783 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17784 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
17785 return (int64_t)ret_conv;
17787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17788 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
17789 int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
17793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17794 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
17795 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17796 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
17797 return (int64_t)ret_conv;
17800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17801 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17802 CHECK_ACCESS(o_ptr);
17803 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
17804 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
17805 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17806 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
17807 return (int64_t)ret_conv;
17810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17811 LDKDecodeError e_conv;
17812 e_conv.inner = (void*)(e & (~1));
17813 e_conv.is_owned = (e & 1) || (e == 0);
17814 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17815 e_conv = DecodeError_clone(&e_conv);
17816 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17817 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
17818 return (int64_t)ret_conv;
17821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17822 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
17823 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
17827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17828 if ((_res & 1) != 0) return;
17829 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17830 CHECK_ACCESS(_res_ptr);
17831 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
17833 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
17836 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
17837 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17838 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
17839 return (int64_t)ret_conv;
17841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17842 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
17843 int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
17847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17848 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
17849 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17850 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
17851 return (int64_t)ret_conv;
17854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17855 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17856 CHECK_ACCESS(o_ptr);
17857 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
17858 if (o_conv.free == LDKAccess_JCalls_free) {
17859 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17860 LDKAccess_JCalls_cloned(&o_conv);
17862 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17863 *ret_copy = COption_AccessZ_some(o_conv);
17864 int64_t ret_ref = (uintptr_t)ret_copy;
17868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
17869 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17870 *ret_copy = COption_AccessZ_none();
17871 int64_t ret_ref = (uintptr_t)ret_copy;
17875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17876 if ((_res & 1) != 0) return;
17877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17878 CHECK_ACCESS(_res_ptr);
17879 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
17881 COption_AccessZ_free(_res_conv);
17884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17885 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17886 *ret_conv = CResult_boolLightningErrorZ_ok(o);
17887 return (int64_t)ret_conv;
17890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17891 LDKLightningError e_conv;
17892 e_conv.inner = (void*)(e & (~1));
17893 e_conv.is_owned = (e & 1) || (e == 0);
17894 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17895 e_conv = LightningError_clone(&e_conv);
17896 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17897 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
17898 return (int64_t)ret_conv;
17901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17902 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
17903 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
17907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17908 if ((_res & 1) != 0) return;
17909 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17910 CHECK_ACCESS(_res_ptr);
17911 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
17913 CResult_boolLightningErrorZ_free(_res_conv);
17916 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
17917 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17918 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
17919 return (int64_t)ret_conv;
17921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17922 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
17923 int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
17927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17928 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
17929 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17930 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
17931 return (int64_t)ret_conv;
17934 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
17935 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17936 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
17937 return ((int64_t)ret_conv);
17939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17940 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
17941 int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
17945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17946 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
17947 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17948 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
17949 return ((int64_t)ret_conv);
17952 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) {
17953 LDKChannelAnnouncement a_conv;
17954 a_conv.inner = (void*)(a & (~1));
17955 a_conv.is_owned = (a & 1) || (a == 0);
17956 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17957 a_conv = ChannelAnnouncement_clone(&a_conv);
17958 LDKChannelUpdate b_conv;
17959 b_conv.inner = (void*)(b & (~1));
17960 b_conv.is_owned = (b & 1) || (b == 0);
17961 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17962 b_conv = ChannelUpdate_clone(&b_conv);
17963 LDKChannelUpdate c_conv;
17964 c_conv.inner = (void*)(c & (~1));
17965 c_conv.is_owned = (c & 1) || (c == 0);
17966 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17967 c_conv = ChannelUpdate_clone(&c_conv);
17968 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17969 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
17970 return ((int64_t)ret_conv);
17973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17974 if ((_res & 1) != 0) return;
17975 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17976 CHECK_ACCESS(_res_ptr);
17977 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
17979 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
17982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17983 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
17984 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17985 if (_res_constr.datalen > 0)
17986 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
17988 _res_constr.data = NULL;
17989 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17990 for (size_t h = 0; h < _res_constr.datalen; h++) {
17991 int64_t _res_conv_59 = _res_vals[h];
17992 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
17993 CHECK_ACCESS(_res_conv_59_ptr);
17994 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
17995 FREE((void*)_res_conv_59);
17996 _res_constr.data[h] = _res_conv_59_conv;
17998 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17999 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
18002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18003 LDKCVec_NodeAnnouncementZ _res_constr;
18004 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18005 if (_res_constr.datalen > 0)
18006 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
18008 _res_constr.data = NULL;
18009 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18010 for (size_t s = 0; s < _res_constr.datalen; s++) {
18011 int64_t _res_conv_18 = _res_vals[s];
18012 LDKNodeAnnouncement _res_conv_18_conv;
18013 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
18014 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
18015 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
18016 _res_constr.data[s] = _res_conv_18_conv;
18018 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18019 CVec_NodeAnnouncementZ_free(_res_constr);
18022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
18023 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18024 *ret_conv = CResult_NoneLightningErrorZ_ok();
18025 return (int64_t)ret_conv;
18028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18029 LDKLightningError e_conv;
18030 e_conv.inner = (void*)(e & (~1));
18031 e_conv.is_owned = (e & 1) || (e == 0);
18032 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18033 e_conv = LightningError_clone(&e_conv);
18034 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18035 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18036 return (int64_t)ret_conv;
18039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18040 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
18041 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
18045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18046 if ((_res & 1) != 0) return;
18047 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18048 CHECK_ACCESS(_res_ptr);
18049 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18051 CResult_NoneLightningErrorZ_free(_res_conv);
18054 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
18055 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18056 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
18057 return (int64_t)ret_conv;
18059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18060 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
18061 int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
18065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18066 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
18067 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18068 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
18069 return (int64_t)ret_conv;
18072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18073 LDKChannelUpdateInfo o_conv;
18074 o_conv.inner = (void*)(o & (~1));
18075 o_conv.is_owned = (o & 1) || (o == 0);
18076 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18077 o_conv = ChannelUpdateInfo_clone(&o_conv);
18078 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18079 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
18080 return (int64_t)ret_conv;
18083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18084 LDKDecodeError e_conv;
18085 e_conv.inner = (void*)(e & (~1));
18086 e_conv.is_owned = (e & 1) || (e == 0);
18087 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18088 e_conv = DecodeError_clone(&e_conv);
18089 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18090 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
18091 return (int64_t)ret_conv;
18094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18095 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
18096 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
18100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18101 if ((_res & 1) != 0) return;
18102 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18103 CHECK_ACCESS(_res_ptr);
18104 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
18106 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
18109 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
18110 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18111 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
18112 return (int64_t)ret_conv;
18114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18115 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
18116 int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
18120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18121 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
18122 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18123 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
18124 return (int64_t)ret_conv;
18127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18128 LDKChannelInfo o_conv;
18129 o_conv.inner = (void*)(o & (~1));
18130 o_conv.is_owned = (o & 1) || (o == 0);
18131 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18132 o_conv = ChannelInfo_clone(&o_conv);
18133 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18134 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
18135 return (int64_t)ret_conv;
18138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18139 LDKDecodeError e_conv;
18140 e_conv.inner = (void*)(e & (~1));
18141 e_conv.is_owned = (e & 1) || (e == 0);
18142 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18143 e_conv = DecodeError_clone(&e_conv);
18144 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18145 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
18146 return (int64_t)ret_conv;
18149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18150 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
18151 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
18155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18156 if ((_res & 1) != 0) return;
18157 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18158 CHECK_ACCESS(_res_ptr);
18159 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
18161 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
18164 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
18165 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18166 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
18167 return (int64_t)ret_conv;
18169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18170 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
18171 int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
18175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18176 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
18177 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18178 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
18179 return (int64_t)ret_conv;
18182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18183 LDKRoutingFees o_conv;
18184 o_conv.inner = (void*)(o & (~1));
18185 o_conv.is_owned = (o & 1) || (o == 0);
18186 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18187 o_conv = RoutingFees_clone(&o_conv);
18188 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18189 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
18190 return (int64_t)ret_conv;
18193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18194 LDKDecodeError e_conv;
18195 e_conv.inner = (void*)(e & (~1));
18196 e_conv.is_owned = (e & 1) || (e == 0);
18197 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18198 e_conv = DecodeError_clone(&e_conv);
18199 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18200 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
18201 return (int64_t)ret_conv;
18204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18205 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
18206 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
18210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18211 if ((_res & 1) != 0) return;
18212 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18213 CHECK_ACCESS(_res_ptr);
18214 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
18216 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
18219 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
18220 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18221 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
18222 return (int64_t)ret_conv;
18224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18225 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
18226 int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
18230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18231 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
18232 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18233 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
18234 return (int64_t)ret_conv;
18237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18238 LDKCVec_NetAddressZ _res_constr;
18239 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18240 if (_res_constr.datalen > 0)
18241 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18243 _res_constr.data = NULL;
18244 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18245 for (size_t m = 0; m < _res_constr.datalen; m++) {
18246 int64_t _res_conv_12 = _res_vals[m];
18247 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
18248 CHECK_ACCESS(_res_conv_12_ptr);
18249 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
18250 FREE((void*)_res_conv_12);
18251 _res_constr.data[m] = _res_conv_12_conv;
18253 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18254 CVec_NetAddressZ_free(_res_constr);
18257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18258 LDKNodeAnnouncementInfo o_conv;
18259 o_conv.inner = (void*)(o & (~1));
18260 o_conv.is_owned = (o & 1) || (o == 0);
18261 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18262 o_conv = NodeAnnouncementInfo_clone(&o_conv);
18263 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18264 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
18265 return (int64_t)ret_conv;
18268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18269 LDKDecodeError e_conv;
18270 e_conv.inner = (void*)(e & (~1));
18271 e_conv.is_owned = (e & 1) || (e == 0);
18272 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18273 e_conv = DecodeError_clone(&e_conv);
18274 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18275 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
18276 return (int64_t)ret_conv;
18279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18280 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
18281 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
18285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18286 if ((_res & 1) != 0) return;
18287 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18288 CHECK_ACCESS(_res_ptr);
18289 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
18291 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
18294 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
18295 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18296 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
18297 return (int64_t)ret_conv;
18299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18300 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
18301 int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
18305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18306 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
18307 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18308 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
18309 return (int64_t)ret_conv;
18312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18313 LDKNodeAlias o_conv;
18314 o_conv.inner = (void*)(o & (~1));
18315 o_conv.is_owned = (o & 1) || (o == 0);
18316 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18317 o_conv = NodeAlias_clone(&o_conv);
18318 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18319 *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
18320 return (int64_t)ret_conv;
18323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18324 LDKDecodeError e_conv;
18325 e_conv.inner = (void*)(e & (~1));
18326 e_conv.is_owned = (e & 1) || (e == 0);
18327 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18328 e_conv = DecodeError_clone(&e_conv);
18329 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18330 *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
18331 return (int64_t)ret_conv;
18334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18335 LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(o & ~1);
18336 jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
18340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18341 if ((_res & 1) != 0) return;
18342 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18343 CHECK_ACCESS(_res_ptr);
18344 LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
18346 CResult_NodeAliasDecodeErrorZ_free(_res_conv);
18349 static inline uintptr_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
18350 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18351 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
18352 return (int64_t)ret_conv;
18354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18355 LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(arg & ~1);
18356 int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
18360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18361 LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(orig & ~1);
18362 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18363 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
18364 return (int64_t)ret_conv;
18367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18368 LDKNodeInfo o_conv;
18369 o_conv.inner = (void*)(o & (~1));
18370 o_conv.is_owned = (o & 1) || (o == 0);
18371 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18372 o_conv = NodeInfo_clone(&o_conv);
18373 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18374 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
18375 return (int64_t)ret_conv;
18378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18379 LDKDecodeError e_conv;
18380 e_conv.inner = (void*)(e & (~1));
18381 e_conv.is_owned = (e & 1) || (e == 0);
18382 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18383 e_conv = DecodeError_clone(&e_conv);
18384 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18385 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
18386 return (int64_t)ret_conv;
18389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18390 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
18391 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
18395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18396 if ((_res & 1) != 0) return;
18397 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18398 CHECK_ACCESS(_res_ptr);
18399 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
18401 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
18404 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
18405 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18406 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
18407 return (int64_t)ret_conv;
18409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18410 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
18411 int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
18415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18416 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
18417 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18418 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
18419 return (int64_t)ret_conv;
18422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18423 LDKNetworkGraph o_conv;
18424 o_conv.inner = (void*)(o & (~1));
18425 o_conv.is_owned = (o & 1) || (o == 0);
18426 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18427 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
18428 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18429 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
18430 return (int64_t)ret_conv;
18433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18434 LDKDecodeError e_conv;
18435 e_conv.inner = (void*)(e & (~1));
18436 e_conv.is_owned = (e & 1) || (e == 0);
18437 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18438 e_conv = DecodeError_clone(&e_conv);
18439 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18440 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
18441 return (int64_t)ret_conv;
18444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18445 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
18446 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
18450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18451 if ((_res & 1) != 0) return;
18452 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18453 CHECK_ACCESS(_res_ptr);
18454 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
18456 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
18459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
18460 LDKCVec_NetAddressZ o_constr;
18461 o_constr.datalen = (*env)->GetArrayLength(env, o);
18462 if (o_constr.datalen > 0)
18463 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18465 o_constr.data = NULL;
18466 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18467 for (size_t m = 0; m < o_constr.datalen; m++) {
18468 int64_t o_conv_12 = o_vals[m];
18469 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
18470 CHECK_ACCESS(o_conv_12_ptr);
18471 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
18472 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
18473 o_constr.data[m] = o_conv_12_conv;
18475 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18476 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18477 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
18478 int64_t ret_ref = (uintptr_t)ret_copy;
18482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
18483 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18484 *ret_copy = COption_CVec_NetAddressZZ_none();
18485 int64_t ret_ref = (uintptr_t)ret_copy;
18489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18490 if ((_res & 1) != 0) return;
18491 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18492 CHECK_ACCESS(_res_ptr);
18493 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
18495 COption_CVec_NetAddressZZ_free(_res_conv);
18498 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
18499 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18500 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
18501 int64_t ret_ref = (uintptr_t)ret_copy;
18504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18505 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
18506 int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
18510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18511 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
18512 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18513 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
18514 int64_t ret_ref = (uintptr_t)ret_copy;
18518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18519 LDKDelayedPaymentOutputDescriptor o_conv;
18520 o_conv.inner = (void*)(o & (~1));
18521 o_conv.is_owned = (o & 1) || (o == 0);
18522 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18523 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
18524 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18525 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18526 return (int64_t)ret_conv;
18529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18530 LDKDecodeError e_conv;
18531 e_conv.inner = (void*)(e & (~1));
18532 e_conv.is_owned = (e & 1) || (e == 0);
18533 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18534 e_conv = DecodeError_clone(&e_conv);
18535 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18536 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18537 return (int64_t)ret_conv;
18540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18541 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18542 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18547 if ((_res & 1) != 0) return;
18548 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18549 CHECK_ACCESS(_res_ptr);
18550 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18552 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18555 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18556 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18557 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18558 return (int64_t)ret_conv;
18560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18561 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18562 int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18567 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18568 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18569 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18570 return (int64_t)ret_conv;
18573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18574 LDKStaticPaymentOutputDescriptor o_conv;
18575 o_conv.inner = (void*)(o & (~1));
18576 o_conv.is_owned = (o & 1) || (o == 0);
18577 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18578 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
18579 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18580 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18581 return (int64_t)ret_conv;
18584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18585 LDKDecodeError e_conv;
18586 e_conv.inner = (void*)(e & (~1));
18587 e_conv.is_owned = (e & 1) || (e == 0);
18588 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18589 e_conv = DecodeError_clone(&e_conv);
18590 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18591 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18592 return (int64_t)ret_conv;
18595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18596 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18597 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18602 if ((_res & 1) != 0) return;
18603 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18604 CHECK_ACCESS(_res_ptr);
18605 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18607 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18610 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18611 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18612 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18613 return (int64_t)ret_conv;
18615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18616 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18617 int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18622 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18623 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18624 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18625 return (int64_t)ret_conv;
18628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18629 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18630 CHECK_ACCESS(o_ptr);
18631 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
18632 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
18633 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18634 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
18635 return (int64_t)ret_conv;
18638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18639 LDKDecodeError e_conv;
18640 e_conv.inner = (void*)(e & (~1));
18641 e_conv.is_owned = (e & 1) || (e == 0);
18642 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18643 e_conv = DecodeError_clone(&e_conv);
18644 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18645 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
18646 return (int64_t)ret_conv;
18649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18650 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
18651 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18656 if ((_res & 1) != 0) return;
18657 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18658 CHECK_ACCESS(_res_ptr);
18659 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
18661 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
18664 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18665 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18666 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
18667 return (int64_t)ret_conv;
18669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18670 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
18671 int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18676 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
18677 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18678 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
18679 return (int64_t)ret_conv;
18682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18683 LDKCVec_PaymentPreimageZ _res_constr;
18684 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18685 if (_res_constr.datalen > 0)
18686 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
18688 _res_constr.data = NULL;
18689 for (size_t i = 0; i < _res_constr.datalen; i++) {
18690 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18691 LDKThirtyTwoBytes _res_conv_8_ref;
18692 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18693 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18694 _res_constr.data[i] = _res_conv_8_ref;
18696 CVec_PaymentPreimageZ_free(_res_constr);
18699 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
18700 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18701 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
18702 return ((int64_t)ret_conv);
18704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18705 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
18706 int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
18710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18711 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
18712 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18713 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
18714 return ((int64_t)ret_conv);
18717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
18718 LDKSignature a_ref;
18719 CHECK((*env)->GetArrayLength(env, a) == 64);
18720 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18721 LDKCVec_SignatureZ b_constr;
18722 b_constr.datalen = (*env)->GetArrayLength(env, b);
18723 if (b_constr.datalen > 0)
18724 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18726 b_constr.data = NULL;
18727 for (size_t i = 0; i < b_constr.datalen; i++) {
18728 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
18729 LDKSignature b_conv_8_ref;
18730 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
18731 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
18732 b_constr.data[i] = b_conv_8_ref;
18734 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18735 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
18736 return ((int64_t)ret_conv);
18739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18740 if ((_res & 1) != 0) return;
18741 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18742 CHECK_ACCESS(_res_ptr);
18743 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
18745 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
18748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18749 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18750 CHECK_ACCESS(o_ptr);
18751 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
18752 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
18753 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18754 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
18755 return (int64_t)ret_conv;
18758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
18759 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18760 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
18761 return (int64_t)ret_conv;
18764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18765 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
18766 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
18770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18771 if ((_res & 1) != 0) return;
18772 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18773 CHECK_ACCESS(_res_ptr);
18774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
18776 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
18779 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
18780 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18781 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
18782 return (int64_t)ret_conv;
18784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18785 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
18786 int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
18790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18791 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
18792 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18793 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
18794 return (int64_t)ret_conv;
18797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18798 LDKSignature o_ref;
18799 CHECK((*env)->GetArrayLength(env, o) == 64);
18800 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
18801 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18802 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
18803 return (int64_t)ret_conv;
18806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18807 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18808 *ret_conv = CResult_SignatureNoneZ_err();
18809 return (int64_t)ret_conv;
18812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18813 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
18814 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
18818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18819 if ((_res & 1) != 0) return;
18820 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18821 CHECK_ACCESS(_res_ptr);
18822 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
18824 CResult_SignatureNoneZ_free(_res_conv);
18827 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
18828 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18829 *ret_conv = CResult_SignatureNoneZ_clone(arg);
18830 return (int64_t)ret_conv;
18832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18833 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
18834 int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
18838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18839 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
18840 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18841 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
18842 return (int64_t)ret_conv;
18845 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
18846 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18847 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
18848 return ((int64_t)ret_conv);
18850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18851 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
18852 int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
18856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18857 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
18858 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18859 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
18860 return ((int64_t)ret_conv);
18863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18864 LDKSignature a_ref;
18865 CHECK((*env)->GetArrayLength(env, a) == 64);
18866 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18867 LDKSignature b_ref;
18868 CHECK((*env)->GetArrayLength(env, b) == 64);
18869 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
18870 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18871 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
18872 return ((int64_t)ret_conv);
18875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18876 if ((_res & 1) != 0) return;
18877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18878 CHECK_ACCESS(_res_ptr);
18879 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
18881 C2Tuple_SignatureSignatureZ_free(_res_conv);
18884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18885 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18886 CHECK_ACCESS(o_ptr);
18887 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
18888 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
18889 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18890 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
18891 return (int64_t)ret_conv;
18894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
18895 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18896 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
18897 return (int64_t)ret_conv;
18900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18901 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
18902 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
18906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18907 if ((_res & 1) != 0) return;
18908 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18909 CHECK_ACCESS(_res_ptr);
18910 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
18912 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
18915 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
18916 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18917 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
18918 return (int64_t)ret_conv;
18920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18921 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
18922 int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
18926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18927 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
18928 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18929 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
18930 return (int64_t)ret_conv;
18933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18934 LDKSecretKey o_ref;
18935 CHECK((*env)->GetArrayLength(env, o) == 32);
18936 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
18937 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18938 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
18939 return (int64_t)ret_conv;
18942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
18943 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18944 *ret_conv = CResult_SecretKeyNoneZ_err();
18945 return (int64_t)ret_conv;
18948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18949 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
18950 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
18954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18955 if ((_res & 1) != 0) return;
18956 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18957 CHECK_ACCESS(_res_ptr);
18958 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
18960 CResult_SecretKeyNoneZ_free(_res_conv);
18963 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
18964 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18965 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
18966 return (int64_t)ret_conv;
18968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18969 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
18970 int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
18974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18975 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
18976 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18977 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
18978 return (int64_t)ret_conv;
18981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18982 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18983 CHECK_ACCESS(o_ptr);
18984 LDKSign o_conv = *(LDKSign*)(o_ptr);
18985 if (o_conv.free == LDKSign_JCalls_free) {
18986 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18987 LDKSign_JCalls_cloned(&o_conv);
18989 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18990 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
18991 return (int64_t)ret_conv;
18994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18995 LDKDecodeError e_conv;
18996 e_conv.inner = (void*)(e & (~1));
18997 e_conv.is_owned = (e & 1) || (e == 0);
18998 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18999 e_conv = DecodeError_clone(&e_conv);
19000 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19001 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
19002 return (int64_t)ret_conv;
19005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19006 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
19007 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
19011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19012 if ((_res & 1) != 0) return;
19013 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19014 CHECK_ACCESS(_res_ptr);
19015 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
19017 CResult_SignDecodeErrorZ_free(_res_conv);
19020 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
19021 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19022 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
19023 return (int64_t)ret_conv;
19025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19026 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
19027 int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
19031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19032 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
19033 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19034 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
19035 return (int64_t)ret_conv;
19038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19039 LDKCVec_u5Z _res_constr;
19040 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19041 if (_res_constr.datalen > 0)
19042 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
19044 _res_constr.data = NULL;
19045 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
19046 for (size_t h = 0; h < _res_constr.datalen; h++) {
19047 int8_t _res_conv_7 = _res_vals[h];
19049 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
19051 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
19052 CVec_u5Z_free(_res_constr);
19055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19056 LDKRecoverableSignature o_ref;
19057 CHECK((*env)->GetArrayLength(env, o) == 68);
19058 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
19059 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19060 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19061 return (int64_t)ret_conv;
19064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
19065 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19066 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19067 return (int64_t)ret_conv;
19070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19071 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
19072 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19077 if ((_res & 1) != 0) return;
19078 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19079 CHECK_ACCESS(_res_ptr);
19080 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19082 CResult_RecoverableSignatureNoneZ_free(_res_conv);
19085 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19086 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19087 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19088 return (int64_t)ret_conv;
19090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19091 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
19092 int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19097 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
19098 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19099 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19100 return (int64_t)ret_conv;
19103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19104 LDKCVec_u8Z _res_ref;
19105 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19106 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
19107 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19108 CVec_u8Z_free(_res_ref);
19111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19112 LDKCVec_CVec_u8ZZ _res_constr;
19113 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19114 if (_res_constr.datalen > 0)
19115 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19117 _res_constr.data = NULL;
19118 for (size_t i = 0; i < _res_constr.datalen; i++) {
19119 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19120 LDKCVec_u8Z _res_conv_8_ref;
19121 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19122 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19123 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19124 _res_constr.data[i] = _res_conv_8_ref;
19126 CVec_CVec_u8ZZ_free(_res_constr);
19129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
19130 LDKCVec_CVec_u8ZZ o_constr;
19131 o_constr.datalen = (*env)->GetArrayLength(env, o);
19132 if (o_constr.datalen > 0)
19133 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19135 o_constr.data = NULL;
19136 for (size_t i = 0; i < o_constr.datalen; i++) {
19137 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
19138 LDKCVec_u8Z o_conv_8_ref;
19139 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
19140 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19141 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
19142 o_constr.data[i] = o_conv_8_ref;
19144 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19145 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
19146 return (int64_t)ret_conv;
19149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
19150 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19151 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
19152 return (int64_t)ret_conv;
19155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19156 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
19157 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
19161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19162 if ((_res & 1) != 0) return;
19163 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19164 CHECK_ACCESS(_res_ptr);
19165 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
19167 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
19170 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
19171 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19172 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
19173 return (int64_t)ret_conv;
19175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19176 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
19177 int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
19181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19182 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
19183 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19184 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
19185 return (int64_t)ret_conv;
19188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19189 LDKInMemorySigner o_conv;
19190 o_conv.inner = (void*)(o & (~1));
19191 o_conv.is_owned = (o & 1) || (o == 0);
19192 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19193 o_conv = InMemorySigner_clone(&o_conv);
19194 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19195 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
19196 return (int64_t)ret_conv;
19199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19200 LDKDecodeError e_conv;
19201 e_conv.inner = (void*)(e & (~1));
19202 e_conv.is_owned = (e & 1) || (e == 0);
19203 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19204 e_conv = DecodeError_clone(&e_conv);
19205 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19206 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
19207 return (int64_t)ret_conv;
19210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19211 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
19212 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
19216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19217 if ((_res & 1) != 0) return;
19218 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19219 CHECK_ACCESS(_res_ptr);
19220 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
19222 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
19225 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
19226 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19227 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
19228 return (int64_t)ret_conv;
19230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19231 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
19232 int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
19236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19237 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
19238 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19239 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
19240 return (int64_t)ret_conv;
19243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19244 LDKCVec_TxOutZ _res_constr;
19245 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19246 if (_res_constr.datalen > 0)
19247 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19249 _res_constr.data = NULL;
19250 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19251 for (size_t h = 0; h < _res_constr.datalen; h++) {
19252 int64_t _res_conv_7 = _res_vals[h];
19253 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19254 CHECK_ACCESS(_res_conv_7_ptr);
19255 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19256 FREE((void*)_res_conv_7);
19257 _res_constr.data[h] = _res_conv_7_conv;
19259 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19260 CVec_TxOutZ_free(_res_constr);
19263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19264 LDKTransaction o_ref;
19265 o_ref.datalen = (*env)->GetArrayLength(env, o);
19266 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
19267 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19268 o_ref.data_is_owned = true;
19269 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19270 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
19271 return (int64_t)ret_conv;
19274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
19275 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19276 *ret_conv = CResult_TransactionNoneZ_err();
19277 return (int64_t)ret_conv;
19280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19281 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
19282 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
19286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19287 if ((_res & 1) != 0) return;
19288 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19289 CHECK_ACCESS(_res_ptr);
19290 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
19292 CResult_TransactionNoneZ_free(_res_conv);
19295 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
19296 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19297 *ret_conv = CResult_TransactionNoneZ_clone(arg);
19298 return (int64_t)ret_conv;
19300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19301 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
19302 int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
19306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19307 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
19308 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19309 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
19310 return (int64_t)ret_conv;
19313 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19314 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19315 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19316 return ((int64_t)ret_conv);
19318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19319 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
19320 int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19325 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
19326 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19327 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19328 return ((int64_t)ret_conv);
19331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19332 LDKThirtyTwoBytes a_ref;
19333 CHECK((*env)->GetArrayLength(env, a) == 32);
19334 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19335 LDKChannelMonitor b_conv;
19336 b_conv.inner = (void*)(b & (~1));
19337 b_conv.is_owned = (b & 1) || (b == 0);
19338 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19339 b_conv = ChannelMonitor_clone(&b_conv);
19340 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19341 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19342 return ((int64_t)ret_conv);
19345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19346 if ((_res & 1) != 0) return;
19347 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19348 CHECK_ACCESS(_res_ptr);
19349 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19351 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19355 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
19356 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19357 if (_res_constr.datalen > 0)
19358 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19360 _res_constr.data = NULL;
19361 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19362 for (size_t j = 0; j < _res_constr.datalen; j++) {
19363 int64_t _res_conv_35 = _res_vals[j];
19364 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
19365 CHECK_ACCESS(_res_conv_35_ptr);
19366 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
19367 FREE((void*)_res_conv_35);
19368 _res_constr.data[j] = _res_conv_35_conv;
19370 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19371 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
19374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
19375 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
19376 o_constr.datalen = (*env)->GetArrayLength(env, o);
19377 if (o_constr.datalen > 0)
19378 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19380 o_constr.data = NULL;
19381 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
19382 for (size_t j = 0; j < o_constr.datalen; j++) {
19383 int64_t o_conv_35 = o_vals[j];
19384 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
19385 CHECK_ACCESS(o_conv_35_ptr);
19386 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
19387 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
19388 o_constr.data[j] = o_conv_35_conv;
19390 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
19391 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19392 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
19393 return (int64_t)ret_conv;
19396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19397 LDKIOError e_conv = LDKIOError_from_java(env, e);
19398 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19399 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
19400 return (int64_t)ret_conv;
19403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19404 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
19405 jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
19409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19410 if ((_res & 1) != 0) return;
19411 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19412 CHECK_ACCESS(_res_ptr);
19413 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
19415 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
19418 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
19419 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19420 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
19421 return (int64_t)ret_conv;
19423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19424 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
19425 int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
19429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19430 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
19431 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19432 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
19433 return (int64_t)ret_conv;
19436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
19437 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19438 *ret_copy = COption_u16Z_some(o);
19439 int64_t ret_ref = (uintptr_t)ret_copy;
19443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
19444 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19445 *ret_copy = COption_u16Z_none();
19446 int64_t ret_ref = (uintptr_t)ret_copy;
19450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19451 if ((_res & 1) != 0) return;
19452 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19453 CHECK_ACCESS(_res_ptr);
19454 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
19456 COption_u16Z_free(_res_conv);
19459 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
19460 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19461 *ret_copy = COption_u16Z_clone(arg);
19462 int64_t ret_ref = (uintptr_t)ret_copy;
19465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19466 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
19467 int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
19471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19472 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
19473 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19474 *ret_copy = COption_u16Z_clone(orig_conv);
19475 int64_t ret_ref = (uintptr_t)ret_copy;
19479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19480 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19481 *ret_conv = CResult_NoneAPIErrorZ_ok();
19482 return (int64_t)ret_conv;
19485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19486 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19487 CHECK_ACCESS(e_ptr);
19488 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19489 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19490 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19491 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19492 return (int64_t)ret_conv;
19495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19496 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
19497 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19502 if ((_res & 1) != 0) return;
19503 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19504 CHECK_ACCESS(_res_ptr);
19505 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19507 CResult_NoneAPIErrorZ_free(_res_conv);
19510 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19511 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19512 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19513 return (int64_t)ret_conv;
19515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19516 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
19517 int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19522 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
19523 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19524 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19525 return (int64_t)ret_conv;
19528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19529 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19530 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19531 if (_res_constr.datalen > 0)
19532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19534 _res_constr.data = NULL;
19535 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19536 for (size_t w = 0; w < _res_constr.datalen; w++) {
19537 int64_t _res_conv_22 = _res_vals[w];
19538 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
19539 CHECK_ACCESS(_res_conv_22_ptr);
19540 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19541 FREE((void*)_res_conv_22);
19542 _res_constr.data[w] = _res_conv_22_conv;
19544 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19545 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19549 LDKCVec_APIErrorZ _res_constr;
19550 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19551 if (_res_constr.datalen > 0)
19552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19554 _res_constr.data = NULL;
19555 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19556 for (size_t k = 0; k < _res_constr.datalen; k++) {
19557 int64_t _res_conv_10 = _res_vals[k];
19558 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
19559 CHECK_ACCESS(_res_conv_10_ptr);
19560 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19561 FREE((void*)_res_conv_10);
19562 _res_constr.data[k] = _res_conv_10_conv;
19564 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19565 CVec_APIErrorZ_free(_res_constr);
19568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19569 LDKThirtyTwoBytes o_ref;
19570 CHECK((*env)->GetArrayLength(env, o) == 32);
19571 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19572 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19573 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
19574 return (int64_t)ret_conv;
19577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19578 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19579 CHECK_ACCESS(e_ptr);
19580 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19581 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19582 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19583 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
19584 return (int64_t)ret_conv;
19587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19588 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
19589 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
19593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19594 if ((_res & 1) != 0) return;
19595 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19596 CHECK_ACCESS(_res_ptr);
19597 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
19599 CResult__u832APIErrorZ_free(_res_conv);
19602 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
19603 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19604 *ret_conv = CResult__u832APIErrorZ_clone(arg);
19605 return (int64_t)ret_conv;
19607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19608 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
19609 int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
19613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19614 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
19615 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19616 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
19617 return (int64_t)ret_conv;
19620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19621 LDKThirtyTwoBytes o_ref;
19622 CHECK((*env)->GetArrayLength(env, o) == 32);
19623 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19624 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19625 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
19626 return (int64_t)ret_conv;
19629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19630 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19631 CHECK_ACCESS(e_ptr);
19632 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19633 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19634 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19635 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
19636 return (int64_t)ret_conv;
19639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19640 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
19641 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
19645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19646 if ((_res & 1) != 0) return;
19647 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19648 CHECK_ACCESS(_res_ptr);
19649 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
19651 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
19654 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
19655 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19656 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
19657 return (int64_t)ret_conv;
19659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19660 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
19661 int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
19665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19666 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
19667 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19668 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
19669 return (int64_t)ret_conv;
19672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
19673 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19674 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
19675 return (int64_t)ret_conv;
19678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19679 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19680 CHECK_ACCESS(e_ptr);
19681 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19682 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19683 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19684 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
19685 return (int64_t)ret_conv;
19688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19689 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
19690 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
19694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19695 if ((_res & 1) != 0) return;
19696 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19697 CHECK_ACCESS(_res_ptr);
19698 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
19700 CResult_NonePaymentSendFailureZ_free(_res_conv);
19703 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
19704 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19705 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
19706 return (int64_t)ret_conv;
19708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19709 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
19710 int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
19714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19715 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
19716 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19717 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
19718 return (int64_t)ret_conv;
19721 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
19722 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19723 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
19724 return ((int64_t)ret_conv);
19726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19727 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
19728 int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
19732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19733 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
19734 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19735 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
19736 return ((int64_t)ret_conv);
19739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19740 LDKThirtyTwoBytes a_ref;
19741 CHECK((*env)->GetArrayLength(env, a) == 32);
19742 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19743 LDKThirtyTwoBytes b_ref;
19744 CHECK((*env)->GetArrayLength(env, b) == 32);
19745 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19746 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19747 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
19748 return ((int64_t)ret_conv);
19751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19752 if ((_res & 1) != 0) return;
19753 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19754 CHECK_ACCESS(_res_ptr);
19755 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
19757 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
19760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19761 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19762 CHECK_ACCESS(o_ptr);
19763 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
19764 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
19765 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19766 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
19767 return (int64_t)ret_conv;
19770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19771 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19772 CHECK_ACCESS(e_ptr);
19773 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19774 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19775 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19776 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
19777 return (int64_t)ret_conv;
19780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19781 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
19782 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
19786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19787 if ((_res & 1) != 0) return;
19788 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19789 CHECK_ACCESS(_res_ptr);
19790 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
19792 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
19795 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
19796 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19797 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
19798 return (int64_t)ret_conv;
19800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19801 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
19802 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
19806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19807 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
19808 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19809 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
19810 return (int64_t)ret_conv;
19813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19814 LDKCVec_ThirtyTwoBytesZ _res_constr;
19815 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19816 if (_res_constr.datalen > 0)
19817 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19819 _res_constr.data = NULL;
19820 for (size_t i = 0; i < _res_constr.datalen; i++) {
19821 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19822 LDKThirtyTwoBytes _res_conv_8_ref;
19823 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
19824 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
19825 _res_constr.data[i] = _res_conv_8_ref;
19827 CVec_ThirtyTwoBytesZ_free(_res_constr);
19830 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
19831 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19832 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
19833 return ((int64_t)ret_conv);
19835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19836 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
19837 int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
19841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19842 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
19843 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19844 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
19845 return ((int64_t)ret_conv);
19848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19849 LDKThirtyTwoBytes a_ref;
19850 CHECK((*env)->GetArrayLength(env, a) == 32);
19851 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19852 LDKThirtyTwoBytes b_ref;
19853 CHECK((*env)->GetArrayLength(env, b) == 32);
19854 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19855 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19856 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
19857 return ((int64_t)ret_conv);
19860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19861 if ((_res & 1) != 0) return;
19862 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19863 CHECK_ACCESS(_res_ptr);
19864 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
19866 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
19869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19870 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19871 CHECK_ACCESS(o_ptr);
19872 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19873 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19874 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19875 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
19876 return (int64_t)ret_conv;
19879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
19880 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19881 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
19882 return (int64_t)ret_conv;
19885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19886 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
19887 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
19891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19892 if ((_res & 1) != 0) return;
19893 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19894 CHECK_ACCESS(_res_ptr);
19895 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
19897 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
19900 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
19901 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19902 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
19903 return (int64_t)ret_conv;
19905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19906 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
19907 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
19911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19912 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
19913 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19914 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
19915 return (int64_t)ret_conv;
19918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19919 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19920 CHECK_ACCESS(o_ptr);
19921 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19922 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19923 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19924 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
19925 return (int64_t)ret_conv;
19928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19929 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19930 CHECK_ACCESS(e_ptr);
19931 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19932 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19933 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19934 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
19935 return (int64_t)ret_conv;
19938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19939 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
19940 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
19944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19945 if ((_res & 1) != 0) return;
19946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19947 CHECK_ACCESS(_res_ptr);
19948 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
19950 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
19953 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
19954 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19955 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
19956 return (int64_t)ret_conv;
19958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19959 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
19960 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
19964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19965 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
19966 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19967 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
19968 return (int64_t)ret_conv;
19971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19972 LDKThirtyTwoBytes o_ref;
19973 CHECK((*env)->GetArrayLength(env, o) == 32);
19974 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19975 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19976 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
19977 return (int64_t)ret_conv;
19980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
19981 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19982 *ret_conv = CResult_PaymentSecretNoneZ_err();
19983 return (int64_t)ret_conv;
19986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19987 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
19988 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
19992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19993 if ((_res & 1) != 0) return;
19994 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19995 CHECK_ACCESS(_res_ptr);
19996 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
19998 CResult_PaymentSecretNoneZ_free(_res_conv);
20001 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
20002 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20003 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
20004 return (int64_t)ret_conv;
20006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20007 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
20008 int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
20012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20013 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
20014 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20015 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
20016 return (int64_t)ret_conv;
20019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20020 LDKThirtyTwoBytes o_ref;
20021 CHECK((*env)->GetArrayLength(env, o) == 32);
20022 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20023 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20024 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
20025 return (int64_t)ret_conv;
20028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20029 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20030 CHECK_ACCESS(e_ptr);
20031 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20032 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
20033 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20034 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
20035 return (int64_t)ret_conv;
20038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20039 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
20040 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
20044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20045 if ((_res & 1) != 0) return;
20046 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20047 CHECK_ACCESS(_res_ptr);
20048 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
20050 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
20053 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
20054 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20055 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
20056 return (int64_t)ret_conv;
20058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20059 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
20060 int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
20064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20065 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
20066 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20067 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
20068 return (int64_t)ret_conv;
20071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20072 LDKThirtyTwoBytes o_ref;
20073 CHECK((*env)->GetArrayLength(env, o) == 32);
20074 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20075 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20076 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
20077 return (int64_t)ret_conv;
20080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20081 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20082 CHECK_ACCESS(e_ptr);
20083 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20084 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
20085 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20086 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
20087 return (int64_t)ret_conv;
20090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20091 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
20092 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
20096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20097 if ((_res & 1) != 0) return;
20098 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20099 CHECK_ACCESS(_res_ptr);
20100 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
20102 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
20105 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
20106 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20107 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
20108 return (int64_t)ret_conv;
20110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20111 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
20112 int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
20116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20117 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
20118 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20119 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
20120 return (int64_t)ret_conv;
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20124 LDKCounterpartyForwardingInfo o_conv;
20125 o_conv.inner = (void*)(o & (~1));
20126 o_conv.is_owned = (o & 1) || (o == 0);
20127 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20128 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
20129 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20130 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
20131 return (int64_t)ret_conv;
20134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20135 LDKDecodeError e_conv;
20136 e_conv.inner = (void*)(e & (~1));
20137 e_conv.is_owned = (e & 1) || (e == 0);
20138 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20139 e_conv = DecodeError_clone(&e_conv);
20140 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20141 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
20142 return (int64_t)ret_conv;
20145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20146 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
20147 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
20151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20152 if ((_res & 1) != 0) return;
20153 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20154 CHECK_ACCESS(_res_ptr);
20155 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
20157 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
20160 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
20161 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20162 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
20163 return (int64_t)ret_conv;
20165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20166 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
20167 int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
20171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20172 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
20173 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20174 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
20175 return (int64_t)ret_conv;
20178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20179 LDKChannelCounterparty o_conv;
20180 o_conv.inner = (void*)(o & (~1));
20181 o_conv.is_owned = (o & 1) || (o == 0);
20182 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20183 o_conv = ChannelCounterparty_clone(&o_conv);
20184 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20185 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
20186 return (int64_t)ret_conv;
20189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20190 LDKDecodeError e_conv;
20191 e_conv.inner = (void*)(e & (~1));
20192 e_conv.is_owned = (e & 1) || (e == 0);
20193 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20194 e_conv = DecodeError_clone(&e_conv);
20195 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20196 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
20197 return (int64_t)ret_conv;
20200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20201 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
20202 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
20206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_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_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
20212 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
20215 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
20216 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20217 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
20218 return (int64_t)ret_conv;
20220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20221 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
20222 int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
20226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20227 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
20228 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20229 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
20230 return (int64_t)ret_conv;
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20234 LDKChannelDetails o_conv;
20235 o_conv.inner = (void*)(o & (~1));
20236 o_conv.is_owned = (o & 1) || (o == 0);
20237 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20238 o_conv = ChannelDetails_clone(&o_conv);
20239 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20240 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
20241 return (int64_t)ret_conv;
20244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20245 LDKDecodeError e_conv;
20246 e_conv.inner = (void*)(e & (~1));
20247 e_conv.is_owned = (e & 1) || (e == 0);
20248 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20249 e_conv = DecodeError_clone(&e_conv);
20250 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20251 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
20252 return (int64_t)ret_conv;
20255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20256 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
20257 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
20261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20262 if ((_res & 1) != 0) return;
20263 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20264 CHECK_ACCESS(_res_ptr);
20265 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
20267 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
20270 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
20271 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20272 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
20273 return (int64_t)ret_conv;
20275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20276 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
20277 int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
20281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20282 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
20283 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20284 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
20285 return (int64_t)ret_conv;
20288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20289 LDKPhantomRouteHints o_conv;
20290 o_conv.inner = (void*)(o & (~1));
20291 o_conv.is_owned = (o & 1) || (o == 0);
20292 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20293 o_conv = PhantomRouteHints_clone(&o_conv);
20294 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20295 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
20296 return (int64_t)ret_conv;
20299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20300 LDKDecodeError e_conv;
20301 e_conv.inner = (void*)(e & (~1));
20302 e_conv.is_owned = (e & 1) || (e == 0);
20303 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20304 e_conv = DecodeError_clone(&e_conv);
20305 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20306 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
20307 return (int64_t)ret_conv;
20310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20311 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
20312 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
20316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20317 if ((_res & 1) != 0) return;
20318 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20319 CHECK_ACCESS(_res_ptr);
20320 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
20322 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
20325 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
20326 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20327 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
20328 return (int64_t)ret_conv;
20330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20331 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
20332 int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
20336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20337 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
20338 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20339 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
20340 return (int64_t)ret_conv;
20343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20344 LDKCVec_ChannelMonitorZ _res_constr;
20345 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20346 if (_res_constr.datalen > 0)
20347 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20349 _res_constr.data = NULL;
20350 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20351 for (size_t q = 0; q < _res_constr.datalen; q++) {
20352 int64_t _res_conv_16 = _res_vals[q];
20353 LDKChannelMonitor _res_conv_16_conv;
20354 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
20355 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
20356 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20357 _res_constr.data[q] = _res_conv_16_conv;
20359 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20360 CVec_ChannelMonitorZ_free(_res_constr);
20363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20364 LDKThirtyTwoBytes a_ref;
20365 CHECK((*env)->GetArrayLength(env, a) == 32);
20366 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20367 LDKChannelManager b_conv;
20368 b_conv.inner = (void*)(b & (~1));
20369 b_conv.is_owned = (b & 1) || (b == 0);
20370 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20371 // WARNING: we need a move here but no clone is available for LDKChannelManager
20372 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
20373 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
20374 return ((int64_t)ret_conv);
20377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20378 if ((_res & 1) != 0) return;
20379 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20380 CHECK_ACCESS(_res_ptr);
20381 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
20383 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
20386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20387 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20388 CHECK_ACCESS(o_ptr);
20389 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
20390 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
20391 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20392 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
20393 return (int64_t)ret_conv;
20396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20397 LDKDecodeError e_conv;
20398 e_conv.inner = (void*)(e & (~1));
20399 e_conv.is_owned = (e & 1) || (e == 0);
20400 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20401 e_conv = DecodeError_clone(&e_conv);
20402 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20403 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
20404 return (int64_t)ret_conv;
20407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20408 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
20409 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
20413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20414 if ((_res & 1) != 0) return;
20415 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20416 CHECK_ACCESS(_res_ptr);
20417 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
20419 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
20422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20423 LDKChannelConfig o_conv;
20424 o_conv.inner = (void*)(o & (~1));
20425 o_conv.is_owned = (o & 1) || (o == 0);
20426 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20427 o_conv = ChannelConfig_clone(&o_conv);
20428 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20429 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
20430 return (int64_t)ret_conv;
20433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20434 LDKDecodeError e_conv;
20435 e_conv.inner = (void*)(e & (~1));
20436 e_conv.is_owned = (e & 1) || (e == 0);
20437 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20438 e_conv = DecodeError_clone(&e_conv);
20439 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20440 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
20441 return (int64_t)ret_conv;
20444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20445 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
20446 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
20450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20451 if ((_res & 1) != 0) return;
20452 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20453 CHECK_ACCESS(_res_ptr);
20454 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
20456 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
20459 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
20460 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20461 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
20462 return (int64_t)ret_conv;
20464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20465 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
20466 int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
20470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20471 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
20472 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20473 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
20474 return (int64_t)ret_conv;
20477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20478 LDKOutPoint o_conv;
20479 o_conv.inner = (void*)(o & (~1));
20480 o_conv.is_owned = (o & 1) || (o == 0);
20481 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20482 o_conv = OutPoint_clone(&o_conv);
20483 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20484 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
20485 return (int64_t)ret_conv;
20488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20489 LDKDecodeError e_conv;
20490 e_conv.inner = (void*)(e & (~1));
20491 e_conv.is_owned = (e & 1) || (e == 0);
20492 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20493 e_conv = DecodeError_clone(&e_conv);
20494 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20495 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
20496 return (int64_t)ret_conv;
20499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20500 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
20501 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
20505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20506 if ((_res & 1) != 0) return;
20507 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20508 CHECK_ACCESS(_res_ptr);
20509 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
20511 CResult_OutPointDecodeErrorZ_free(_res_conv);
20514 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
20515 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20516 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
20517 return (int64_t)ret_conv;
20519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20520 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
20521 int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
20525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20526 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
20527 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20528 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
20529 return (int64_t)ret_conv;
20532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20533 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20534 CHECK_ACCESS(o_ptr);
20535 LDKType o_conv = *(LDKType*)(o_ptr);
20536 if (o_conv.free == LDKType_JCalls_free) {
20537 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20538 LDKType_JCalls_cloned(&o_conv);
20540 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20541 *ret_copy = COption_TypeZ_some(o_conv);
20542 int64_t ret_ref = (uintptr_t)ret_copy;
20546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
20547 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20548 *ret_copy = COption_TypeZ_none();
20549 int64_t ret_ref = (uintptr_t)ret_copy;
20553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20554 if ((_res & 1) != 0) return;
20555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20556 CHECK_ACCESS(_res_ptr);
20557 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
20559 COption_TypeZ_free(_res_conv);
20562 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
20563 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20564 *ret_copy = COption_TypeZ_clone(arg);
20565 int64_t ret_ref = (uintptr_t)ret_copy;
20568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20569 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
20570 int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
20574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20575 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
20576 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20577 *ret_copy = COption_TypeZ_clone(orig_conv);
20578 int64_t ret_ref = (uintptr_t)ret_copy;
20582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20583 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20584 CHECK_ACCESS(o_ptr);
20585 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
20586 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
20587 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20588 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
20589 return (int64_t)ret_conv;
20592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20593 LDKDecodeError e_conv;
20594 e_conv.inner = (void*)(e & (~1));
20595 e_conv.is_owned = (e & 1) || (e == 0);
20596 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20597 e_conv = DecodeError_clone(&e_conv);
20598 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20599 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
20600 return (int64_t)ret_conv;
20603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20604 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
20605 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
20609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20610 if ((_res & 1) != 0) return;
20611 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20612 CHECK_ACCESS(_res_ptr);
20613 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
20615 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
20618 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
20619 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20620 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
20621 return (int64_t)ret_conv;
20623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20624 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
20625 int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
20629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20630 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
20631 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20632 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
20633 return (int64_t)ret_conv;
20636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20637 LDKThirtyTwoBytes o_ref;
20638 CHECK((*env)->GetArrayLength(env, o) == 32);
20639 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20640 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20641 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
20642 return (int64_t)ret_conv;
20645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20646 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20647 CHECK_ACCESS(e_ptr);
20648 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
20649 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
20650 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20651 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
20652 return (int64_t)ret_conv;
20655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20656 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
20657 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
20661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20662 if ((_res & 1) != 0) return;
20663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20664 CHECK_ACCESS(_res_ptr);
20665 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
20667 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
20670 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
20671 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20672 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
20673 return (int64_t)ret_conv;
20675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20676 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
20677 int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
20681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20682 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
20683 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20684 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
20685 return (int64_t)ret_conv;
20688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
20689 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
20690 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20691 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
20692 return (int64_t)ret_conv;
20695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20696 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20697 CHECK_ACCESS(e_ptr);
20698 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20699 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20700 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20701 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
20702 return (int64_t)ret_conv;
20705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20706 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
20707 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
20711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20712 if ((_res & 1) != 0) return;
20713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20714 CHECK_ACCESS(_res_ptr);
20715 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
20717 CResult_SiPrefixParseErrorZ_free(_res_conv);
20720 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
20721 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20722 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
20723 return (int64_t)ret_conv;
20725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20726 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
20727 int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
20731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20732 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
20733 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20734 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
20735 return (int64_t)ret_conv;
20738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20740 o_conv.inner = (void*)(o & (~1));
20741 o_conv.is_owned = (o & 1) || (o == 0);
20742 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20743 o_conv = Invoice_clone(&o_conv);
20744 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20745 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
20746 return (int64_t)ret_conv;
20749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20750 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20751 CHECK_ACCESS(e_ptr);
20752 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
20753 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
20754 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20755 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
20756 return (int64_t)ret_conv;
20759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20760 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
20761 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
20765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20766 if ((_res & 1) != 0) return;
20767 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20768 CHECK_ACCESS(_res_ptr);
20769 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
20771 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
20774 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
20775 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20776 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
20777 return (int64_t)ret_conv;
20779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20780 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
20781 int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
20785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20786 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
20787 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20788 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
20789 return (int64_t)ret_conv;
20792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20793 LDKSignedRawInvoice o_conv;
20794 o_conv.inner = (void*)(o & (~1));
20795 o_conv.is_owned = (o & 1) || (o == 0);
20796 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20797 o_conv = SignedRawInvoice_clone(&o_conv);
20798 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20799 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
20800 return (int64_t)ret_conv;
20803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20804 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20805 CHECK_ACCESS(e_ptr);
20806 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20807 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20808 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20809 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
20810 return (int64_t)ret_conv;
20813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20814 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
20815 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
20819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20820 if ((_res & 1) != 0) return;
20821 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20822 CHECK_ACCESS(_res_ptr);
20823 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
20825 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
20828 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
20829 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20830 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
20831 return (int64_t)ret_conv;
20833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20834 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
20835 int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
20839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20840 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
20841 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20842 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
20843 return (int64_t)ret_conv;
20846 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
20847 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20848 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
20849 return ((int64_t)ret_conv);
20851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20852 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
20853 int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
20857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20858 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
20859 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20860 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
20861 return ((int64_t)ret_conv);
20864 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) {
20865 LDKRawInvoice a_conv;
20866 a_conv.inner = (void*)(a & (~1));
20867 a_conv.is_owned = (a & 1) || (a == 0);
20868 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20869 a_conv = RawInvoice_clone(&a_conv);
20870 LDKThirtyTwoBytes b_ref;
20871 CHECK((*env)->GetArrayLength(env, b) == 32);
20872 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20873 LDKInvoiceSignature c_conv;
20874 c_conv.inner = (void*)(c & (~1));
20875 c_conv.is_owned = (c & 1) || (c == 0);
20876 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20877 c_conv = InvoiceSignature_clone(&c_conv);
20878 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20879 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
20880 return ((int64_t)ret_conv);
20883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20884 if ((_res & 1) != 0) return;
20885 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20886 CHECK_ACCESS(_res_ptr);
20887 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
20889 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
20892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20893 LDKPayeePubKey o_conv;
20894 o_conv.inner = (void*)(o & (~1));
20895 o_conv.is_owned = (o & 1) || (o == 0);
20896 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20897 o_conv = PayeePubKey_clone(&o_conv);
20898 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20899 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
20900 return (int64_t)ret_conv;
20903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20904 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20905 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20906 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
20907 return (int64_t)ret_conv;
20910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20911 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
20912 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
20916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20917 if ((_res & 1) != 0) return;
20918 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20919 CHECK_ACCESS(_res_ptr);
20920 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
20922 CResult_PayeePubKeyErrorZ_free(_res_conv);
20925 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
20926 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20927 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
20928 return (int64_t)ret_conv;
20930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20931 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
20932 int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
20936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20937 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
20938 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20939 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
20940 return (int64_t)ret_conv;
20943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20944 LDKCVec_PrivateRouteZ _res_constr;
20945 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20946 if (_res_constr.datalen > 0)
20947 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
20949 _res_constr.data = NULL;
20950 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20951 for (size_t o = 0; o < _res_constr.datalen; o++) {
20952 int64_t _res_conv_14 = _res_vals[o];
20953 LDKPrivateRoute _res_conv_14_conv;
20954 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
20955 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
20956 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
20957 _res_constr.data[o] = _res_conv_14_conv;
20959 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20960 CVec_PrivateRouteZ_free(_res_constr);
20963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20964 LDKPositiveTimestamp o_conv;
20965 o_conv.inner = (void*)(o & (~1));
20966 o_conv.is_owned = (o & 1) || (o == 0);
20967 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20968 o_conv = PositiveTimestamp_clone(&o_conv);
20969 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20970 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
20971 return (int64_t)ret_conv;
20974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20975 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20976 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20977 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
20978 return (int64_t)ret_conv;
20981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20982 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
20983 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
20987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20988 if ((_res & 1) != 0) return;
20989 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20990 CHECK_ACCESS(_res_ptr);
20991 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
20993 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
20996 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
20997 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20998 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
20999 return (int64_t)ret_conv;
21001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21002 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
21003 int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
21007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21008 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
21009 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21010 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
21011 return (int64_t)ret_conv;
21014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
21015 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21016 *ret_conv = CResult_NoneSemanticErrorZ_ok();
21017 return (int64_t)ret_conv;
21020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21021 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21022 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21023 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
21024 return (int64_t)ret_conv;
21027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21028 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
21029 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
21033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21034 if ((_res & 1) != 0) return;
21035 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21036 CHECK_ACCESS(_res_ptr);
21037 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
21039 CResult_NoneSemanticErrorZ_free(_res_conv);
21042 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
21043 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21044 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
21045 return (int64_t)ret_conv;
21047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21048 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
21049 int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
21053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21054 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
21055 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21056 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
21057 return (int64_t)ret_conv;
21060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21062 o_conv.inner = (void*)(o & (~1));
21063 o_conv.is_owned = (o & 1) || (o == 0);
21064 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21065 o_conv = Invoice_clone(&o_conv);
21066 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21067 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
21068 return (int64_t)ret_conv;
21071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21072 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21073 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21074 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
21075 return (int64_t)ret_conv;
21078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21079 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
21080 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
21084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21085 if ((_res & 1) != 0) return;
21086 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21087 CHECK_ACCESS(_res_ptr);
21088 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
21090 CResult_InvoiceSemanticErrorZ_free(_res_conv);
21093 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
21094 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21095 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
21096 return (int64_t)ret_conv;
21098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21099 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
21100 int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
21104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21105 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
21106 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21107 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
21108 return (int64_t)ret_conv;
21111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21112 LDKDescription o_conv;
21113 o_conv.inner = (void*)(o & (~1));
21114 o_conv.is_owned = (o & 1) || (o == 0);
21115 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21116 o_conv = Description_clone(&o_conv);
21117 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21118 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
21119 return (int64_t)ret_conv;
21122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21123 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21124 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21125 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
21126 return (int64_t)ret_conv;
21129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21130 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
21131 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
21135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21136 if ((_res & 1) != 0) return;
21137 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21138 CHECK_ACCESS(_res_ptr);
21139 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
21141 CResult_DescriptionCreationErrorZ_free(_res_conv);
21144 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
21145 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21146 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
21147 return (int64_t)ret_conv;
21149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21150 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
21151 int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
21155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21156 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
21157 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21158 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
21159 return (int64_t)ret_conv;
21162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21163 LDKPrivateRoute o_conv;
21164 o_conv.inner = (void*)(o & (~1));
21165 o_conv.is_owned = (o & 1) || (o == 0);
21166 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21167 o_conv = PrivateRoute_clone(&o_conv);
21168 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21169 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
21170 return (int64_t)ret_conv;
21173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21174 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21175 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21176 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
21177 return (int64_t)ret_conv;
21180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21181 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
21182 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
21186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21187 if ((_res & 1) != 0) return;
21188 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21189 CHECK_ACCESS(_res_ptr);
21190 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
21192 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
21195 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
21196 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21197 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
21198 return (int64_t)ret_conv;
21200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21201 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
21202 int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
21206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21207 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
21208 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21209 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
21210 return (int64_t)ret_conv;
21213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
21214 LDKStr o_conv = java_to_owned_str(env, o);
21215 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21216 *ret_conv = CResult_StringErrorZ_ok(o_conv);
21217 return (int64_t)ret_conv;
21220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21221 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
21222 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21223 *ret_conv = CResult_StringErrorZ_err(e_conv);
21224 return (int64_t)ret_conv;
21227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21228 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
21229 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
21233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21234 if ((_res & 1) != 0) return;
21235 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21236 CHECK_ACCESS(_res_ptr);
21237 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
21239 CResult_StringErrorZ_free(_res_conv);
21242 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
21243 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21244 *ret_conv = CResult_StringErrorZ_clone(arg);
21245 return (int64_t)ret_conv;
21247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21248 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
21249 int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
21253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21254 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
21255 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21256 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
21257 return (int64_t)ret_conv;
21260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21261 LDKChannelMonitorUpdate o_conv;
21262 o_conv.inner = (void*)(o & (~1));
21263 o_conv.is_owned = (o & 1) || (o == 0);
21264 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21265 o_conv = ChannelMonitorUpdate_clone(&o_conv);
21266 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21267 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21268 return (int64_t)ret_conv;
21271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21272 LDKDecodeError e_conv;
21273 e_conv.inner = (void*)(e & (~1));
21274 e_conv.is_owned = (e & 1) || (e == 0);
21275 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21276 e_conv = DecodeError_clone(&e_conv);
21277 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21278 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21279 return (int64_t)ret_conv;
21282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21283 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
21284 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21289 if ((_res & 1) != 0) return;
21290 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21291 CHECK_ACCESS(_res_ptr);
21292 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21294 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21297 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21298 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21299 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21300 return (int64_t)ret_conv;
21302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21303 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
21304 int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21309 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
21310 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21311 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21312 return (int64_t)ret_conv;
21315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21316 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21317 CHECK_ACCESS(o_ptr);
21318 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21319 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
21320 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21321 *ret_copy = COption_MonitorEventZ_some(o_conv);
21322 int64_t ret_ref = (uintptr_t)ret_copy;
21326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
21327 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21328 *ret_copy = COption_MonitorEventZ_none();
21329 int64_t ret_ref = (uintptr_t)ret_copy;
21333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21334 if ((_res & 1) != 0) return;
21335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21336 CHECK_ACCESS(_res_ptr);
21337 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21339 COption_MonitorEventZ_free(_res_conv);
21342 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21343 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21344 *ret_copy = COption_MonitorEventZ_clone(arg);
21345 int64_t ret_ref = (uintptr_t)ret_copy;
21348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21349 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
21350 int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21355 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
21356 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21357 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21358 int64_t ret_ref = (uintptr_t)ret_copy;
21362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21363 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21364 CHECK_ACCESS(o_ptr);
21365 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21366 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
21367 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21368 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21369 return (int64_t)ret_conv;
21372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21373 LDKDecodeError e_conv;
21374 e_conv.inner = (void*)(e & (~1));
21375 e_conv.is_owned = (e & 1) || (e == 0);
21376 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21377 e_conv = DecodeError_clone(&e_conv);
21378 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21379 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21380 return (int64_t)ret_conv;
21383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21384 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
21385 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21390 if ((_res & 1) != 0) return;
21391 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21392 CHECK_ACCESS(_res_ptr);
21393 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21395 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21398 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21399 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21400 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21401 return (int64_t)ret_conv;
21403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21404 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
21405 int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21410 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
21411 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21412 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21413 return (int64_t)ret_conv;
21416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21417 LDKHTLCUpdate o_conv;
21418 o_conv.inner = (void*)(o & (~1));
21419 o_conv.is_owned = (o & 1) || (o == 0);
21420 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21421 o_conv = HTLCUpdate_clone(&o_conv);
21422 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21423 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21424 return (int64_t)ret_conv;
21427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21428 LDKDecodeError e_conv;
21429 e_conv.inner = (void*)(e & (~1));
21430 e_conv.is_owned = (e & 1) || (e == 0);
21431 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21432 e_conv = DecodeError_clone(&e_conv);
21433 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21434 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21435 return (int64_t)ret_conv;
21438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21439 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
21440 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21445 if ((_res & 1) != 0) return;
21446 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21447 CHECK_ACCESS(_res_ptr);
21448 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21450 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21453 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21454 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21455 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21456 return (int64_t)ret_conv;
21458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21459 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
21460 int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21465 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
21466 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21467 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21468 return (int64_t)ret_conv;
21471 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
21472 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21473 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
21474 return ((int64_t)ret_conv);
21476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21477 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
21478 int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
21482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21483 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
21484 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21485 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
21486 return ((int64_t)ret_conv);
21489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21490 LDKOutPoint a_conv;
21491 a_conv.inner = (void*)(a & (~1));
21492 a_conv.is_owned = (a & 1) || (a == 0);
21493 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21494 a_conv = OutPoint_clone(&a_conv);
21496 b_ref.datalen = (*env)->GetArrayLength(env, b);
21497 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21498 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21499 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21500 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
21501 return ((int64_t)ret_conv);
21504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21505 if ((_res & 1) != 0) return;
21506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21507 CHECK_ACCESS(_res_ptr);
21508 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
21510 C2Tuple_OutPointScriptZ_free(_res_conv);
21513 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
21514 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21515 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
21516 return ((int64_t)ret_conv);
21518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21519 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
21520 int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
21524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21525 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
21526 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21527 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
21528 return ((int64_t)ret_conv);
21531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
21533 b_ref.datalen = (*env)->GetArrayLength(env, b);
21534 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21535 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21536 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21537 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
21538 return ((int64_t)ret_conv);
21541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21542 if ((_res & 1) != 0) return;
21543 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21544 CHECK_ACCESS(_res_ptr);
21545 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
21547 C2Tuple_u32ScriptZ_free(_res_conv);
21550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21551 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
21552 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21553 if (_res_constr.datalen > 0)
21554 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21556 _res_constr.data = NULL;
21557 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21558 for (size_t v = 0; v < _res_constr.datalen; v++) {
21559 int64_t _res_conv_21 = _res_vals[v];
21560 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
21561 CHECK_ACCESS(_res_conv_21_ptr);
21562 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
21563 FREE((void*)_res_conv_21);
21564 _res_constr.data[v] = _res_conv_21_conv;
21566 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21567 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
21570 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
21571 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21572 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
21573 return ((int64_t)ret_conv);
21575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21576 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
21577 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
21581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21582 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
21583 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21584 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
21585 return ((int64_t)ret_conv);
21588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21589 LDKThirtyTwoBytes a_ref;
21590 CHECK((*env)->GetArrayLength(env, a) == 32);
21591 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21592 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
21593 b_constr.datalen = (*env)->GetArrayLength(env, b);
21594 if (b_constr.datalen > 0)
21595 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21597 b_constr.data = NULL;
21598 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21599 for (size_t v = 0; v < b_constr.datalen; v++) {
21600 int64_t b_conv_21 = b_vals[v];
21601 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
21602 CHECK_ACCESS(b_conv_21_ptr);
21603 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
21604 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
21605 b_constr.data[v] = b_conv_21_conv;
21607 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21608 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21609 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
21610 return ((int64_t)ret_conv);
21613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21614 if ((_res & 1) != 0) return;
21615 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21616 CHECK_ACCESS(_res_ptr);
21617 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
21619 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
21622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21623 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
21624 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21625 if (_res_constr.datalen > 0)
21626 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
21628 _res_constr.data = NULL;
21629 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21630 for (size_t o = 0; o < _res_constr.datalen; o++) {
21631 int64_t _res_conv_40 = _res_vals[o];
21632 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
21633 CHECK_ACCESS(_res_conv_40_ptr);
21634 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
21635 FREE((void*)_res_conv_40);
21636 _res_constr.data[o] = _res_conv_40_conv;
21638 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21639 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
21642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21643 LDKCVec_EventZ _res_constr;
21644 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21645 if (_res_constr.datalen > 0)
21646 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
21648 _res_constr.data = NULL;
21649 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21650 for (size_t h = 0; h < _res_constr.datalen; h++) {
21651 int64_t _res_conv_7 = _res_vals[h];
21652 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
21653 CHECK_ACCESS(_res_conv_7_ptr);
21654 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
21655 FREE((void*)_res_conv_7);
21656 _res_constr.data[h] = _res_conv_7_conv;
21658 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21659 CVec_EventZ_free(_res_constr);
21662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21663 LDKCVec_TransactionZ _res_constr;
21664 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21665 if (_res_constr.datalen > 0)
21666 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
21668 _res_constr.data = NULL;
21669 for (size_t i = 0; i < _res_constr.datalen; i++) {
21670 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21671 LDKTransaction _res_conv_8_ref;
21672 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
21673 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
21674 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
21675 _res_conv_8_ref.data_is_owned = true;
21676 _res_constr.data[i] = _res_conv_8_ref;
21678 CVec_TransactionZ_free(_res_constr);
21681 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
21682 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21683 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
21684 return ((int64_t)ret_conv);
21686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21687 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
21688 int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
21692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21693 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
21694 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21695 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
21696 return ((int64_t)ret_conv);
21699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
21700 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21701 CHECK_ACCESS(b_ptr);
21702 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
21703 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
21704 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21705 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
21706 return ((int64_t)ret_conv);
21709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21710 if ((_res & 1) != 0) return;
21711 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21712 CHECK_ACCESS(_res_ptr);
21713 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21715 C2Tuple_u32TxOutZ_free(_res_conv);
21718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21719 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21720 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21721 if (_res_constr.datalen > 0)
21722 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21724 _res_constr.data = NULL;
21725 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21726 for (size_t u = 0; u < _res_constr.datalen; u++) {
21727 int64_t _res_conv_20 = _res_vals[u];
21728 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
21729 CHECK_ACCESS(_res_conv_20_ptr);
21730 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21731 FREE((void*)_res_conv_20);
21732 _res_constr.data[u] = _res_conv_20_conv;
21734 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21735 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21738 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21739 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21740 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21741 return ((int64_t)ret_conv);
21743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21744 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
21745 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21750 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
21751 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21752 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21753 return ((int64_t)ret_conv);
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21757 LDKThirtyTwoBytes a_ref;
21758 CHECK((*env)->GetArrayLength(env, a) == 32);
21759 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21760 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21761 b_constr.datalen = (*env)->GetArrayLength(env, b);
21762 if (b_constr.datalen > 0)
21763 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21765 b_constr.data = NULL;
21766 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21767 for (size_t u = 0; u < b_constr.datalen; u++) {
21768 int64_t b_conv_20 = b_vals[u];
21769 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
21770 CHECK_ACCESS(b_conv_20_ptr);
21771 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21772 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
21773 b_constr.data[u] = b_conv_20_conv;
21775 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21776 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21777 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21778 return ((int64_t)ret_conv);
21781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21782 if ((_res & 1) != 0) return;
21783 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21784 CHECK_ACCESS(_res_ptr);
21785 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21787 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21791 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21792 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21793 if (_res_constr.datalen > 0)
21794 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
21796 _res_constr.data = NULL;
21797 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21798 for (size_t n = 0; n < _res_constr.datalen; n++) {
21799 int64_t _res_conv_39 = _res_vals[n];
21800 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
21801 CHECK_ACCESS(_res_conv_39_ptr);
21802 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
21803 FREE((void*)_res_conv_39);
21804 _res_constr.data[n] = _res_conv_39_conv;
21806 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21807 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21811 LDKCVec_BalanceZ _res_constr;
21812 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21813 if (_res_constr.datalen > 0)
21814 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21816 _res_constr.data = NULL;
21817 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21818 for (size_t j = 0; j < _res_constr.datalen; j++) {
21819 int64_t _res_conv_9 = _res_vals[j];
21820 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
21821 CHECK_ACCESS(_res_conv_9_ptr);
21822 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21823 FREE((void*)_res_conv_9);
21824 _res_constr.data[j] = _res_conv_9_conv;
21826 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21827 CVec_BalanceZ_free(_res_constr);
21830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21831 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21832 CHECK_ACCESS(o_ptr);
21833 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
21834 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
21835 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21836 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
21837 return (int64_t)ret_conv;
21840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21841 LDKDecodeError e_conv;
21842 e_conv.inner = (void*)(e & (~1));
21843 e_conv.is_owned = (e & 1) || (e == 0);
21844 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21845 e_conv = DecodeError_clone(&e_conv);
21846 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21847 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
21848 return (int64_t)ret_conv;
21851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21852 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
21853 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21858 if ((_res & 1) != 0) return;
21859 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21860 CHECK_ACCESS(_res_ptr);
21861 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
21863 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
21866 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21867 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21868 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
21869 return (int64_t)ret_conv;
21871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21872 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
21873 int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21878 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
21879 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21880 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
21881 return (int64_t)ret_conv;
21884 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21885 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21886 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21887 return ((int64_t)ret_conv);
21889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21890 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
21891 int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21896 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
21897 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21898 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21899 return ((int64_t)ret_conv);
21902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21903 LDKPublicKey a_ref;
21904 CHECK((*env)->GetArrayLength(env, a) == 33);
21905 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
21906 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21907 CHECK_ACCESS(b_ptr);
21908 LDKType b_conv = *(LDKType*)(b_ptr);
21909 if (b_conv.free == LDKType_JCalls_free) {
21910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21911 LDKType_JCalls_cloned(&b_conv);
21913 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21914 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21915 return ((int64_t)ret_conv);
21918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21919 if ((_res & 1) != 0) return;
21920 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21921 CHECK_ACCESS(_res_ptr);
21922 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21924 C2Tuple_PublicKeyTypeZ_free(_res_conv);
21927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21928 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21929 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21930 if (_res_constr.datalen > 0)
21931 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21933 _res_constr.data = NULL;
21934 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21935 for (size_t z = 0; z < _res_constr.datalen; z++) {
21936 int64_t _res_conv_25 = _res_vals[z];
21937 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
21938 CHECK_ACCESS(_res_conv_25_ptr);
21939 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21940 FREE((void*)_res_conv_25);
21941 _res_constr.data[z] = _res_conv_25_conv;
21943 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21944 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21948 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21949 CHECK_ACCESS(o_ptr);
21950 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21951 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21952 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21953 *ret_copy = COption_NetAddressZ_some(o_conv);
21954 int64_t ret_ref = (uintptr_t)ret_copy;
21958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
21959 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21960 *ret_copy = COption_NetAddressZ_none();
21961 int64_t ret_ref = (uintptr_t)ret_copy;
21965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21966 if ((_res & 1) != 0) return;
21967 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21968 CHECK_ACCESS(_res_ptr);
21969 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
21971 COption_NetAddressZ_free(_res_conv);
21974 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
21975 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21976 *ret_copy = COption_NetAddressZ_clone(arg);
21977 int64_t ret_ref = (uintptr_t)ret_copy;
21980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21981 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
21982 int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
21986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21987 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
21988 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21989 *ret_copy = COption_NetAddressZ_clone(orig_conv);
21990 int64_t ret_ref = (uintptr_t)ret_copy;
21994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21996 o_ref.datalen = (*env)->GetArrayLength(env, o);
21997 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21998 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21999 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22000 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22001 return (int64_t)ret_conv;
22004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22005 LDKPeerHandleError e_conv;
22006 e_conv.inner = (void*)(e & (~1));
22007 e_conv.is_owned = (e & 1) || (e == 0);
22008 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22009 e_conv = PeerHandleError_clone(&e_conv);
22010 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22011 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22012 return (int64_t)ret_conv;
22015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22016 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
22017 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22022 if ((_res & 1) != 0) return;
22023 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22024 CHECK_ACCESS(_res_ptr);
22025 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22027 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22030 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22031 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22032 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22033 return (int64_t)ret_conv;
22035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22036 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
22037 int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22042 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
22043 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22044 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22045 return (int64_t)ret_conv;
22048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
22049 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22050 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22051 return (int64_t)ret_conv;
22054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22055 LDKPeerHandleError 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 = PeerHandleError_clone(&e_conv);
22060 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22061 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22062 return (int64_t)ret_conv;
22065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22066 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
22067 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_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_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22077 CResult_NonePeerHandleErrorZ_free(_res_conv);
22080 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22081 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22082 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22083 return (int64_t)ret_conv;
22085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22086 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
22087 int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22092 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
22093 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22094 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22095 return (int64_t)ret_conv;
22098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
22099 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22100 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22101 return (int64_t)ret_conv;
22104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22105 LDKPeerHandleError e_conv;
22106 e_conv.inner = (void*)(e & (~1));
22107 e_conv.is_owned = (e & 1) || (e == 0);
22108 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22109 e_conv = PeerHandleError_clone(&e_conv);
22110 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22111 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22112 return (int64_t)ret_conv;
22115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22116 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
22117 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22122 if ((_res & 1) != 0) return;
22123 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22124 CHECK_ACCESS(_res_ptr);
22125 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22127 CResult_boolPeerHandleErrorZ_free(_res_conv);
22130 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22131 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22132 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22133 return (int64_t)ret_conv;
22135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22136 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
22137 int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22142 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
22143 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22144 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22145 return (int64_t)ret_conv;
22148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
22149 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22150 *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22151 return (int64_t)ret_conv;
22154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22155 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22156 CHECK_ACCESS(e_ptr);
22157 LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22158 e_conv = GraphSyncError_clone((LDKGraphSyncError*)(((uintptr_t)e) & ~1));
22159 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22160 *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22161 return (int64_t)ret_conv;
22164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22165 LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)(o & ~1);
22166 jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22171 if ((_res & 1) != 0) return;
22172 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22173 CHECK_ACCESS(_res_ptr);
22174 LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22176 CResult_u32GraphSyncErrorZ_free(_res_conv);
22179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22180 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
22181 CHECK_ACCESS(o_ptr);
22182 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
22183 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
22184 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22185 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
22186 return (int64_t)ret_conv;
22189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22190 LDKDecodeError e_conv;
22191 e_conv.inner = (void*)(e & (~1));
22192 e_conv.is_owned = (e & 1) || (e == 0);
22193 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22194 e_conv = DecodeError_clone(&e_conv);
22195 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22196 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
22197 return (int64_t)ret_conv;
22200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22201 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
22202 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
22206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22207 if ((_res & 1) != 0) return;
22208 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22209 CHECK_ACCESS(_res_ptr);
22210 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
22212 CResult_NetAddressDecodeErrorZ_free(_res_conv);
22215 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
22216 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22217 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
22218 return (int64_t)ret_conv;
22220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22221 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
22222 int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
22226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22227 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
22228 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22229 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
22230 return (int64_t)ret_conv;
22233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22234 LDKCVec_UpdateAddHTLCZ _res_constr;
22235 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22236 if (_res_constr.datalen > 0)
22237 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22239 _res_constr.data = NULL;
22240 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22241 for (size_t p = 0; p < _res_constr.datalen; p++) {
22242 int64_t _res_conv_15 = _res_vals[p];
22243 LDKUpdateAddHTLC _res_conv_15_conv;
22244 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
22245 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
22246 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
22247 _res_constr.data[p] = _res_conv_15_conv;
22249 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22250 CVec_UpdateAddHTLCZ_free(_res_constr);
22253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22254 LDKCVec_UpdateFulfillHTLCZ _res_constr;
22255 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22256 if (_res_constr.datalen > 0)
22257 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22259 _res_constr.data = NULL;
22260 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22261 for (size_t t = 0; t < _res_constr.datalen; t++) {
22262 int64_t _res_conv_19 = _res_vals[t];
22263 LDKUpdateFulfillHTLC _res_conv_19_conv;
22264 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22265 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22266 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22267 _res_constr.data[t] = _res_conv_19_conv;
22269 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22270 CVec_UpdateFulfillHTLCZ_free(_res_constr);
22273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22274 LDKCVec_UpdateFailHTLCZ _res_constr;
22275 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22276 if (_res_constr.datalen > 0)
22277 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22279 _res_constr.data = NULL;
22280 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22281 for (size_t q = 0; q < _res_constr.datalen; q++) {
22282 int64_t _res_conv_16 = _res_vals[q];
22283 LDKUpdateFailHTLC _res_conv_16_conv;
22284 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
22285 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
22286 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22287 _res_constr.data[q] = _res_conv_16_conv;
22289 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22290 CVec_UpdateFailHTLCZ_free(_res_constr);
22293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22294 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
22295 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22296 if (_res_constr.datalen > 0)
22297 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22299 _res_constr.data = NULL;
22300 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22301 for (size_t z = 0; z < _res_constr.datalen; z++) {
22302 int64_t _res_conv_25 = _res_vals[z];
22303 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
22304 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
22305 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
22306 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
22307 _res_constr.data[z] = _res_conv_25_conv;
22309 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22310 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
22313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22314 LDKAcceptChannel o_conv;
22315 o_conv.inner = (void*)(o & (~1));
22316 o_conv.is_owned = (o & 1) || (o == 0);
22317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22318 o_conv = AcceptChannel_clone(&o_conv);
22319 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22320 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
22321 return (int64_t)ret_conv;
22324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22325 LDKDecodeError e_conv;
22326 e_conv.inner = (void*)(e & (~1));
22327 e_conv.is_owned = (e & 1) || (e == 0);
22328 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22329 e_conv = DecodeError_clone(&e_conv);
22330 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22331 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
22332 return (int64_t)ret_conv;
22335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22336 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
22337 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
22341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22342 if ((_res & 1) != 0) return;
22343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22344 CHECK_ACCESS(_res_ptr);
22345 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
22347 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
22350 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
22351 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22352 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
22353 return (int64_t)ret_conv;
22355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22356 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
22357 int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
22361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22362 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
22363 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22364 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
22365 return (int64_t)ret_conv;
22368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22369 LDKAnnouncementSignatures o_conv;
22370 o_conv.inner = (void*)(o & (~1));
22371 o_conv.is_owned = (o & 1) || (o == 0);
22372 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22373 o_conv = AnnouncementSignatures_clone(&o_conv);
22374 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22375 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
22376 return (int64_t)ret_conv;
22379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22380 LDKDecodeError e_conv;
22381 e_conv.inner = (void*)(e & (~1));
22382 e_conv.is_owned = (e & 1) || (e == 0);
22383 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22384 e_conv = DecodeError_clone(&e_conv);
22385 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22386 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
22387 return (int64_t)ret_conv;
22390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22391 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
22392 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
22396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22397 if ((_res & 1) != 0) return;
22398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22399 CHECK_ACCESS(_res_ptr);
22400 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
22402 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
22405 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
22406 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22407 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
22408 return (int64_t)ret_conv;
22410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22411 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
22412 int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
22416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22417 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
22418 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22419 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
22420 return (int64_t)ret_conv;
22423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22424 LDKChannelReestablish o_conv;
22425 o_conv.inner = (void*)(o & (~1));
22426 o_conv.is_owned = (o & 1) || (o == 0);
22427 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22428 o_conv = ChannelReestablish_clone(&o_conv);
22429 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22430 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
22431 return (int64_t)ret_conv;
22434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22435 LDKDecodeError e_conv;
22436 e_conv.inner = (void*)(e & (~1));
22437 e_conv.is_owned = (e & 1) || (e == 0);
22438 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22439 e_conv = DecodeError_clone(&e_conv);
22440 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22441 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
22442 return (int64_t)ret_conv;
22445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22446 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
22447 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
22451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22452 if ((_res & 1) != 0) return;
22453 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22454 CHECK_ACCESS(_res_ptr);
22455 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
22457 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
22460 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
22461 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22462 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
22463 return (int64_t)ret_conv;
22465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22466 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
22467 int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
22471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22472 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
22473 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22474 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
22475 return (int64_t)ret_conv;
22478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22479 LDKClosingSigned o_conv;
22480 o_conv.inner = (void*)(o & (~1));
22481 o_conv.is_owned = (o & 1) || (o == 0);
22482 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22483 o_conv = ClosingSigned_clone(&o_conv);
22484 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22485 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
22486 return (int64_t)ret_conv;
22489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22490 LDKDecodeError e_conv;
22491 e_conv.inner = (void*)(e & (~1));
22492 e_conv.is_owned = (e & 1) || (e == 0);
22493 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22494 e_conv = DecodeError_clone(&e_conv);
22495 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22496 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
22497 return (int64_t)ret_conv;
22500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22501 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
22502 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
22506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22507 if ((_res & 1) != 0) return;
22508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22509 CHECK_ACCESS(_res_ptr);
22510 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
22512 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
22515 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
22516 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22517 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
22518 return (int64_t)ret_conv;
22520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22521 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
22522 int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22527 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
22528 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22529 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
22530 return (int64_t)ret_conv;
22533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22534 LDKClosingSignedFeeRange o_conv;
22535 o_conv.inner = (void*)(o & (~1));
22536 o_conv.is_owned = (o & 1) || (o == 0);
22537 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22538 o_conv = ClosingSignedFeeRange_clone(&o_conv);
22539 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22540 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
22541 return (int64_t)ret_conv;
22544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22545 LDKDecodeError e_conv;
22546 e_conv.inner = (void*)(e & (~1));
22547 e_conv.is_owned = (e & 1) || (e == 0);
22548 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22549 e_conv = DecodeError_clone(&e_conv);
22550 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22551 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
22552 return (int64_t)ret_conv;
22555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22556 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
22557 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
22561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22562 if ((_res & 1) != 0) return;
22563 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22564 CHECK_ACCESS(_res_ptr);
22565 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
22567 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
22570 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
22571 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22572 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
22573 return (int64_t)ret_conv;
22575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22576 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
22577 int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
22581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22582 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
22583 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22584 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
22585 return (int64_t)ret_conv;
22588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22589 LDKCommitmentSigned o_conv;
22590 o_conv.inner = (void*)(o & (~1));
22591 o_conv.is_owned = (o & 1) || (o == 0);
22592 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22593 o_conv = CommitmentSigned_clone(&o_conv);
22594 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22595 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
22596 return (int64_t)ret_conv;
22599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22600 LDKDecodeError e_conv;
22601 e_conv.inner = (void*)(e & (~1));
22602 e_conv.is_owned = (e & 1) || (e == 0);
22603 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22604 e_conv = DecodeError_clone(&e_conv);
22605 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22606 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
22607 return (int64_t)ret_conv;
22610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22611 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
22612 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
22616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22617 if ((_res & 1) != 0) return;
22618 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22619 CHECK_ACCESS(_res_ptr);
22620 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
22622 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
22625 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
22626 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22627 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
22628 return (int64_t)ret_conv;
22630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22631 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
22632 int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
22636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22637 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
22638 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22639 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
22640 return (int64_t)ret_conv;
22643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22644 LDKFundingCreated o_conv;
22645 o_conv.inner = (void*)(o & (~1));
22646 o_conv.is_owned = (o & 1) || (o == 0);
22647 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22648 o_conv = FundingCreated_clone(&o_conv);
22649 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22650 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
22651 return (int64_t)ret_conv;
22654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22655 LDKDecodeError e_conv;
22656 e_conv.inner = (void*)(e & (~1));
22657 e_conv.is_owned = (e & 1) || (e == 0);
22658 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22659 e_conv = DecodeError_clone(&e_conv);
22660 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22661 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
22662 return (int64_t)ret_conv;
22665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22666 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
22667 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
22671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22672 if ((_res & 1) != 0) return;
22673 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22674 CHECK_ACCESS(_res_ptr);
22675 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
22677 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
22680 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
22681 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22682 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
22683 return (int64_t)ret_conv;
22685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22686 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
22687 int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
22691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22692 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
22693 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22694 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
22695 return (int64_t)ret_conv;
22698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22699 LDKFundingSigned o_conv;
22700 o_conv.inner = (void*)(o & (~1));
22701 o_conv.is_owned = (o & 1) || (o == 0);
22702 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22703 o_conv = FundingSigned_clone(&o_conv);
22704 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22705 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
22706 return (int64_t)ret_conv;
22709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22710 LDKDecodeError e_conv;
22711 e_conv.inner = (void*)(e & (~1));
22712 e_conv.is_owned = (e & 1) || (e == 0);
22713 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22714 e_conv = DecodeError_clone(&e_conv);
22715 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22716 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
22717 return (int64_t)ret_conv;
22720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22721 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
22722 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
22726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22727 if ((_res & 1) != 0) return;
22728 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22729 CHECK_ACCESS(_res_ptr);
22730 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
22732 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
22735 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
22736 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22737 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
22738 return (int64_t)ret_conv;
22740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22741 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
22742 int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
22746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22747 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
22748 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22749 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
22750 return (int64_t)ret_conv;
22753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22754 LDKChannelReady o_conv;
22755 o_conv.inner = (void*)(o & (~1));
22756 o_conv.is_owned = (o & 1) || (o == 0);
22757 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22758 o_conv = ChannelReady_clone(&o_conv);
22759 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22760 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
22761 return (int64_t)ret_conv;
22764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22765 LDKDecodeError e_conv;
22766 e_conv.inner = (void*)(e & (~1));
22767 e_conv.is_owned = (e & 1) || (e == 0);
22768 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22769 e_conv = DecodeError_clone(&e_conv);
22770 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22771 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
22772 return (int64_t)ret_conv;
22775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22776 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
22777 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
22781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22782 if ((_res & 1) != 0) return;
22783 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22784 CHECK_ACCESS(_res_ptr);
22785 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
22787 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
22790 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
22791 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22792 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
22793 return (int64_t)ret_conv;
22795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22796 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
22797 int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
22801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22802 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
22803 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22804 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
22805 return (int64_t)ret_conv;
22808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22810 o_conv.inner = (void*)(o & (~1));
22811 o_conv.is_owned = (o & 1) || (o == 0);
22812 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22813 o_conv = Init_clone(&o_conv);
22814 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22815 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
22816 return (int64_t)ret_conv;
22819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22820 LDKDecodeError e_conv;
22821 e_conv.inner = (void*)(e & (~1));
22822 e_conv.is_owned = (e & 1) || (e == 0);
22823 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22824 e_conv = DecodeError_clone(&e_conv);
22825 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22826 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
22827 return (int64_t)ret_conv;
22830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22831 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
22832 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
22836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22837 if ((_res & 1) != 0) return;
22838 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22839 CHECK_ACCESS(_res_ptr);
22840 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
22842 CResult_InitDecodeErrorZ_free(_res_conv);
22845 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
22846 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22847 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
22848 return (int64_t)ret_conv;
22850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22851 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
22852 int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
22856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22857 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
22858 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22859 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
22860 return (int64_t)ret_conv;
22863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22864 LDKOpenChannel o_conv;
22865 o_conv.inner = (void*)(o & (~1));
22866 o_conv.is_owned = (o & 1) || (o == 0);
22867 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22868 o_conv = OpenChannel_clone(&o_conv);
22869 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22870 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
22871 return (int64_t)ret_conv;
22874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22875 LDKDecodeError e_conv;
22876 e_conv.inner = (void*)(e & (~1));
22877 e_conv.is_owned = (e & 1) || (e == 0);
22878 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22879 e_conv = DecodeError_clone(&e_conv);
22880 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22881 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
22882 return (int64_t)ret_conv;
22885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22886 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
22887 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
22891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22892 if ((_res & 1) != 0) return;
22893 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22894 CHECK_ACCESS(_res_ptr);
22895 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
22897 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
22900 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
22901 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22902 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
22903 return (int64_t)ret_conv;
22905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22906 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
22907 int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
22911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22912 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
22913 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22914 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
22915 return (int64_t)ret_conv;
22918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22919 LDKRevokeAndACK o_conv;
22920 o_conv.inner = (void*)(o & (~1));
22921 o_conv.is_owned = (o & 1) || (o == 0);
22922 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22923 o_conv = RevokeAndACK_clone(&o_conv);
22924 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22925 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
22926 return (int64_t)ret_conv;
22929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22930 LDKDecodeError e_conv;
22931 e_conv.inner = (void*)(e & (~1));
22932 e_conv.is_owned = (e & 1) || (e == 0);
22933 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22934 e_conv = DecodeError_clone(&e_conv);
22935 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22936 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
22937 return (int64_t)ret_conv;
22940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22941 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
22942 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
22946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22947 if ((_res & 1) != 0) return;
22948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22949 CHECK_ACCESS(_res_ptr);
22950 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
22952 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
22955 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
22956 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22957 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
22958 return (int64_t)ret_conv;
22960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22961 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
22962 int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
22966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22967 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
22968 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22969 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
22970 return (int64_t)ret_conv;
22973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22974 LDKShutdown o_conv;
22975 o_conv.inner = (void*)(o & (~1));
22976 o_conv.is_owned = (o & 1) || (o == 0);
22977 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22978 o_conv = Shutdown_clone(&o_conv);
22979 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22980 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
22981 return (int64_t)ret_conv;
22984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22985 LDKDecodeError e_conv;
22986 e_conv.inner = (void*)(e & (~1));
22987 e_conv.is_owned = (e & 1) || (e == 0);
22988 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22989 e_conv = DecodeError_clone(&e_conv);
22990 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22991 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
22992 return (int64_t)ret_conv;
22995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22996 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
22997 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
23001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23002 if ((_res & 1) != 0) return;
23003 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23004 CHECK_ACCESS(_res_ptr);
23005 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
23007 CResult_ShutdownDecodeErrorZ_free(_res_conv);
23010 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
23011 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23012 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
23013 return (int64_t)ret_conv;
23015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23016 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
23017 int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
23021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23022 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
23023 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23024 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
23025 return (int64_t)ret_conv;
23028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23029 LDKUpdateFailHTLC o_conv;
23030 o_conv.inner = (void*)(o & (~1));
23031 o_conv.is_owned = (o & 1) || (o == 0);
23032 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23033 o_conv = UpdateFailHTLC_clone(&o_conv);
23034 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23035 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
23036 return (int64_t)ret_conv;
23039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23040 LDKDecodeError e_conv;
23041 e_conv.inner = (void*)(e & (~1));
23042 e_conv.is_owned = (e & 1) || (e == 0);
23043 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23044 e_conv = DecodeError_clone(&e_conv);
23045 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23046 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
23047 return (int64_t)ret_conv;
23050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23051 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
23052 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
23056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23057 if ((_res & 1) != 0) return;
23058 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23059 CHECK_ACCESS(_res_ptr);
23060 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
23062 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
23065 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
23066 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23067 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
23068 return (int64_t)ret_conv;
23070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23071 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
23072 int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
23076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23077 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
23078 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23079 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
23080 return (int64_t)ret_conv;
23083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23084 LDKUpdateFailMalformedHTLC o_conv;
23085 o_conv.inner = (void*)(o & (~1));
23086 o_conv.is_owned = (o & 1) || (o == 0);
23087 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23088 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
23089 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23090 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
23091 return (int64_t)ret_conv;
23094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23095 LDKDecodeError e_conv;
23096 e_conv.inner = (void*)(e & (~1));
23097 e_conv.is_owned = (e & 1) || (e == 0);
23098 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23099 e_conv = DecodeError_clone(&e_conv);
23100 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23101 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
23102 return (int64_t)ret_conv;
23105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23106 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
23107 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
23111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23112 if ((_res & 1) != 0) return;
23113 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23114 CHECK_ACCESS(_res_ptr);
23115 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
23117 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
23120 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
23121 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23122 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
23123 return (int64_t)ret_conv;
23125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23126 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
23127 int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
23131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23132 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
23133 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23134 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
23135 return (int64_t)ret_conv;
23138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23139 LDKUpdateFee o_conv;
23140 o_conv.inner = (void*)(o & (~1));
23141 o_conv.is_owned = (o & 1) || (o == 0);
23142 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23143 o_conv = UpdateFee_clone(&o_conv);
23144 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23145 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
23146 return (int64_t)ret_conv;
23149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23150 LDKDecodeError e_conv;
23151 e_conv.inner = (void*)(e & (~1));
23152 e_conv.is_owned = (e & 1) || (e == 0);
23153 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23154 e_conv = DecodeError_clone(&e_conv);
23155 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23156 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
23157 return (int64_t)ret_conv;
23160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23161 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
23162 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
23166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23167 if ((_res & 1) != 0) return;
23168 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23169 CHECK_ACCESS(_res_ptr);
23170 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
23172 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
23175 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
23176 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23177 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
23178 return (int64_t)ret_conv;
23180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23181 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
23182 int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
23186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23187 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
23188 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23189 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
23190 return (int64_t)ret_conv;
23193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23194 LDKUpdateFulfillHTLC o_conv;
23195 o_conv.inner = (void*)(o & (~1));
23196 o_conv.is_owned = (o & 1) || (o == 0);
23197 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23198 o_conv = UpdateFulfillHTLC_clone(&o_conv);
23199 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23200 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
23201 return (int64_t)ret_conv;
23204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23205 LDKDecodeError e_conv;
23206 e_conv.inner = (void*)(e & (~1));
23207 e_conv.is_owned = (e & 1) || (e == 0);
23208 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23209 e_conv = DecodeError_clone(&e_conv);
23210 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23211 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
23212 return (int64_t)ret_conv;
23215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23216 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
23217 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
23221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23222 if ((_res & 1) != 0) return;
23223 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23224 CHECK_ACCESS(_res_ptr);
23225 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
23227 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
23230 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
23231 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23232 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
23233 return (int64_t)ret_conv;
23235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23236 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
23237 int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
23241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23242 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
23243 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23244 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
23245 return (int64_t)ret_conv;
23248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23249 LDKUpdateAddHTLC o_conv;
23250 o_conv.inner = (void*)(o & (~1));
23251 o_conv.is_owned = (o & 1) || (o == 0);
23252 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23253 o_conv = UpdateAddHTLC_clone(&o_conv);
23254 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23255 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
23256 return (int64_t)ret_conv;
23259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23260 LDKDecodeError e_conv;
23261 e_conv.inner = (void*)(e & (~1));
23262 e_conv.is_owned = (e & 1) || (e == 0);
23263 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23264 e_conv = DecodeError_clone(&e_conv);
23265 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23266 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
23267 return (int64_t)ret_conv;
23270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23271 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
23272 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
23276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23277 if ((_res & 1) != 0) return;
23278 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23279 CHECK_ACCESS(_res_ptr);
23280 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
23282 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
23285 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
23286 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23287 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
23288 return (int64_t)ret_conv;
23290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23291 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
23292 int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
23296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23297 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
23298 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23299 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
23300 return (int64_t)ret_conv;
23303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23305 o_conv.inner = (void*)(o & (~1));
23306 o_conv.is_owned = (o & 1) || (o == 0);
23307 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23308 o_conv = Ping_clone(&o_conv);
23309 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23310 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
23311 return (int64_t)ret_conv;
23314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23315 LDKDecodeError e_conv;
23316 e_conv.inner = (void*)(e & (~1));
23317 e_conv.is_owned = (e & 1) || (e == 0);
23318 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23319 e_conv = DecodeError_clone(&e_conv);
23320 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23321 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
23322 return (int64_t)ret_conv;
23325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23326 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
23327 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
23331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23332 if ((_res & 1) != 0) return;
23333 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23334 CHECK_ACCESS(_res_ptr);
23335 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
23337 CResult_PingDecodeErrorZ_free(_res_conv);
23340 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
23341 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23342 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
23343 return (int64_t)ret_conv;
23345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23346 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
23347 int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
23351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23352 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
23353 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23354 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
23355 return (int64_t)ret_conv;
23358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23360 o_conv.inner = (void*)(o & (~1));
23361 o_conv.is_owned = (o & 1) || (o == 0);
23362 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23363 o_conv = Pong_clone(&o_conv);
23364 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23365 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
23366 return (int64_t)ret_conv;
23369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23370 LDKDecodeError e_conv;
23371 e_conv.inner = (void*)(e & (~1));
23372 e_conv.is_owned = (e & 1) || (e == 0);
23373 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23374 e_conv = DecodeError_clone(&e_conv);
23375 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23376 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
23377 return (int64_t)ret_conv;
23380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23381 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
23382 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
23386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23387 if ((_res & 1) != 0) return;
23388 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23389 CHECK_ACCESS(_res_ptr);
23390 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
23392 CResult_PongDecodeErrorZ_free(_res_conv);
23395 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
23396 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23397 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
23398 return (int64_t)ret_conv;
23400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23401 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
23402 int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
23406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23407 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
23408 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23409 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
23410 return (int64_t)ret_conv;
23413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23414 LDKUnsignedChannelAnnouncement o_conv;
23415 o_conv.inner = (void*)(o & (~1));
23416 o_conv.is_owned = (o & 1) || (o == 0);
23417 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23418 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
23419 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23420 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
23421 return (int64_t)ret_conv;
23424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23425 LDKDecodeError e_conv;
23426 e_conv.inner = (void*)(e & (~1));
23427 e_conv.is_owned = (e & 1) || (e == 0);
23428 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23429 e_conv = DecodeError_clone(&e_conv);
23430 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23431 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
23432 return (int64_t)ret_conv;
23435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23436 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
23437 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23442 if ((_res & 1) != 0) return;
23443 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23444 CHECK_ACCESS(_res_ptr);
23445 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23447 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
23450 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23451 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23452 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
23453 return (int64_t)ret_conv;
23455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23456 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23457 int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23462 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23463 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23464 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23465 return (int64_t)ret_conv;
23468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23469 LDKChannelAnnouncement o_conv;
23470 o_conv.inner = (void*)(o & (~1));
23471 o_conv.is_owned = (o & 1) || (o == 0);
23472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23473 o_conv = ChannelAnnouncement_clone(&o_conv);
23474 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23475 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
23476 return (int64_t)ret_conv;
23479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23480 LDKDecodeError e_conv;
23481 e_conv.inner = (void*)(e & (~1));
23482 e_conv.is_owned = (e & 1) || (e == 0);
23483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23484 e_conv = DecodeError_clone(&e_conv);
23485 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23486 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
23487 return (int64_t)ret_conv;
23490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23491 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
23492 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23497 if ((_res & 1) != 0) return;
23498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23499 CHECK_ACCESS(_res_ptr);
23500 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23502 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
23505 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23506 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23507 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
23508 return (int64_t)ret_conv;
23510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23511 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23512 int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23517 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23518 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23519 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23520 return (int64_t)ret_conv;
23523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23524 LDKUnsignedChannelUpdate o_conv;
23525 o_conv.inner = (void*)(o & (~1));
23526 o_conv.is_owned = (o & 1) || (o == 0);
23527 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23528 o_conv = UnsignedChannelUpdate_clone(&o_conv);
23529 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23530 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
23531 return (int64_t)ret_conv;
23534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23535 LDKDecodeError e_conv;
23536 e_conv.inner = (void*)(e & (~1));
23537 e_conv.is_owned = (e & 1) || (e == 0);
23538 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23539 e_conv = DecodeError_clone(&e_conv);
23540 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23541 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
23542 return (int64_t)ret_conv;
23545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23546 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
23547 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
23551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23552 if ((_res & 1) != 0) return;
23553 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23554 CHECK_ACCESS(_res_ptr);
23555 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
23557 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
23560 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23561 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23562 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
23563 return (int64_t)ret_conv;
23565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23566 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
23567 int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23572 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
23573 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23574 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
23575 return (int64_t)ret_conv;
23578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23579 LDKChannelUpdate o_conv;
23580 o_conv.inner = (void*)(o & (~1));
23581 o_conv.is_owned = (o & 1) || (o == 0);
23582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23583 o_conv = ChannelUpdate_clone(&o_conv);
23584 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23585 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
23586 return (int64_t)ret_conv;
23589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23590 LDKDecodeError e_conv;
23591 e_conv.inner = (void*)(e & (~1));
23592 e_conv.is_owned = (e & 1) || (e == 0);
23593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23594 e_conv = DecodeError_clone(&e_conv);
23595 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23596 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
23597 return (int64_t)ret_conv;
23600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23601 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
23602 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
23606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23607 if ((_res & 1) != 0) return;
23608 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23609 CHECK_ACCESS(_res_ptr);
23610 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
23612 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
23615 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23616 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23617 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
23618 return (int64_t)ret_conv;
23620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23621 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
23622 int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23627 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
23628 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23629 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
23630 return (int64_t)ret_conv;
23633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23634 LDKErrorMessage o_conv;
23635 o_conv.inner = (void*)(o & (~1));
23636 o_conv.is_owned = (o & 1) || (o == 0);
23637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23638 o_conv = ErrorMessage_clone(&o_conv);
23639 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23640 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
23641 return (int64_t)ret_conv;
23644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23645 LDKDecodeError e_conv;
23646 e_conv.inner = (void*)(e & (~1));
23647 e_conv.is_owned = (e & 1) || (e == 0);
23648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23649 e_conv = DecodeError_clone(&e_conv);
23650 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23651 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
23652 return (int64_t)ret_conv;
23655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23656 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
23657 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
23661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23662 if ((_res & 1) != 0) return;
23663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23664 CHECK_ACCESS(_res_ptr);
23665 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
23667 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
23670 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
23671 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23672 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
23673 return (int64_t)ret_conv;
23675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23676 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
23677 int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
23681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23682 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
23683 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23684 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
23685 return (int64_t)ret_conv;
23688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23689 LDKWarningMessage o_conv;
23690 o_conv.inner = (void*)(o & (~1));
23691 o_conv.is_owned = (o & 1) || (o == 0);
23692 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23693 o_conv = WarningMessage_clone(&o_conv);
23694 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23695 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
23696 return (int64_t)ret_conv;
23699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23700 LDKDecodeError e_conv;
23701 e_conv.inner = (void*)(e & (~1));
23702 e_conv.is_owned = (e & 1) || (e == 0);
23703 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23704 e_conv = DecodeError_clone(&e_conv);
23705 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23706 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
23707 return (int64_t)ret_conv;
23710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23711 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
23712 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
23716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23717 if ((_res & 1) != 0) return;
23718 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23719 CHECK_ACCESS(_res_ptr);
23720 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
23722 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
23725 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
23726 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23727 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
23728 return (int64_t)ret_conv;
23730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23731 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
23732 int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
23736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23737 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
23738 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23739 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
23740 return (int64_t)ret_conv;
23743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23744 LDKUnsignedNodeAnnouncement o_conv;
23745 o_conv.inner = (void*)(o & (~1));
23746 o_conv.is_owned = (o & 1) || (o == 0);
23747 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23748 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
23749 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23750 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
23751 return (int64_t)ret_conv;
23754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23755 LDKDecodeError e_conv;
23756 e_conv.inner = (void*)(e & (~1));
23757 e_conv.is_owned = (e & 1) || (e == 0);
23758 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23759 e_conv = DecodeError_clone(&e_conv);
23760 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23761 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
23762 return (int64_t)ret_conv;
23765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23766 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
23767 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23772 if ((_res & 1) != 0) return;
23773 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23774 CHECK_ACCESS(_res_ptr);
23775 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
23777 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
23780 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23781 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23782 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
23783 return (int64_t)ret_conv;
23785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23786 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
23787 int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23792 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
23793 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23794 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
23795 return (int64_t)ret_conv;
23798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23799 LDKNodeAnnouncement o_conv;
23800 o_conv.inner = (void*)(o & (~1));
23801 o_conv.is_owned = (o & 1) || (o == 0);
23802 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23803 o_conv = NodeAnnouncement_clone(&o_conv);
23804 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23805 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
23806 return (int64_t)ret_conv;
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23810 LDKDecodeError e_conv;
23811 e_conv.inner = (void*)(e & (~1));
23812 e_conv.is_owned = (e & 1) || (e == 0);
23813 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23814 e_conv = DecodeError_clone(&e_conv);
23815 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23816 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
23817 return (int64_t)ret_conv;
23820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23821 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
23822 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23827 if ((_res & 1) != 0) return;
23828 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23829 CHECK_ACCESS(_res_ptr);
23830 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
23832 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
23835 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23836 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23837 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
23838 return (int64_t)ret_conv;
23840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23841 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
23842 int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23847 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
23848 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23849 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
23850 return (int64_t)ret_conv;
23853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23854 LDKQueryShortChannelIds o_conv;
23855 o_conv.inner = (void*)(o & (~1));
23856 o_conv.is_owned = (o & 1) || (o == 0);
23857 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23858 o_conv = QueryShortChannelIds_clone(&o_conv);
23859 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23860 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
23861 return (int64_t)ret_conv;
23864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23865 LDKDecodeError e_conv;
23866 e_conv.inner = (void*)(e & (~1));
23867 e_conv.is_owned = (e & 1) || (e == 0);
23868 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23869 e_conv = DecodeError_clone(&e_conv);
23870 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23871 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
23872 return (int64_t)ret_conv;
23875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23876 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
23877 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
23881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23882 if ((_res & 1) != 0) return;
23883 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23884 CHECK_ACCESS(_res_ptr);
23885 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
23887 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
23890 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
23891 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23892 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
23893 return (int64_t)ret_conv;
23895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23896 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
23897 int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
23901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23902 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
23903 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23904 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
23905 return (int64_t)ret_conv;
23908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23909 LDKReplyShortChannelIdsEnd o_conv;
23910 o_conv.inner = (void*)(o & (~1));
23911 o_conv.is_owned = (o & 1) || (o == 0);
23912 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23913 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
23914 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23915 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
23916 return (int64_t)ret_conv;
23919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23920 LDKDecodeError e_conv;
23921 e_conv.inner = (void*)(e & (~1));
23922 e_conv.is_owned = (e & 1) || (e == 0);
23923 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23924 e_conv = DecodeError_clone(&e_conv);
23925 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23926 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
23927 return (int64_t)ret_conv;
23930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23931 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
23932 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
23936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23937 if ((_res & 1) != 0) return;
23938 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23939 CHECK_ACCESS(_res_ptr);
23940 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
23942 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
23945 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
23946 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23947 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
23948 return (int64_t)ret_conv;
23950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23951 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
23952 int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
23956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23957 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
23958 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23959 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
23960 return (int64_t)ret_conv;
23963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23964 LDKQueryChannelRange o_conv;
23965 o_conv.inner = (void*)(o & (~1));
23966 o_conv.is_owned = (o & 1) || (o == 0);
23967 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23968 o_conv = QueryChannelRange_clone(&o_conv);
23969 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23970 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
23971 return (int64_t)ret_conv;
23974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23975 LDKDecodeError e_conv;
23976 e_conv.inner = (void*)(e & (~1));
23977 e_conv.is_owned = (e & 1) || (e == 0);
23978 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23979 e_conv = DecodeError_clone(&e_conv);
23980 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23981 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
23982 return (int64_t)ret_conv;
23985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23986 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
23987 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
23991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23992 if ((_res & 1) != 0) return;
23993 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23994 CHECK_ACCESS(_res_ptr);
23995 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
23997 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
24000 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
24001 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24002 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
24003 return (int64_t)ret_conv;
24005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24006 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
24007 int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24012 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
24013 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24014 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
24015 return (int64_t)ret_conv;
24018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24019 LDKReplyChannelRange o_conv;
24020 o_conv.inner = (void*)(o & (~1));
24021 o_conv.is_owned = (o & 1) || (o == 0);
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24023 o_conv = ReplyChannelRange_clone(&o_conv);
24024 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24025 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
24026 return (int64_t)ret_conv;
24029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24030 LDKDecodeError e_conv;
24031 e_conv.inner = (void*)(e & (~1));
24032 e_conv.is_owned = (e & 1) || (e == 0);
24033 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24034 e_conv = DecodeError_clone(&e_conv);
24035 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24036 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
24037 return (int64_t)ret_conv;
24040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24041 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
24042 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
24046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24047 if ((_res & 1) != 0) return;
24048 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24049 CHECK_ACCESS(_res_ptr);
24050 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
24052 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
24055 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
24056 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24057 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
24058 return (int64_t)ret_conv;
24060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24061 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
24062 int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24067 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
24068 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24069 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
24070 return (int64_t)ret_conv;
24073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24074 LDKGossipTimestampFilter o_conv;
24075 o_conv.inner = (void*)(o & (~1));
24076 o_conv.is_owned = (o & 1) || (o == 0);
24077 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24078 o_conv = GossipTimestampFilter_clone(&o_conv);
24079 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24080 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
24081 return (int64_t)ret_conv;
24084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24085 LDKDecodeError e_conv;
24086 e_conv.inner = (void*)(e & (~1));
24087 e_conv.is_owned = (e & 1) || (e == 0);
24088 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24089 e_conv = DecodeError_clone(&e_conv);
24090 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24091 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
24092 return (int64_t)ret_conv;
24095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24096 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
24097 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
24101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24102 if ((_res & 1) != 0) return;
24103 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24104 CHECK_ACCESS(_res_ptr);
24105 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
24107 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
24110 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
24111 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24112 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
24113 return (int64_t)ret_conv;
24115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24116 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
24117 int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
24121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24122 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
24123 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24124 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
24125 return (int64_t)ret_conv;
24128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24129 LDKCVec_PhantomRouteHintsZ _res_constr;
24130 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24131 if (_res_constr.datalen > 0)
24132 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
24134 _res_constr.data = NULL;
24135 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24136 for (size_t t = 0; t < _res_constr.datalen; t++) {
24137 int64_t _res_conv_19 = _res_vals[t];
24138 LDKPhantomRouteHints _res_conv_19_conv;
24139 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
24140 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
24141 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
24142 _res_constr.data[t] = _res_conv_19_conv;
24144 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24145 CVec_PhantomRouteHintsZ_free(_res_constr);
24148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24150 o_conv.inner = (void*)(o & (~1));
24151 o_conv.is_owned = (o & 1) || (o == 0);
24152 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24153 o_conv = Invoice_clone(&o_conv);
24154 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24155 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
24156 return (int64_t)ret_conv;
24159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24160 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
24161 CHECK_ACCESS(e_ptr);
24162 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
24163 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
24164 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24165 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
24166 return (int64_t)ret_conv;
24169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24170 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
24171 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
24175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24176 if ((_res & 1) != 0) return;
24177 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24178 CHECK_ACCESS(_res_ptr);
24179 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
24181 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
24184 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
24185 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24186 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
24187 return (int64_t)ret_conv;
24189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24190 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
24191 int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
24195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24196 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
24197 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24198 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
24199 return (int64_t)ret_conv;
24202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24203 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
24204 CHECK_ACCESS(o_ptr);
24205 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
24206 if (o_conv.free == LDKFilter_JCalls_free) {
24207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24208 LDKFilter_JCalls_cloned(&o_conv);
24210 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24211 *ret_copy = COption_FilterZ_some(o_conv);
24212 int64_t ret_ref = (uintptr_t)ret_copy;
24216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
24217 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24218 *ret_copy = COption_FilterZ_none();
24219 int64_t ret_ref = (uintptr_t)ret_copy;
24223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24224 if ((_res & 1) != 0) return;
24225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24226 CHECK_ACCESS(_res_ptr);
24227 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
24229 COption_FilterZ_free(_res_conv);
24232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24233 LDKLockedChannelMonitor o_conv;
24234 o_conv.inner = (void*)(o & (~1));
24235 o_conv.is_owned = (o & 1) || (o == 0);
24236 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24237 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
24238 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24239 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
24240 return (int64_t)ret_conv;
24243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
24244 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24245 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
24246 return (int64_t)ret_conv;
24249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24250 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
24251 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
24255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24256 if ((_res & 1) != 0) return;
24257 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24258 CHECK_ACCESS(_res_ptr);
24259 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
24261 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
24264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24265 LDKCVec_OutPointZ _res_constr;
24266 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24267 if (_res_constr.datalen > 0)
24268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
24270 _res_constr.data = NULL;
24271 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24272 for (size_t k = 0; k < _res_constr.datalen; k++) {
24273 int64_t _res_conv_10 = _res_vals[k];
24274 LDKOutPoint _res_conv_10_conv;
24275 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
24276 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
24277 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
24278 _res_constr.data[k] = _res_conv_10_conv;
24280 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24281 CVec_OutPointZ_free(_res_constr);
24284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24285 if ((this_ptr & 1) != 0) return;
24286 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24287 CHECK_ACCESS(this_ptr_ptr);
24288 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
24289 FREE((void*)this_ptr);
24290 PaymentPurpose_free(this_ptr_conv);
24293 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
24294 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24295 *ret_copy = PaymentPurpose_clone(arg);
24296 int64_t ret_ref = (uintptr_t)ret_copy;
24299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24300 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
24301 int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
24305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24306 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
24307 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24308 *ret_copy = PaymentPurpose_clone(orig_conv);
24309 int64_t ret_ref = (uintptr_t)ret_copy;
24313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
24314 LDKThirtyTwoBytes payment_preimage_ref;
24315 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24316 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24317 LDKThirtyTwoBytes payment_secret_ref;
24318 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
24319 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
24320 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24321 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
24322 int64_t ret_ref = (uintptr_t)ret_copy;
24326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
24327 LDKThirtyTwoBytes a_ref;
24328 CHECK((*env)->GetArrayLength(env, a) == 32);
24329 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24330 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24331 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
24332 int64_t ret_ref = (uintptr_t)ret_copy;
24336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
24337 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
24338 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
24339 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24340 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24341 CVec_u8Z_free(ret_var);
24345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24346 LDKu8slice ser_ref;
24347 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24348 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24349 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
24350 *ret_conv = PaymentPurpose_read(ser_ref);
24351 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24352 return (int64_t)ret_conv;
24355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24356 if ((this_ptr & 1) != 0) return;
24357 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24358 CHECK_ACCESS(this_ptr_ptr);
24359 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
24360 FREE((void*)this_ptr);
24361 ClosureReason_free(this_ptr_conv);
24364 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
24365 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24366 *ret_copy = ClosureReason_clone(arg);
24367 int64_t ret_ref = (uintptr_t)ret_copy;
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24371 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
24372 int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
24376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24377 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
24378 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24379 *ret_copy = ClosureReason_clone(orig_conv);
24380 int64_t ret_ref = (uintptr_t)ret_copy;
24384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
24385 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
24386 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24387 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
24388 int64_t ret_ref = (uintptr_t)ret_copy;
24392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
24393 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24394 *ret_copy = ClosureReason_holder_force_closed();
24395 int64_t ret_ref = (uintptr_t)ret_copy;
24399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
24400 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24401 *ret_copy = ClosureReason_cooperative_closure();
24402 int64_t ret_ref = (uintptr_t)ret_copy;
24406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
24407 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24408 *ret_copy = ClosureReason_commitment_tx_confirmed();
24409 int64_t ret_ref = (uintptr_t)ret_copy;
24413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
24414 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24415 *ret_copy = ClosureReason_funding_timed_out();
24416 int64_t ret_ref = (uintptr_t)ret_copy;
24420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
24421 LDKStr err_conv = java_to_owned_str(env, err);
24422 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24423 *ret_copy = ClosureReason_processing_error(err_conv);
24424 int64_t ret_ref = (uintptr_t)ret_copy;
24428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
24429 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24430 *ret_copy = ClosureReason_disconnected_peer();
24431 int64_t ret_ref = (uintptr_t)ret_copy;
24435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
24436 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24437 *ret_copy = ClosureReason_outdated_channel_manager();
24438 int64_t ret_ref = (uintptr_t)ret_copy;
24442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
24443 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
24444 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
24445 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24446 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24447 CVec_u8Z_free(ret_var);
24451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24452 LDKu8slice ser_ref;
24453 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24454 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24455 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
24456 *ret_conv = ClosureReason_read(ser_ref);
24457 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24458 return (int64_t)ret_conv;
24461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24462 if ((this_ptr & 1) != 0) return;
24463 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24464 CHECK_ACCESS(this_ptr_ptr);
24465 LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
24466 FREE((void*)this_ptr);
24467 HTLCDestination_free(this_ptr_conv);
24470 static inline uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
24471 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24472 *ret_copy = HTLCDestination_clone(arg);
24473 int64_t ret_ref = (uintptr_t)ret_copy;
24476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24477 LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)arg;
24478 int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
24482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24483 LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)orig;
24484 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24485 *ret_copy = HTLCDestination_clone(orig_conv);
24486 int64_t ret_ref = (uintptr_t)ret_copy;
24490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
24491 LDKPublicKey node_id_ref;
24492 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24493 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24494 LDKThirtyTwoBytes channel_id_ref;
24495 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24496 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24497 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24498 *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
24499 int64_t ret_ref = (uintptr_t)ret_copy;
24503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
24504 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24505 *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
24506 int64_t ret_ref = (uintptr_t)ret_copy;
24510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
24511 LDKThirtyTwoBytes payment_hash_ref;
24512 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24513 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24514 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24515 *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
24516 int64_t ret_ref = (uintptr_t)ret_copy;
24520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
24521 LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)obj;
24522 LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
24523 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24524 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24525 CVec_u8Z_free(ret_var);
24529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24530 LDKu8slice ser_ref;
24531 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24532 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24533 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
24534 *ret_conv = HTLCDestination_read(ser_ref);
24535 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24536 return (int64_t)ret_conv;
24539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24540 if ((this_ptr & 1) != 0) return;
24541 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24542 CHECK_ACCESS(this_ptr_ptr);
24543 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
24544 FREE((void*)this_ptr);
24545 Event_free(this_ptr_conv);
24548 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
24549 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24550 *ret_copy = Event_clone(arg);
24551 int64_t ret_ref = (uintptr_t)ret_copy;
24554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24555 LDKEvent* arg_conv = (LDKEvent*)arg;
24556 int64_t ret_conv = Event_clone_ptr(arg_conv);
24560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24561 LDKEvent* orig_conv = (LDKEvent*)orig;
24562 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24563 *ret_copy = Event_clone(orig_conv);
24564 int64_t ret_ref = (uintptr_t)ret_copy;
24568 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) {
24569 LDKThirtyTwoBytes temporary_channel_id_ref;
24570 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24571 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24572 LDKPublicKey counterparty_node_id_ref;
24573 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24574 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24575 LDKCVec_u8Z output_script_ref;
24576 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
24577 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
24578 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
24579 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24580 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
24581 int64_t ret_ref = (uintptr_t)ret_copy;
24585 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) {
24586 LDKThirtyTwoBytes payment_hash_ref;
24587 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24588 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24589 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24590 CHECK_ACCESS(purpose_ptr);
24591 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24592 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24593 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24594 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
24595 int64_t ret_ref = (uintptr_t)ret_copy;
24599 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) {
24600 LDKThirtyTwoBytes payment_hash_ref;
24601 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24602 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24603 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24604 CHECK_ACCESS(purpose_ptr);
24605 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24606 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24607 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24608 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
24609 int64_t ret_ref = (uintptr_t)ret_copy;
24613 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) {
24614 LDKThirtyTwoBytes payment_id_ref;
24615 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24616 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24617 LDKThirtyTwoBytes payment_preimage_ref;
24618 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24619 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24620 LDKThirtyTwoBytes payment_hash_ref;
24621 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24622 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24623 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
24624 CHECK_ACCESS(fee_paid_msat_ptr);
24625 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
24626 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
24627 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24628 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
24629 int64_t ret_ref = (uintptr_t)ret_copy;
24633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
24634 LDKThirtyTwoBytes payment_id_ref;
24635 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24636 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24637 LDKThirtyTwoBytes payment_hash_ref;
24638 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24639 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24640 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24641 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
24642 int64_t ret_ref = (uintptr_t)ret_copy;
24646 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) {
24647 LDKThirtyTwoBytes payment_id_ref;
24648 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24649 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24650 LDKThirtyTwoBytes payment_hash_ref;
24651 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24652 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24653 LDKCVec_RouteHopZ path_constr;
24654 path_constr.datalen = (*env)->GetArrayLength(env, path);
24655 if (path_constr.datalen > 0)
24656 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24658 path_constr.data = NULL;
24659 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24660 for (size_t k = 0; k < path_constr.datalen; k++) {
24661 int64_t path_conv_10 = path_vals[k];
24662 LDKRouteHop path_conv_10_conv;
24663 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24664 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24665 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24666 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24667 path_constr.data[k] = path_conv_10_conv;
24669 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24670 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24671 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
24672 int64_t ret_ref = (uintptr_t)ret_copy;
24676 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) {
24677 LDKThirtyTwoBytes payment_id_ref;
24678 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24679 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24680 LDKThirtyTwoBytes payment_hash_ref;
24681 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24682 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24683 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
24684 CHECK_ACCESS(network_update_ptr);
24685 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
24686 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
24687 LDKCVec_RouteHopZ path_constr;
24688 path_constr.datalen = (*env)->GetArrayLength(env, path);
24689 if (path_constr.datalen > 0)
24690 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24692 path_constr.data = NULL;
24693 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24694 for (size_t k = 0; k < path_constr.datalen; k++) {
24695 int64_t path_conv_10 = path_vals[k];
24696 LDKRouteHop path_conv_10_conv;
24697 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24698 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24699 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24700 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24701 path_constr.data[k] = path_conv_10_conv;
24703 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24704 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
24705 CHECK_ACCESS(short_channel_id_ptr);
24706 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
24707 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
24708 LDKRouteParameters retry_conv;
24709 retry_conv.inner = (void*)(retry & (~1));
24710 retry_conv.is_owned = (retry & 1) || (retry == 0);
24711 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
24712 retry_conv = RouteParameters_clone(&retry_conv);
24713 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24714 *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);
24715 int64_t ret_ref = (uintptr_t)ret_copy;
24719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
24720 LDKThirtyTwoBytes payment_id_ref;
24721 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24722 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24723 LDKThirtyTwoBytes payment_hash_ref;
24724 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24725 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24726 LDKCVec_RouteHopZ path_constr;
24727 path_constr.datalen = (*env)->GetArrayLength(env, path);
24728 if (path_constr.datalen > 0)
24729 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24731 path_constr.data = NULL;
24732 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24733 for (size_t k = 0; k < path_constr.datalen; k++) {
24734 int64_t path_conv_10 = path_vals[k];
24735 LDKRouteHop path_conv_10_conv;
24736 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24737 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24738 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24739 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24740 path_constr.data[k] = path_conv_10_conv;
24742 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24743 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24744 *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
24745 int64_t ret_ref = (uintptr_t)ret_copy;
24749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path, int64_t short_channel_id) {
24750 LDKThirtyTwoBytes payment_id_ref;
24751 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24752 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24753 LDKThirtyTwoBytes payment_hash_ref;
24754 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24755 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24756 LDKCVec_RouteHopZ path_constr;
24757 path_constr.datalen = (*env)->GetArrayLength(env, path);
24758 if (path_constr.datalen > 0)
24759 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24761 path_constr.data = NULL;
24762 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24763 for (size_t k = 0; k < path_constr.datalen; k++) {
24764 int64_t path_conv_10 = path_vals[k];
24765 LDKRouteHop path_conv_10_conv;
24766 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24767 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24768 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24769 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24770 path_constr.data[k] = path_conv_10_conv;
24772 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24773 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
24774 CHECK_ACCESS(short_channel_id_ptr);
24775 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
24776 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
24777 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24778 *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
24779 int64_t ret_ref = (uintptr_t)ret_copy;
24783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
24784 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24785 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
24786 int64_t ret_ref = (uintptr_t)ret_copy;
24790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
24791 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
24792 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
24793 if (outputs_constr.datalen > 0)
24794 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24796 outputs_constr.data = NULL;
24797 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
24798 for (size_t b = 0; b < outputs_constr.datalen; b++) {
24799 int64_t outputs_conv_27 = outputs_vals[b];
24800 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
24801 CHECK_ACCESS(outputs_conv_27_ptr);
24802 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
24803 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
24804 outputs_constr.data[b] = outputs_conv_27_conv;
24806 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
24807 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24808 *ret_copy = Event_spendable_outputs(outputs_constr);
24809 int64_t ret_ref = (uintptr_t)ret_copy;
24813 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) {
24814 LDKThirtyTwoBytes prev_channel_id_ref;
24815 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
24816 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
24817 LDKThirtyTwoBytes next_channel_id_ref;
24818 CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
24819 (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
24820 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
24821 CHECK_ACCESS(fee_earned_msat_ptr);
24822 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
24823 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
24824 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24825 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
24826 int64_t ret_ref = (uintptr_t)ret_copy;
24830 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) {
24831 LDKThirtyTwoBytes channel_id_ref;
24832 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24833 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24834 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
24835 CHECK_ACCESS(reason_ptr);
24836 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
24837 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
24838 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24839 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
24840 int64_t ret_ref = (uintptr_t)ret_copy;
24844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
24845 LDKThirtyTwoBytes channel_id_ref;
24846 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24847 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24848 LDKTransaction transaction_ref;
24849 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
24850 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
24851 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
24852 transaction_ref.data_is_owned = true;
24853 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24854 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
24855 int64_t ret_ref = (uintptr_t)ret_copy;
24859 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) {
24860 LDKThirtyTwoBytes temporary_channel_id_ref;
24861 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24862 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24863 LDKPublicKey counterparty_node_id_ref;
24864 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24865 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24866 LDKChannelTypeFeatures channel_type_conv;
24867 channel_type_conv.inner = (void*)(channel_type & (~1));
24868 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
24869 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
24870 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
24871 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24872 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
24873 int64_t ret_ref = (uintptr_t)ret_copy;
24877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
24878 LDKThirtyTwoBytes prev_channel_id_ref;
24879 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
24880 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
24881 void* failed_next_destination_ptr = (void*)(((uintptr_t)failed_next_destination) & ~1);
24882 CHECK_ACCESS(failed_next_destination_ptr);
24883 LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
24884 failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)failed_next_destination) & ~1));
24885 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24886 *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
24887 int64_t ret_ref = (uintptr_t)ret_copy;
24891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
24892 LDKEvent* obj_conv = (LDKEvent*)obj;
24893 LDKCVec_u8Z ret_var = Event_write(obj_conv);
24894 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24895 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24896 CVec_u8Z_free(ret_var);
24900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24901 LDKu8slice ser_ref;
24902 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24903 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24904 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
24905 *ret_conv = Event_read(ser_ref);
24906 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24907 return (int64_t)ret_conv;
24910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24911 if ((this_ptr & 1) != 0) return;
24912 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24913 CHECK_ACCESS(this_ptr_ptr);
24914 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
24915 FREE((void*)this_ptr);
24916 MessageSendEvent_free(this_ptr_conv);
24919 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
24920 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24921 *ret_copy = MessageSendEvent_clone(arg);
24922 int64_t ret_ref = (uintptr_t)ret_copy;
24925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24926 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
24927 int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
24931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24932 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
24933 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24934 *ret_copy = MessageSendEvent_clone(orig_conv);
24935 int64_t ret_ref = (uintptr_t)ret_copy;
24939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24940 LDKPublicKey node_id_ref;
24941 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24942 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24943 LDKAcceptChannel msg_conv;
24944 msg_conv.inner = (void*)(msg & (~1));
24945 msg_conv.is_owned = (msg & 1) || (msg == 0);
24946 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24947 msg_conv = AcceptChannel_clone(&msg_conv);
24948 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24949 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
24950 int64_t ret_ref = (uintptr_t)ret_copy;
24954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24955 LDKPublicKey node_id_ref;
24956 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24957 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24958 LDKOpenChannel msg_conv;
24959 msg_conv.inner = (void*)(msg & (~1));
24960 msg_conv.is_owned = (msg & 1) || (msg == 0);
24961 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24962 msg_conv = OpenChannel_clone(&msg_conv);
24963 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24964 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
24965 int64_t ret_ref = (uintptr_t)ret_copy;
24969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24970 LDKPublicKey node_id_ref;
24971 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24972 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24973 LDKFundingCreated msg_conv;
24974 msg_conv.inner = (void*)(msg & (~1));
24975 msg_conv.is_owned = (msg & 1) || (msg == 0);
24976 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24977 msg_conv = FundingCreated_clone(&msg_conv);
24978 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24979 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
24980 int64_t ret_ref = (uintptr_t)ret_copy;
24984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24985 LDKPublicKey node_id_ref;
24986 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24987 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24988 LDKFundingSigned msg_conv;
24989 msg_conv.inner = (void*)(msg & (~1));
24990 msg_conv.is_owned = (msg & 1) || (msg == 0);
24991 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24992 msg_conv = FundingSigned_clone(&msg_conv);
24993 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24994 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
24995 int64_t ret_ref = (uintptr_t)ret_copy;
24999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25000 LDKPublicKey node_id_ref;
25001 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25002 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25003 LDKChannelReady msg_conv;
25004 msg_conv.inner = (void*)(msg & (~1));
25005 msg_conv.is_owned = (msg & 1) || (msg == 0);
25006 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25007 msg_conv = ChannelReady_clone(&msg_conv);
25008 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25009 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
25010 int64_t ret_ref = (uintptr_t)ret_copy;
25014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25015 LDKPublicKey node_id_ref;
25016 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25017 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25018 LDKAnnouncementSignatures msg_conv;
25019 msg_conv.inner = (void*)(msg & (~1));
25020 msg_conv.is_owned = (msg & 1) || (msg == 0);
25021 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25022 msg_conv = AnnouncementSignatures_clone(&msg_conv);
25023 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25024 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
25025 int64_t ret_ref = (uintptr_t)ret_copy;
25029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
25030 LDKPublicKey node_id_ref;
25031 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25032 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25033 LDKCommitmentUpdate updates_conv;
25034 updates_conv.inner = (void*)(updates & (~1));
25035 updates_conv.is_owned = (updates & 1) || (updates == 0);
25036 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25037 updates_conv = CommitmentUpdate_clone(&updates_conv);
25038 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25039 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
25040 int64_t ret_ref = (uintptr_t)ret_copy;
25044 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) {
25045 LDKPublicKey node_id_ref;
25046 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25047 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25048 LDKRevokeAndACK msg_conv;
25049 msg_conv.inner = (void*)(msg & (~1));
25050 msg_conv.is_owned = (msg & 1) || (msg == 0);
25051 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25052 msg_conv = RevokeAndACK_clone(&msg_conv);
25053 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25054 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
25055 int64_t ret_ref = (uintptr_t)ret_copy;
25059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25060 LDKPublicKey node_id_ref;
25061 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25062 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25063 LDKClosingSigned msg_conv;
25064 msg_conv.inner = (void*)(msg & (~1));
25065 msg_conv.is_owned = (msg & 1) || (msg == 0);
25066 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25067 msg_conv = ClosingSigned_clone(&msg_conv);
25068 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25069 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
25070 int64_t ret_ref = (uintptr_t)ret_copy;
25074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25075 LDKPublicKey node_id_ref;
25076 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25077 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25078 LDKShutdown msg_conv;
25079 msg_conv.inner = (void*)(msg & (~1));
25080 msg_conv.is_owned = (msg & 1) || (msg == 0);
25081 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25082 msg_conv = Shutdown_clone(&msg_conv);
25083 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25084 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
25085 int64_t ret_ref = (uintptr_t)ret_copy;
25089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25090 LDKPublicKey node_id_ref;
25091 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25092 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25093 LDKChannelReestablish msg_conv;
25094 msg_conv.inner = (void*)(msg & (~1));
25095 msg_conv.is_owned = (msg & 1) || (msg == 0);
25096 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25097 msg_conv = ChannelReestablish_clone(&msg_conv);
25098 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25099 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
25100 int64_t ret_ref = (uintptr_t)ret_copy;
25104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
25105 LDKChannelAnnouncement msg_conv;
25106 msg_conv.inner = (void*)(msg & (~1));
25107 msg_conv.is_owned = (msg & 1) || (msg == 0);
25108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25109 msg_conv = ChannelAnnouncement_clone(&msg_conv);
25110 LDKChannelUpdate update_msg_conv;
25111 update_msg_conv.inner = (void*)(update_msg & (~1));
25112 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
25113 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
25114 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
25115 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25116 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
25117 int64_t ret_ref = (uintptr_t)ret_copy;
25121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
25122 LDKNodeAnnouncement msg_conv;
25123 msg_conv.inner = (void*)(msg & (~1));
25124 msg_conv.is_owned = (msg & 1) || (msg == 0);
25125 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25126 msg_conv = NodeAnnouncement_clone(&msg_conv);
25127 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25128 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
25129 int64_t ret_ref = (uintptr_t)ret_copy;
25133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
25134 LDKChannelUpdate msg_conv;
25135 msg_conv.inner = (void*)(msg & (~1));
25136 msg_conv.is_owned = (msg & 1) || (msg == 0);
25137 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25138 msg_conv = ChannelUpdate_clone(&msg_conv);
25139 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25140 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
25141 int64_t ret_ref = (uintptr_t)ret_copy;
25145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25146 LDKPublicKey node_id_ref;
25147 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25148 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25149 LDKChannelUpdate msg_conv;
25150 msg_conv.inner = (void*)(msg & (~1));
25151 msg_conv.is_owned = (msg & 1) || (msg == 0);
25152 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25153 msg_conv = ChannelUpdate_clone(&msg_conv);
25154 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25155 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
25156 int64_t ret_ref = (uintptr_t)ret_copy;
25160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
25161 LDKPublicKey node_id_ref;
25162 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25163 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25164 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
25165 CHECK_ACCESS(action_ptr);
25166 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
25167 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
25168 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25169 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
25170 int64_t ret_ref = (uintptr_t)ret_copy;
25174 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) {
25175 LDKPublicKey node_id_ref;
25176 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25177 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25178 LDKQueryChannelRange msg_conv;
25179 msg_conv.inner = (void*)(msg & (~1));
25180 msg_conv.is_owned = (msg & 1) || (msg == 0);
25181 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25182 msg_conv = QueryChannelRange_clone(&msg_conv);
25183 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25184 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
25185 int64_t ret_ref = (uintptr_t)ret_copy;
25189 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) {
25190 LDKPublicKey node_id_ref;
25191 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25192 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25193 LDKQueryShortChannelIds msg_conv;
25194 msg_conv.inner = (void*)(msg & (~1));
25195 msg_conv.is_owned = (msg & 1) || (msg == 0);
25196 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25197 msg_conv = QueryShortChannelIds_clone(&msg_conv);
25198 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25199 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
25200 int64_t ret_ref = (uintptr_t)ret_copy;
25204 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) {
25205 LDKPublicKey node_id_ref;
25206 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25207 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25208 LDKReplyChannelRange msg_conv;
25209 msg_conv.inner = (void*)(msg & (~1));
25210 msg_conv.is_owned = (msg & 1) || (msg == 0);
25211 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25212 msg_conv = ReplyChannelRange_clone(&msg_conv);
25213 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25214 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
25215 int64_t ret_ref = (uintptr_t)ret_copy;
25219 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) {
25220 LDKPublicKey node_id_ref;
25221 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25222 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25223 LDKGossipTimestampFilter msg_conv;
25224 msg_conv.inner = (void*)(msg & (~1));
25225 msg_conv.is_owned = (msg & 1) || (msg == 0);
25226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25227 msg_conv = GossipTimestampFilter_clone(&msg_conv);
25228 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25229 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
25230 int64_t ret_ref = (uintptr_t)ret_copy;
25234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25235 if ((this_ptr & 1) != 0) return;
25236 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25237 CHECK_ACCESS(this_ptr_ptr);
25238 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
25239 FREE((void*)this_ptr);
25240 MessageSendEventsProvider_free(this_ptr_conv);
25243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25244 if ((this_ptr & 1) != 0) return;
25245 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25246 CHECK_ACCESS(this_ptr_ptr);
25247 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
25248 FREE((void*)this_ptr);
25249 EventsProvider_free(this_ptr_conv);
25252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25253 if ((this_ptr & 1) != 0) return;
25254 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25255 CHECK_ACCESS(this_ptr_ptr);
25256 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
25257 FREE((void*)this_ptr);
25258 EventHandler_free(this_ptr_conv);
25261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25262 if ((this_ptr & 1) != 0) return;
25263 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25264 CHECK_ACCESS(this_ptr_ptr);
25265 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
25266 FREE((void*)this_ptr);
25267 APIError_free(this_ptr_conv);
25270 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
25271 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25272 *ret_copy = APIError_clone(arg);
25273 int64_t ret_ref = (uintptr_t)ret_copy;
25276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25277 LDKAPIError* arg_conv = (LDKAPIError*)arg;
25278 int64_t ret_conv = APIError_clone_ptr(arg_conv);
25282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25283 LDKAPIError* orig_conv = (LDKAPIError*)orig;
25284 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25285 *ret_copy = APIError_clone(orig_conv);
25286 int64_t ret_ref = (uintptr_t)ret_copy;
25290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
25291 LDKStr err_conv = java_to_owned_str(env, err);
25292 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25293 *ret_copy = APIError_apimisuse_error(err_conv);
25294 int64_t ret_ref = (uintptr_t)ret_copy;
25298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
25299 LDKStr err_conv = java_to_owned_str(env, err);
25300 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25301 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
25302 int64_t ret_ref = (uintptr_t)ret_copy;
25306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
25307 LDKStr err_conv = java_to_owned_str(env, err);
25308 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25309 *ret_copy = APIError_route_error(err_conv);
25310 int64_t ret_ref = (uintptr_t)ret_copy;
25314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
25315 LDKStr err_conv = java_to_owned_str(env, err);
25316 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25317 *ret_copy = APIError_channel_unavailable(err_conv);
25318 int64_t ret_ref = (uintptr_t)ret_copy;
25322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
25323 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25324 *ret_copy = APIError_monitor_update_failed();
25325 int64_t ret_ref = (uintptr_t)ret_copy;
25329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
25330 LDKShutdownScript script_conv;
25331 script_conv.inner = (void*)(script & (~1));
25332 script_conv.is_owned = (script & 1) || (script == 0);
25333 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
25334 script_conv = ShutdownScript_clone(&script_conv);
25335 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25336 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
25337 int64_t ret_ref = (uintptr_t)ret_copy;
25341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25342 LDKBigSize this_obj_conv;
25343 this_obj_conv.inner = (void*)(this_obj & (~1));
25344 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25346 BigSize_free(this_obj_conv);
25349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
25350 LDKBigSize this_ptr_conv;
25351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25352 this_ptr_conv.is_owned = false;
25353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25354 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
25358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25359 LDKBigSize this_ptr_conv;
25360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25361 this_ptr_conv.is_owned = false;
25362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25363 BigSize_set_a(&this_ptr_conv, val);
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
25367 LDKBigSize ret_var = BigSize_new(a_arg);
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 void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25380 LDKHostname this_obj_conv;
25381 this_obj_conv.inner = (void*)(this_obj & (~1));
25382 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25384 Hostname_free(this_obj_conv);
25387 static inline uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
25388 LDKHostname ret_var = Hostname_clone(arg);
25389 int64_t ret_ref = 0;
25390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25393 ret_ref = (uintptr_t)ret_var.inner;
25394 if (ret_var.is_owned) {
25399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25400 LDKHostname arg_conv;
25401 arg_conv.inner = (void*)(arg & (~1));
25402 arg_conv.is_owned = false;
25403 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25404 int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
25408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25409 LDKHostname orig_conv;
25410 orig_conv.inner = (void*)(orig & (~1));
25411 orig_conv.is_owned = false;
25412 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25413 LDKHostname ret_var = Hostname_clone(&orig_conv);
25414 int64_t ret_ref = 0;
25415 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25416 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25417 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25418 ret_ref = (uintptr_t)ret_var.inner;
25419 if (ret_var.is_owned) {
25425 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
25426 LDKHostname this_arg_conv;
25427 this_arg_conv.inner = (void*)(this_arg & (~1));
25428 this_arg_conv.is_owned = false;
25429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25430 int8_t ret_conv = Hostname_len(&this_arg_conv);
25434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
25435 LDKu8slice msg_ref;
25436 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25437 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25438 unsigned char sk_arr[32];
25439 CHECK((*env)->GetArrayLength(env, sk) == 32);
25440 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
25441 unsigned char (*sk_ref)[32] = &sk_arr;
25442 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
25443 *ret_conv = sign(msg_ref, sk_ref);
25444 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25445 return (int64_t)ret_conv;
25448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
25449 LDKu8slice msg_ref;
25450 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25451 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25452 LDKStr sig_conv = java_to_owned_str(env, sig);
25453 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25454 *ret_conv = recover_pk(msg_ref, sig_conv);
25455 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25456 return (int64_t)ret_conv;
25459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
25460 LDKu8slice msg_ref;
25461 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25462 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25463 LDKStr sig_conv = java_to_owned_str(env, sig);
25464 LDKPublicKey pk_ref;
25465 CHECK((*env)->GetArrayLength(env, pk) == 33);
25466 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
25467 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
25468 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
25473 LDKu8slice hrp_bytes_ref;
25474 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
25475 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
25476 LDKCVec_u5Z data_without_signature_constr;
25477 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
25478 if (data_without_signature_constr.datalen > 0)
25479 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
25481 data_without_signature_constr.data = NULL;
25482 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
25483 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
25484 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
25486 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
25488 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
25489 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
25490 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25491 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25492 CVec_u8Z_free(ret_var);
25493 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
25497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25498 if ((this_ptr & 1) != 0) return;
25499 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25500 CHECK_ACCESS(this_ptr_ptr);
25501 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
25502 FREE((void*)this_ptr);
25503 Persister_free(this_ptr_conv);
25506 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25507 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
25508 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
25512 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
25513 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
25517 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
25518 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
25522 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
25523 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
25527 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
25528 jclass ret_conv = LDKLevel_to_java(env, Level_info());
25532 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
25533 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
25537 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
25538 jclass ret_conv = LDKLevel_to_java(env, Level_error());
25542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25543 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
25544 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
25545 jboolean ret_conv = Level_eq(a_conv, b_conv);
25549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
25550 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
25551 int64_t ret_conv = Level_hash(o_conv);
25555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
25556 jclass ret_conv = LDKLevel_to_java(env, Level_max());
25560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25561 LDKRecord this_obj_conv;
25562 this_obj_conv.inner = (void*)(this_obj & (~1));
25563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25565 Record_free(this_obj_conv);
25568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
25569 LDKRecord this_ptr_conv;
25570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25571 this_ptr_conv.is_owned = false;
25572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25573 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
25577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
25578 LDKRecord this_ptr_conv;
25579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25580 this_ptr_conv.is_owned = false;
25581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25582 LDKLevel val_conv = LDKLevel_from_java(env, val);
25583 Record_set_level(&this_ptr_conv, val_conv);
25586 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
25587 LDKRecord this_ptr_conv;
25588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25589 this_ptr_conv.is_owned = false;
25590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25591 LDKStr ret_str = Record_get_args(&this_ptr_conv);
25592 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25598 LDKRecord this_ptr_conv;
25599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25600 this_ptr_conv.is_owned = false;
25601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25602 LDKStr val_conv = java_to_owned_str(env, val);
25603 Record_set_args(&this_ptr_conv, val_conv);
25606 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
25607 LDKRecord this_ptr_conv;
25608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25609 this_ptr_conv.is_owned = false;
25610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25611 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
25612 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25618 LDKRecord this_ptr_conv;
25619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25620 this_ptr_conv.is_owned = false;
25621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25622 LDKStr val_conv = java_to_owned_str(env, val);
25623 Record_set_module_path(&this_ptr_conv, val_conv);
25626 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
25627 LDKRecord this_ptr_conv;
25628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25629 this_ptr_conv.is_owned = false;
25630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25631 LDKStr ret_str = Record_get_file(&this_ptr_conv);
25632 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25638 LDKRecord this_ptr_conv;
25639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25640 this_ptr_conv.is_owned = false;
25641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25642 LDKStr val_conv = java_to_owned_str(env, val);
25643 Record_set_file(&this_ptr_conv, val_conv);
25646 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
25647 LDKRecord this_ptr_conv;
25648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25649 this_ptr_conv.is_owned = false;
25650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25651 int32_t ret_conv = Record_get_line(&this_ptr_conv);
25655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25656 LDKRecord this_ptr_conv;
25657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25658 this_ptr_conv.is_owned = false;
25659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25660 Record_set_line(&this_ptr_conv, val);
25663 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
25664 LDKRecord ret_var = Record_clone(arg);
25665 int64_t ret_ref = 0;
25666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25669 ret_ref = (uintptr_t)ret_var.inner;
25670 if (ret_var.is_owned) {
25675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25676 LDKRecord arg_conv;
25677 arg_conv.inner = (void*)(arg & (~1));
25678 arg_conv.is_owned = false;
25679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25680 int64_t ret_conv = Record_clone_ptr(&arg_conv);
25684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25685 LDKRecord orig_conv;
25686 orig_conv.inner = (void*)(orig & (~1));
25687 orig_conv.is_owned = false;
25688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25689 LDKRecord ret_var = Record_clone(&orig_conv);
25690 int64_t ret_ref = 0;
25691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25694 ret_ref = (uintptr_t)ret_var.inner;
25695 if (ret_var.is_owned) {
25701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25702 if ((this_ptr & 1) != 0) return;
25703 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25704 CHECK_ACCESS(this_ptr_ptr);
25705 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
25706 FREE((void*)this_ptr);
25707 Logger_free(this_ptr_conv);
25710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25711 LDKChannelHandshakeConfig this_obj_conv;
25712 this_obj_conv.inner = (void*)(this_obj & (~1));
25713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25715 ChannelHandshakeConfig_free(this_obj_conv);
25718 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
25719 LDKChannelHandshakeConfig this_ptr_conv;
25720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25721 this_ptr_conv.is_owned = false;
25722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25723 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
25727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25728 LDKChannelHandshakeConfig this_ptr_conv;
25729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25730 this_ptr_conv.is_owned = false;
25731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25732 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
25735 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25736 LDKChannelHandshakeConfig this_ptr_conv;
25737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25738 this_ptr_conv.is_owned = false;
25739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25740 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
25744 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) {
25745 LDKChannelHandshakeConfig this_ptr_conv;
25746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25747 this_ptr_conv.is_owned = false;
25748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25749 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
25752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25753 LDKChannelHandshakeConfig this_ptr_conv;
25754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25755 this_ptr_conv.is_owned = false;
25756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25757 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
25761 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) {
25762 LDKChannelHandshakeConfig this_ptr_conv;
25763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25764 this_ptr_conv.is_owned = false;
25765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25766 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
25769 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) {
25770 LDKChannelHandshakeConfig this_ptr_conv;
25771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25772 this_ptr_conv.is_owned = false;
25773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25774 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
25778 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) {
25779 LDKChannelHandshakeConfig this_ptr_conv;
25780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25781 this_ptr_conv.is_owned = false;
25782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25783 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
25786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
25787 LDKChannelHandshakeConfig this_ptr_conv;
25788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25789 this_ptr_conv.is_owned = false;
25790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25791 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
25795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25796 LDKChannelHandshakeConfig this_ptr_conv;
25797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25798 this_ptr_conv.is_owned = false;
25799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25800 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
25803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
25804 LDKChannelHandshakeConfig this_ptr_conv;
25805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25806 this_ptr_conv.is_owned = false;
25807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25808 jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
25812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25813 LDKChannelHandshakeConfig this_ptr_conv;
25814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25815 this_ptr_conv.is_owned = false;
25816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25817 ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
25820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25821 LDKChannelHandshakeConfig this_ptr_conv;
25822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25823 this_ptr_conv.is_owned = false;
25824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25825 jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
25829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25830 LDKChannelHandshakeConfig this_ptr_conv;
25831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25832 this_ptr_conv.is_owned = false;
25833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25834 ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
25837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
25838 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
25839 int64_t ret_ref = 0;
25840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25843 ret_ref = (uintptr_t)ret_var.inner;
25844 if (ret_var.is_owned) {
25850 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
25851 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
25852 int64_t ret_ref = 0;
25853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25856 ret_ref = (uintptr_t)ret_var.inner;
25857 if (ret_var.is_owned) {
25862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25863 LDKChannelHandshakeConfig arg_conv;
25864 arg_conv.inner = (void*)(arg & (~1));
25865 arg_conv.is_owned = false;
25866 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25867 int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
25871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25872 LDKChannelHandshakeConfig orig_conv;
25873 orig_conv.inner = (void*)(orig & (~1));
25874 orig_conv.is_owned = false;
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25876 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
25877 int64_t ret_ref = 0;
25878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25881 ret_ref = (uintptr_t)ret_var.inner;
25882 if (ret_var.is_owned) {
25888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
25889 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
25890 int64_t ret_ref = 0;
25891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25894 ret_ref = (uintptr_t)ret_var.inner;
25895 if (ret_var.is_owned) {
25901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25902 LDKChannelHandshakeLimits this_obj_conv;
25903 this_obj_conv.inner = (void*)(this_obj & (~1));
25904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25906 ChannelHandshakeLimits_free(this_obj_conv);
25909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25910 LDKChannelHandshakeLimits this_ptr_conv;
25911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25912 this_ptr_conv.is_owned = false;
25913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25914 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
25918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25919 LDKChannelHandshakeLimits this_ptr_conv;
25920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25921 this_ptr_conv.is_owned = false;
25922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25923 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
25926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25927 LDKChannelHandshakeLimits this_ptr_conv;
25928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25929 this_ptr_conv.is_owned = false;
25930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25931 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
25935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25936 LDKChannelHandshakeLimits this_ptr_conv;
25937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25938 this_ptr_conv.is_owned = false;
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25940 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
25943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25944 LDKChannelHandshakeLimits this_ptr_conv;
25945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25946 this_ptr_conv.is_owned = false;
25947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25948 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
25952 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) {
25953 LDKChannelHandshakeLimits this_ptr_conv;
25954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25955 this_ptr_conv.is_owned = false;
25956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25957 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
25960 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) {
25961 LDKChannelHandshakeLimits this_ptr_conv;
25962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25963 this_ptr_conv.is_owned = false;
25964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25965 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
25969 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) {
25970 LDKChannelHandshakeLimits this_ptr_conv;
25971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25972 this_ptr_conv.is_owned = false;
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25974 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
25977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25978 LDKChannelHandshakeLimits this_ptr_conv;
25979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25980 this_ptr_conv.is_owned = false;
25981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25982 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
25986 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) {
25987 LDKChannelHandshakeLimits this_ptr_conv;
25988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25989 this_ptr_conv.is_owned = false;
25990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25991 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
25994 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25995 LDKChannelHandshakeLimits this_ptr_conv;
25996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25997 this_ptr_conv.is_owned = false;
25998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25999 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
26003 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) {
26004 LDKChannelHandshakeLimits this_ptr_conv;
26005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26006 this_ptr_conv.is_owned = false;
26007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26008 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
26011 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
26012 LDKChannelHandshakeLimits this_ptr_conv;
26013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26014 this_ptr_conv.is_owned = false;
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26016 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
26020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26021 LDKChannelHandshakeLimits this_ptr_conv;
26022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26023 this_ptr_conv.is_owned = false;
26024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26025 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
26028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
26029 LDKChannelHandshakeLimits this_ptr_conv;
26030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26031 this_ptr_conv.is_owned = false;
26032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26033 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
26037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26038 LDKChannelHandshakeLimits this_ptr_conv;
26039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26040 this_ptr_conv.is_owned = false;
26041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26042 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
26045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
26046 LDKChannelHandshakeLimits this_ptr_conv;
26047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26048 this_ptr_conv.is_owned = false;
26049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26050 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
26054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26055 LDKChannelHandshakeLimits this_ptr_conv;
26056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26057 this_ptr_conv.is_owned = false;
26058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26059 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
26062 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26063 LDKChannelHandshakeLimits this_ptr_conv;
26064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26065 this_ptr_conv.is_owned = false;
26066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26067 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
26071 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) {
26072 LDKChannelHandshakeLimits this_ptr_conv;
26073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26074 this_ptr_conv.is_owned = false;
26075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26076 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
26079 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) {
26080 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);
26081 int64_t ret_ref = 0;
26082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26085 ret_ref = (uintptr_t)ret_var.inner;
26086 if (ret_var.is_owned) {
26092 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
26093 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
26094 int64_t ret_ref = 0;
26095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26098 ret_ref = (uintptr_t)ret_var.inner;
26099 if (ret_var.is_owned) {
26104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26105 LDKChannelHandshakeLimits arg_conv;
26106 arg_conv.inner = (void*)(arg & (~1));
26107 arg_conv.is_owned = false;
26108 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26109 int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
26113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26114 LDKChannelHandshakeLimits orig_conv;
26115 orig_conv.inner = (void*)(orig & (~1));
26116 orig_conv.is_owned = false;
26117 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26118 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
26119 int64_t ret_ref = 0;
26120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26123 ret_ref = (uintptr_t)ret_var.inner;
26124 if (ret_var.is_owned) {
26130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
26131 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
26132 int64_t ret_ref = 0;
26133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26136 ret_ref = (uintptr_t)ret_var.inner;
26137 if (ret_var.is_owned) {
26143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26144 LDKChannelConfig this_obj_conv;
26145 this_obj_conv.inner = (void*)(this_obj & (~1));
26146 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26148 ChannelConfig_free(this_obj_conv);
26151 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26152 LDKChannelConfig this_ptr_conv;
26153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26154 this_ptr_conv.is_owned = false;
26155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26156 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
26160 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) {
26161 LDKChannelConfig this_ptr_conv;
26162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26163 this_ptr_conv.is_owned = false;
26164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26165 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
26168 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26169 LDKChannelConfig this_ptr_conv;
26170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26171 this_ptr_conv.is_owned = false;
26172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26173 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
26177 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) {
26178 LDKChannelConfig this_ptr_conv;
26179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26180 this_ptr_conv.is_owned = false;
26181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26182 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
26185 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26186 LDKChannelConfig this_ptr_conv;
26187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26188 this_ptr_conv.is_owned = false;
26189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26190 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
26194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26195 LDKChannelConfig this_ptr_conv;
26196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26197 this_ptr_conv.is_owned = false;
26198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26199 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
26202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26203 LDKChannelConfig this_ptr_conv;
26204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26205 this_ptr_conv.is_owned = false;
26206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26207 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
26211 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) {
26212 LDKChannelConfig this_ptr_conv;
26213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26214 this_ptr_conv.is_owned = false;
26215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26216 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
26219 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) {
26220 LDKChannelConfig this_ptr_conv;
26221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26222 this_ptr_conv.is_owned = false;
26223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26224 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
26228 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) {
26229 LDKChannelConfig this_ptr_conv;
26230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26231 this_ptr_conv.is_owned = false;
26232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26233 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
26236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
26237 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
26238 int64_t ret_ref = 0;
26239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26242 ret_ref = (uintptr_t)ret_var.inner;
26243 if (ret_var.is_owned) {
26249 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
26250 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
26251 int64_t ret_ref = 0;
26252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26255 ret_ref = (uintptr_t)ret_var.inner;
26256 if (ret_var.is_owned) {
26261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26262 LDKChannelConfig arg_conv;
26263 arg_conv.inner = (void*)(arg & (~1));
26264 arg_conv.is_owned = false;
26265 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26266 int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
26270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26271 LDKChannelConfig orig_conv;
26272 orig_conv.inner = (void*)(orig & (~1));
26273 orig_conv.is_owned = false;
26274 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26275 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
26276 int64_t ret_ref = 0;
26277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26280 ret_ref = (uintptr_t)ret_var.inner;
26281 if (ret_var.is_owned) {
26287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
26288 LDKChannelConfig ret_var = ChannelConfig_default();
26289 int64_t ret_ref = 0;
26290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26293 ret_ref = (uintptr_t)ret_var.inner;
26294 if (ret_var.is_owned) {
26300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
26301 LDKChannelConfig obj_conv;
26302 obj_conv.inner = (void*)(obj & (~1));
26303 obj_conv.is_owned = false;
26304 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26305 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
26306 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26307 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26308 CVec_u8Z_free(ret_var);
26312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26313 LDKu8slice ser_ref;
26314 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26315 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26316 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26317 *ret_conv = ChannelConfig_read(ser_ref);
26318 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26319 return (int64_t)ret_conv;
26322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26323 LDKUserConfig this_obj_conv;
26324 this_obj_conv.inner = (void*)(this_obj & (~1));
26325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26327 UserConfig_free(this_obj_conv);
26330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26331 LDKUserConfig this_ptr_conv;
26332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26333 this_ptr_conv.is_owned = false;
26334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26335 LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26348 LDKUserConfig this_ptr_conv;
26349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26350 this_ptr_conv.is_owned = false;
26351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352 LDKChannelHandshakeConfig val_conv;
26353 val_conv.inner = (void*)(val & (~1));
26354 val_conv.is_owned = (val & 1) || (val == 0);
26355 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26356 val_conv = ChannelHandshakeConfig_clone(&val_conv);
26357 UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
26360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
26361 LDKUserConfig this_ptr_conv;
26362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26363 this_ptr_conv.is_owned = false;
26364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26365 LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
26366 int64_t ret_ref = 0;
26367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26370 ret_ref = (uintptr_t)ret_var.inner;
26371 if (ret_var.is_owned) {
26377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26378 LDKUserConfig this_ptr_conv;
26379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26380 this_ptr_conv.is_owned = false;
26381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26382 LDKChannelHandshakeLimits val_conv;
26383 val_conv.inner = (void*)(val & (~1));
26384 val_conv.is_owned = (val & 1) || (val == 0);
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26386 val_conv = ChannelHandshakeLimits_clone(&val_conv);
26387 UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
26390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26391 LDKUserConfig this_ptr_conv;
26392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26393 this_ptr_conv.is_owned = false;
26394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26395 LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
26396 int64_t ret_ref = 0;
26397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26400 ret_ref = (uintptr_t)ret_var.inner;
26401 if (ret_var.is_owned) {
26407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26408 LDKUserConfig this_ptr_conv;
26409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26410 this_ptr_conv.is_owned = false;
26411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26412 LDKChannelConfig val_conv;
26413 val_conv.inner = (void*)(val & (~1));
26414 val_conv.is_owned = (val & 1) || (val == 0);
26415 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26416 val_conv = ChannelConfig_clone(&val_conv);
26417 UserConfig_set_channel_config(&this_ptr_conv, val_conv);
26420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26421 LDKUserConfig this_ptr_conv;
26422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26423 this_ptr_conv.is_owned = false;
26424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26425 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
26429 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) {
26430 LDKUserConfig this_ptr_conv;
26431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26432 this_ptr_conv.is_owned = false;
26433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26434 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
26437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26438 LDKUserConfig this_ptr_conv;
26439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26440 this_ptr_conv.is_owned = false;
26441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26442 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
26446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26447 LDKUserConfig this_ptr_conv;
26448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26449 this_ptr_conv.is_owned = false;
26450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26451 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
26454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26455 LDKUserConfig this_ptr_conv;
26456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26457 this_ptr_conv.is_owned = false;
26458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26459 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
26463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26464 LDKUserConfig this_ptr_conv;
26465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26466 this_ptr_conv.is_owned = false;
26467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26468 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
26471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
26472 LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
26473 channel_handshake_config_arg_conv.inner = (void*)(channel_handshake_config_arg & (~1));
26474 channel_handshake_config_arg_conv.is_owned = (channel_handshake_config_arg & 1) || (channel_handshake_config_arg == 0);
26475 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
26476 channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
26477 LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
26478 channel_handshake_limits_arg_conv.inner = (void*)(channel_handshake_limits_arg & (~1));
26479 channel_handshake_limits_arg_conv.is_owned = (channel_handshake_limits_arg & 1) || (channel_handshake_limits_arg == 0);
26480 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
26481 channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
26482 LDKChannelConfig channel_config_arg_conv;
26483 channel_config_arg_conv.inner = (void*)(channel_config_arg & (~1));
26484 channel_config_arg_conv.is_owned = (channel_config_arg & 1) || (channel_config_arg == 0);
26485 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
26486 channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
26487 LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
26488 int64_t ret_ref = 0;
26489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26492 ret_ref = (uintptr_t)ret_var.inner;
26493 if (ret_var.is_owned) {
26499 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
26500 LDKUserConfig ret_var = UserConfig_clone(arg);
26501 int64_t ret_ref = 0;
26502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26505 ret_ref = (uintptr_t)ret_var.inner;
26506 if (ret_var.is_owned) {
26511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26512 LDKUserConfig arg_conv;
26513 arg_conv.inner = (void*)(arg & (~1));
26514 arg_conv.is_owned = false;
26515 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26516 int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
26520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26521 LDKUserConfig orig_conv;
26522 orig_conv.inner = (void*)(orig & (~1));
26523 orig_conv.is_owned = false;
26524 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26525 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
26526 int64_t ret_ref = 0;
26527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26530 ret_ref = (uintptr_t)ret_var.inner;
26531 if (ret_var.is_owned) {
26537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
26538 LDKUserConfig ret_var = UserConfig_default();
26539 int64_t ret_ref = 0;
26540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26543 ret_ref = (uintptr_t)ret_var.inner;
26544 if (ret_var.is_owned) {
26550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26551 LDKBestBlock this_obj_conv;
26552 this_obj_conv.inner = (void*)(this_obj & (~1));
26553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26555 BestBlock_free(this_obj_conv);
26558 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
26559 LDKBestBlock ret_var = BestBlock_clone(arg);
26560 int64_t ret_ref = 0;
26561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26564 ret_ref = (uintptr_t)ret_var.inner;
26565 if (ret_var.is_owned) {
26570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26571 LDKBestBlock arg_conv;
26572 arg_conv.inner = (void*)(arg & (~1));
26573 arg_conv.is_owned = false;
26574 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26575 int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
26579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26580 LDKBestBlock orig_conv;
26581 orig_conv.inner = (void*)(orig & (~1));
26582 orig_conv.is_owned = false;
26583 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26584 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
26585 int64_t ret_ref = 0;
26586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26589 ret_ref = (uintptr_t)ret_var.inner;
26590 if (ret_var.is_owned) {
26596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
26597 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
26598 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
26599 int64_t ret_ref = 0;
26600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26603 ret_ref = (uintptr_t)ret_var.inner;
26604 if (ret_var.is_owned) {
26610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
26611 LDKThirtyTwoBytes block_hash_ref;
26612 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
26613 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
26614 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
26615 int64_t ret_ref = 0;
26616 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26617 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26619 ret_ref = (uintptr_t)ret_var.inner;
26620 if (ret_var.is_owned) {
26626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
26627 LDKBestBlock this_arg_conv;
26628 this_arg_conv.inner = (void*)(this_arg & (~1));
26629 this_arg_conv.is_owned = false;
26630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26631 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26632 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
26636 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
26637 LDKBestBlock this_arg_conv;
26638 this_arg_conv.inner = (void*)(this_arg & (~1));
26639 this_arg_conv.is_owned = false;
26640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26641 int32_t ret_conv = BestBlock_height(&this_arg_conv);
26645 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26646 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
26647 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
26651 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
26652 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
26656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
26657 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
26661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26662 if ((this_ptr & 1) != 0) return;
26663 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26664 CHECK_ACCESS(this_ptr_ptr);
26665 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
26666 FREE((void*)this_ptr);
26667 Access_free(this_ptr_conv);
26670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26671 if ((this_ptr & 1) != 0) return;
26672 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26673 CHECK_ACCESS(this_ptr_ptr);
26674 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
26675 FREE((void*)this_ptr);
26676 Listen_free(this_ptr_conv);
26679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26680 if ((this_ptr & 1) != 0) return;
26681 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26682 CHECK_ACCESS(this_ptr_ptr);
26683 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
26684 FREE((void*)this_ptr);
26685 Confirm_free(this_ptr_conv);
26688 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26689 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
26690 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
26694 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
26695 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
26699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
26700 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
26704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26705 if ((this_ptr & 1) != 0) return;
26706 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26707 CHECK_ACCESS(this_ptr_ptr);
26708 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
26709 FREE((void*)this_ptr);
26710 Watch_free(this_ptr_conv);
26713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26714 if ((this_ptr & 1) != 0) return;
26715 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26716 CHECK_ACCESS(this_ptr_ptr);
26717 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
26718 FREE((void*)this_ptr);
26719 Filter_free(this_ptr_conv);
26722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26723 LDKWatchedOutput this_obj_conv;
26724 this_obj_conv.inner = (void*)(this_obj & (~1));
26725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26727 WatchedOutput_free(this_obj_conv);
26730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
26731 LDKWatchedOutput this_ptr_conv;
26732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26733 this_ptr_conv.is_owned = false;
26734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26735 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
26740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26741 LDKWatchedOutput this_ptr_conv;
26742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26743 this_ptr_conv.is_owned = false;
26744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26745 LDKThirtyTwoBytes val_ref;
26746 CHECK((*env)->GetArrayLength(env, val) == 32);
26747 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26748 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
26751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26752 LDKWatchedOutput this_ptr_conv;
26753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26754 this_ptr_conv.is_owned = false;
26755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26756 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
26757 int64_t ret_ref = 0;
26758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26761 ret_ref = (uintptr_t)ret_var.inner;
26762 if (ret_var.is_owned) {
26768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26769 LDKWatchedOutput this_ptr_conv;
26770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26771 this_ptr_conv.is_owned = false;
26772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26773 LDKOutPoint val_conv;
26774 val_conv.inner = (void*)(val & (~1));
26775 val_conv.is_owned = (val & 1) || (val == 0);
26776 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26777 val_conv = OutPoint_clone(&val_conv);
26778 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
26781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26782 LDKWatchedOutput this_ptr_conv;
26783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26784 this_ptr_conv.is_owned = false;
26785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26786 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
26787 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26788 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26793 LDKWatchedOutput this_ptr_conv;
26794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26795 this_ptr_conv.is_owned = false;
26796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26797 LDKCVec_u8Z val_ref;
26798 val_ref.datalen = (*env)->GetArrayLength(env, val);
26799 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26800 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26801 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
26804 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) {
26805 LDKThirtyTwoBytes block_hash_arg_ref;
26806 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
26807 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
26808 LDKOutPoint outpoint_arg_conv;
26809 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26810 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26811 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26812 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26813 LDKCVec_u8Z script_pubkey_arg_ref;
26814 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
26815 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26816 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
26817 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
26818 int64_t ret_ref = 0;
26819 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26820 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26822 ret_ref = (uintptr_t)ret_var.inner;
26823 if (ret_var.is_owned) {
26829 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
26830 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
26831 int64_t ret_ref = 0;
26832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26835 ret_ref = (uintptr_t)ret_var.inner;
26836 if (ret_var.is_owned) {
26841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26842 LDKWatchedOutput arg_conv;
26843 arg_conv.inner = (void*)(arg & (~1));
26844 arg_conv.is_owned = false;
26845 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26846 int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
26850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26851 LDKWatchedOutput orig_conv;
26852 orig_conv.inner = (void*)(orig & (~1));
26853 orig_conv.is_owned = false;
26854 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26855 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
26856 int64_t ret_ref = 0;
26857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26860 ret_ref = (uintptr_t)ret_var.inner;
26861 if (ret_var.is_owned) {
26867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
26868 LDKWatchedOutput o_conv;
26869 o_conv.inner = (void*)(o & (~1));
26870 o_conv.is_owned = false;
26871 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26872 int64_t ret_conv = WatchedOutput_hash(&o_conv);
26876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26877 if ((this_ptr & 1) != 0) return;
26878 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26879 CHECK_ACCESS(this_ptr_ptr);
26880 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
26881 FREE((void*)this_ptr);
26882 BroadcasterInterface_free(this_ptr_conv);
26885 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26886 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
26887 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
26891 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
26892 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
26896 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
26897 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
26901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
26902 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
26906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26907 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
26908 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
26909 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
26913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26914 if ((this_ptr & 1) != 0) return;
26915 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26916 CHECK_ACCESS(this_ptr_ptr);
26917 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
26918 FREE((void*)this_ptr);
26919 FeeEstimator_free(this_ptr_conv);
26922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26923 LDKMonitorUpdateId this_obj_conv;
26924 this_obj_conv.inner = (void*)(this_obj & (~1));
26925 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26927 MonitorUpdateId_free(this_obj_conv);
26930 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
26931 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
26932 int64_t ret_ref = 0;
26933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26936 ret_ref = (uintptr_t)ret_var.inner;
26937 if (ret_var.is_owned) {
26942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26943 LDKMonitorUpdateId arg_conv;
26944 arg_conv.inner = (void*)(arg & (~1));
26945 arg_conv.is_owned = false;
26946 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26947 int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
26951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26952 LDKMonitorUpdateId orig_conv;
26953 orig_conv.inner = (void*)(orig & (~1));
26954 orig_conv.is_owned = false;
26955 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26956 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
26957 int64_t ret_ref = 0;
26958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26961 ret_ref = (uintptr_t)ret_var.inner;
26962 if (ret_var.is_owned) {
26968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
26969 LDKMonitorUpdateId o_conv;
26970 o_conv.inner = (void*)(o & (~1));
26971 o_conv.is_owned = false;
26972 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26973 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
26977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26978 LDKMonitorUpdateId a_conv;
26979 a_conv.inner = (void*)(a & (~1));
26980 a_conv.is_owned = false;
26981 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26982 LDKMonitorUpdateId b_conv;
26983 b_conv.inner = (void*)(b & (~1));
26984 b_conv.is_owned = false;
26985 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26986 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
26990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26991 if ((this_ptr & 1) != 0) return;
26992 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26993 CHECK_ACCESS(this_ptr_ptr);
26994 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
26995 FREE((void*)this_ptr);
26996 Persist_free(this_ptr_conv);
26999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27000 LDKLockedChannelMonitor this_obj_conv;
27001 this_obj_conv.inner = (void*)(this_obj & (~1));
27002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27004 LockedChannelMonitor_free(this_obj_conv);
27007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27008 LDKChainMonitor this_obj_conv;
27009 this_obj_conv.inner = (void*)(this_obj & (~1));
27010 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27012 ChainMonitor_free(this_obj_conv);
27015 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) {
27016 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
27017 CHECK_ACCESS(chain_source_ptr);
27018 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
27019 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
27020 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
27021 // Manually implement clone for Java trait instances
27022 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
27023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27024 LDKFilter_JCalls_cloned(&chain_source_conv.some);
27027 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27028 CHECK_ACCESS(broadcaster_ptr);
27029 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27030 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27031 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27032 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27034 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27035 CHECK_ACCESS(logger_ptr);
27036 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27037 if (logger_conv.free == LDKLogger_JCalls_free) {
27038 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27039 LDKLogger_JCalls_cloned(&logger_conv);
27041 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
27042 CHECK_ACCESS(feeest_ptr);
27043 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
27044 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
27045 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27046 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
27048 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
27049 CHECK_ACCESS(persister_ptr);
27050 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
27051 if (persister_conv.free == LDKPersist_JCalls_free) {
27052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27053 LDKPersist_JCalls_cloned(&persister_conv);
27055 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
27056 int64_t ret_ref = 0;
27057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27060 ret_ref = (uintptr_t)ret_var.inner;
27061 if (ret_var.is_owned) {
27067 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) {
27068 LDKChainMonitor this_arg_conv;
27069 this_arg_conv.inner = (void*)(this_arg & (~1));
27070 this_arg_conv.is_owned = false;
27071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27072 LDKCVec_ChannelDetailsZ ignored_channels_constr;
27073 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
27074 if (ignored_channels_constr.datalen > 0)
27075 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27077 ignored_channels_constr.data = NULL;
27078 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
27079 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
27080 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
27081 LDKChannelDetails ignored_channels_conv_16_conv;
27082 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
27083 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
27084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
27085 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
27086 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
27088 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
27089 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
27090 int64_tArray ret_arr = NULL;
27091 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27092 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27093 for (size_t j = 0; j < ret_var.datalen; j++) {
27094 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27095 *ret_conv_9_copy = ret_var.data[j];
27096 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
27097 ret_arr_ptr[j] = ret_conv_9_ref;
27099 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27100 FREE(ret_var.data);
27104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
27105 LDKChainMonitor this_arg_conv;
27106 this_arg_conv.inner = (void*)(this_arg & (~1));
27107 this_arg_conv.is_owned = false;
27108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27109 LDKOutPoint funding_txo_conv;
27110 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27111 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27112 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27113 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27114 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
27115 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
27116 return (int64_t)ret_conv;
27119 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
27120 LDKChainMonitor this_arg_conv;
27121 this_arg_conv.inner = (void*)(this_arg & (~1));
27122 this_arg_conv.is_owned = false;
27123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27124 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
27125 int64_tArray ret_arr = NULL;
27126 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27127 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27128 for (size_t k = 0; k < ret_var.datalen; k++) {
27129 LDKOutPoint ret_conv_10_var = ret_var.data[k];
27130 int64_t ret_conv_10_ref = 0;
27131 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27132 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
27134 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
27135 if (ret_conv_10_var.is_owned) {
27136 ret_conv_10_ref |= 1;
27138 ret_arr_ptr[k] = ret_conv_10_ref;
27140 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27141 FREE(ret_var.data);
27145 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) {
27146 LDKChainMonitor this_arg_conv;
27147 this_arg_conv.inner = (void*)(this_arg & (~1));
27148 this_arg_conv.is_owned = false;
27149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27150 LDKOutPoint funding_txo_conv;
27151 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27152 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27154 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27155 LDKMonitorUpdateId completed_update_id_conv;
27156 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
27157 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
27158 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
27159 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
27160 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27161 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
27162 return (int64_t)ret_conv;
27165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
27166 LDKChainMonitor this_arg_conv;
27167 this_arg_conv.inner = (void*)(this_arg & (~1));
27168 this_arg_conv.is_owned = false;
27169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27170 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27171 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
27172 return (int64_t)ret_ret;
27175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
27176 LDKChainMonitor this_arg_conv;
27177 this_arg_conv.inner = (void*)(this_arg & (~1));
27178 this_arg_conv.is_owned = false;
27179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27180 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27181 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
27182 return (int64_t)ret_ret;
27185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
27186 LDKChainMonitor this_arg_conv;
27187 this_arg_conv.inner = (void*)(this_arg & (~1));
27188 this_arg_conv.is_owned = false;
27189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27190 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
27191 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
27192 return (int64_t)ret_ret;
27195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27196 LDKChainMonitor this_arg_conv;
27197 this_arg_conv.inner = (void*)(this_arg & (~1));
27198 this_arg_conv.is_owned = false;
27199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27200 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27201 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
27202 return (int64_t)ret_ret;
27205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27206 LDKChannelMonitorUpdate this_obj_conv;
27207 this_obj_conv.inner = (void*)(this_obj & (~1));
27208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27210 ChannelMonitorUpdate_free(this_obj_conv);
27213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27214 LDKChannelMonitorUpdate this_ptr_conv;
27215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27216 this_ptr_conv.is_owned = false;
27217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27218 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
27222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27223 LDKChannelMonitorUpdate this_ptr_conv;
27224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27225 this_ptr_conv.is_owned = false;
27226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27227 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
27230 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
27231 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
27232 int64_t ret_ref = 0;
27233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27236 ret_ref = (uintptr_t)ret_var.inner;
27237 if (ret_var.is_owned) {
27242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27243 LDKChannelMonitorUpdate arg_conv;
27244 arg_conv.inner = (void*)(arg & (~1));
27245 arg_conv.is_owned = false;
27246 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27247 int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
27251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27252 LDKChannelMonitorUpdate orig_conv;
27253 orig_conv.inner = (void*)(orig & (~1));
27254 orig_conv.is_owned = false;
27255 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27256 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
27257 int64_t ret_ref = 0;
27258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27261 ret_ref = (uintptr_t)ret_var.inner;
27262 if (ret_var.is_owned) {
27268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27269 LDKChannelMonitorUpdate obj_conv;
27270 obj_conv.inner = (void*)(obj & (~1));
27271 obj_conv.is_owned = false;
27272 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27273 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
27274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27276 CVec_u8Z_free(ret_var);
27280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27281 LDKu8slice ser_ref;
27282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27284 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27285 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
27286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27287 return (int64_t)ret_conv;
27290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27291 if ((this_ptr & 1) != 0) return;
27292 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27293 CHECK_ACCESS(this_ptr_ptr);
27294 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
27295 FREE((void*)this_ptr);
27296 MonitorEvent_free(this_ptr_conv);
27299 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
27300 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27301 *ret_copy = MonitorEvent_clone(arg);
27302 int64_t ret_ref = (uintptr_t)ret_copy;
27305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27306 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
27307 int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
27311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27312 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
27313 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27314 *ret_copy = MonitorEvent_clone(orig_conv);
27315 int64_t ret_ref = (uintptr_t)ret_copy;
27319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
27320 LDKHTLCUpdate a_conv;
27321 a_conv.inner = (void*)(a & (~1));
27322 a_conv.is_owned = (a & 1) || (a == 0);
27323 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27324 a_conv = HTLCUpdate_clone(&a_conv);
27325 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27326 *ret_copy = MonitorEvent_htlcevent(a_conv);
27327 int64_t ret_ref = (uintptr_t)ret_copy;
27331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
27332 LDKOutPoint a_conv;
27333 a_conv.inner = (void*)(a & (~1));
27334 a_conv.is_owned = (a & 1) || (a == 0);
27335 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27336 a_conv = OutPoint_clone(&a_conv);
27337 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27338 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
27339 int64_t ret_ref = (uintptr_t)ret_copy;
27343 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) {
27344 LDKOutPoint funding_txo_conv;
27345 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27346 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27347 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27348 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27349 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27350 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
27351 int64_t ret_ref = (uintptr_t)ret_copy;
27355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
27356 LDKOutPoint a_conv;
27357 a_conv.inner = (void*)(a & (~1));
27358 a_conv.is_owned = (a & 1) || (a == 0);
27359 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27360 a_conv = OutPoint_clone(&a_conv);
27361 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27362 *ret_copy = MonitorEvent_update_failed(a_conv);
27363 int64_t ret_ref = (uintptr_t)ret_copy;
27367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
27368 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
27369 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
27370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27372 CVec_u8Z_free(ret_var);
27376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27377 LDKu8slice ser_ref;
27378 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27379 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27380 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27381 *ret_conv = MonitorEvent_read(ser_ref);
27382 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27383 return (int64_t)ret_conv;
27386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27387 LDKHTLCUpdate this_obj_conv;
27388 this_obj_conv.inner = (void*)(this_obj & (~1));
27389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27391 HTLCUpdate_free(this_obj_conv);
27394 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
27395 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
27396 int64_t ret_ref = 0;
27397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27400 ret_ref = (uintptr_t)ret_var.inner;
27401 if (ret_var.is_owned) {
27406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27407 LDKHTLCUpdate arg_conv;
27408 arg_conv.inner = (void*)(arg & (~1));
27409 arg_conv.is_owned = false;
27410 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27411 int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
27415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27416 LDKHTLCUpdate orig_conv;
27417 orig_conv.inner = (void*)(orig & (~1));
27418 orig_conv.is_owned = false;
27419 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27420 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
27421 int64_t ret_ref = 0;
27422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27425 ret_ref = (uintptr_t)ret_var.inner;
27426 if (ret_var.is_owned) {
27432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27433 LDKHTLCUpdate obj_conv;
27434 obj_conv.inner = (void*)(obj & (~1));
27435 obj_conv.is_owned = false;
27436 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27437 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
27438 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27439 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27440 CVec_u8Z_free(ret_var);
27444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27445 LDKu8slice ser_ref;
27446 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27447 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27448 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27449 *ret_conv = HTLCUpdate_read(ser_ref);
27450 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27451 return (int64_t)ret_conv;
27454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27455 if ((this_ptr & 1) != 0) return;
27456 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27457 CHECK_ACCESS(this_ptr_ptr);
27458 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
27459 FREE((void*)this_ptr);
27460 Balance_free(this_ptr_conv);
27463 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
27464 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27465 *ret_copy = Balance_clone(arg);
27466 int64_t ret_ref = (uintptr_t)ret_copy;
27469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27470 LDKBalance* arg_conv = (LDKBalance*)arg;
27471 int64_t ret_conv = Balance_clone_ptr(arg_conv);
27475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27476 LDKBalance* orig_conv = (LDKBalance*)orig;
27477 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27478 *ret_copy = Balance_clone(orig_conv);
27479 int64_t ret_ref = (uintptr_t)ret_copy;
27483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
27484 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27485 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
27486 int64_t ret_ref = (uintptr_t)ret_copy;
27490 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) {
27491 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27492 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
27493 int64_t ret_ref = (uintptr_t)ret_copy;
27497 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) {
27498 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27499 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
27500 int64_t ret_ref = (uintptr_t)ret_copy;
27504 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) {
27505 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27506 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
27507 int64_t ret_ref = (uintptr_t)ret_copy;
27511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27512 LDKBalance* a_conv = (LDKBalance*)a;
27513 LDKBalance* b_conv = (LDKBalance*)b;
27514 jboolean ret_conv = Balance_eq(a_conv, b_conv);
27518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27519 LDKChannelMonitor this_obj_conv;
27520 this_obj_conv.inner = (void*)(this_obj & (~1));
27521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27523 ChannelMonitor_free(this_obj_conv);
27526 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
27527 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
27528 int64_t ret_ref = 0;
27529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27532 ret_ref = (uintptr_t)ret_var.inner;
27533 if (ret_var.is_owned) {
27538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27539 LDKChannelMonitor arg_conv;
27540 arg_conv.inner = (void*)(arg & (~1));
27541 arg_conv.is_owned = false;
27542 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27543 int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
27547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27548 LDKChannelMonitor orig_conv;
27549 orig_conv.inner = (void*)(orig & (~1));
27550 orig_conv.is_owned = false;
27551 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27552 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
27553 int64_t ret_ref = 0;
27554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27557 ret_ref = (uintptr_t)ret_var.inner;
27558 if (ret_var.is_owned) {
27564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27565 LDKChannelMonitor obj_conv;
27566 obj_conv.inner = (void*)(obj & (~1));
27567 obj_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27569 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
27570 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27571 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27572 CVec_u8Z_free(ret_var);
27576 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) {
27577 LDKChannelMonitor this_arg_conv;
27578 this_arg_conv.inner = (void*)(this_arg & (~1));
27579 this_arg_conv.is_owned = false;
27580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27581 LDKChannelMonitorUpdate updates_conv;
27582 updates_conv.inner = (void*)(updates & (~1));
27583 updates_conv.is_owned = false;
27584 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
27585 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27586 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
27587 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
27588 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27589 CHECK_ACCESS(fee_estimator_ptr);
27590 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27591 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27592 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27593 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27595 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27596 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
27597 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
27598 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
27599 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
27600 return (int64_t)ret_conv;
27603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27604 LDKChannelMonitor this_arg_conv;
27605 this_arg_conv.inner = (void*)(this_arg & (~1));
27606 this_arg_conv.is_owned = false;
27607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27608 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
27612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
27613 LDKChannelMonitor this_arg_conv;
27614 this_arg_conv.inner = (void*)(this_arg & (~1));
27615 this_arg_conv.is_owned = false;
27616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27617 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
27618 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
27619 return ((int64_t)ret_conv);
27622 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
27623 LDKChannelMonitor this_arg_conv;
27624 this_arg_conv.inner = (void*)(this_arg & (~1));
27625 this_arg_conv.is_owned = false;
27626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27627 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
27628 int64_tArray ret_arr = NULL;
27629 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27630 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27631 for (size_t o = 0; o < ret_var.datalen; o++) {
27632 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
27633 *ret_conv_40_conv = ret_var.data[o];
27634 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
27636 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27637 FREE(ret_var.data);
27641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
27642 LDKChannelMonitor this_arg_conv;
27643 this_arg_conv.inner = (void*)(this_arg & (~1));
27644 this_arg_conv.is_owned = false;
27645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27646 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
27647 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
27648 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
27649 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
27652 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27653 LDKChannelMonitor this_arg_conv;
27654 this_arg_conv.inner = (void*)(this_arg & (~1));
27655 this_arg_conv.is_owned = false;
27656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27657 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
27658 int64_tArray ret_arr = NULL;
27659 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27660 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27661 for (size_t o = 0; o < ret_var.datalen; o++) {
27662 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27663 *ret_conv_14_copy = ret_var.data[o];
27664 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
27665 ret_arr_ptr[o] = ret_conv_14_ref;
27667 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27668 FREE(ret_var.data);
27672 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27673 LDKChannelMonitor this_arg_conv;
27674 this_arg_conv.inner = (void*)(this_arg & (~1));
27675 this_arg_conv.is_owned = false;
27676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27677 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
27678 int64_tArray ret_arr = NULL;
27679 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27680 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27681 for (size_t h = 0; h < ret_var.datalen; h++) {
27682 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
27683 *ret_conv_7_copy = ret_var.data[h];
27684 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
27685 ret_arr_ptr[h] = ret_conv_7_ref;
27687 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27688 FREE(ret_var.data);
27692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27693 LDKChannelMonitor this_arg_conv;
27694 this_arg_conv.inner = (void*)(this_arg & (~1));
27695 this_arg_conv.is_owned = false;
27696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27697 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27698 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
27702 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) {
27703 LDKChannelMonitor this_arg_conv;
27704 this_arg_conv.inner = (void*)(this_arg & (~1));
27705 this_arg_conv.is_owned = false;
27706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27707 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27708 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
27709 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
27710 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
27711 jobjectArray ret_arr = NULL;
27712 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27714 for (size_t i = 0; i < ret_var.datalen; i++) {
27715 LDKTransaction ret_conv_8_var = ret_var.data[i];
27716 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
27717 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
27718 Transaction_free(ret_conv_8_var);
27719 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27722 FREE(ret_var.data);
27726 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) {
27727 LDKChannelMonitor this_arg_conv;
27728 this_arg_conv.inner = (void*)(this_arg & (~1));
27729 this_arg_conv.is_owned = false;
27730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27731 unsigned char header_arr[80];
27732 CHECK((*env)->GetArrayLength(env, header) == 80);
27733 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27734 unsigned char (*header_ref)[80] = &header_arr;
27735 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27736 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27737 if (txdata_constr.datalen > 0)
27738 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27740 txdata_constr.data = NULL;
27741 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27742 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27743 int64_t txdata_conv_28 = txdata_vals[c];
27744 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27745 CHECK_ACCESS(txdata_conv_28_ptr);
27746 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27747 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27748 txdata_constr.data[c] = txdata_conv_28_conv;
27750 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27751 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27752 CHECK_ACCESS(broadcaster_ptr);
27753 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27754 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27755 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27756 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27758 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27759 CHECK_ACCESS(fee_estimator_ptr);
27760 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27761 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27762 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27763 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27765 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27766 CHECK_ACCESS(logger_ptr);
27767 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27768 if (logger_conv.free == LDKLogger_JCalls_free) {
27769 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27770 LDKLogger_JCalls_cloned(&logger_conv);
27772 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);
27773 int64_tArray ret_arr = NULL;
27774 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27775 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27776 for (size_t n = 0; n < ret_var.datalen; n++) {
27777 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27778 *ret_conv_39_conv = ret_var.data[n];
27779 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27781 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27782 FREE(ret_var.data);
27786 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) {
27787 LDKChannelMonitor this_arg_conv;
27788 this_arg_conv.inner = (void*)(this_arg & (~1));
27789 this_arg_conv.is_owned = false;
27790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27791 unsigned char header_arr[80];
27792 CHECK((*env)->GetArrayLength(env, header) == 80);
27793 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27794 unsigned char (*header_ref)[80] = &header_arr;
27795 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27796 CHECK_ACCESS(broadcaster_ptr);
27797 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27798 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27799 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27800 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27802 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27803 CHECK_ACCESS(fee_estimator_ptr);
27804 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27805 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27806 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27807 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27809 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27810 CHECK_ACCESS(logger_ptr);
27811 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27812 if (logger_conv.free == LDKLogger_JCalls_free) {
27813 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27814 LDKLogger_JCalls_cloned(&logger_conv);
27816 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27819 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) {
27820 LDKChannelMonitor this_arg_conv;
27821 this_arg_conv.inner = (void*)(this_arg & (~1));
27822 this_arg_conv.is_owned = false;
27823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27824 unsigned char header_arr[80];
27825 CHECK((*env)->GetArrayLength(env, header) == 80);
27826 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27827 unsigned char (*header_ref)[80] = &header_arr;
27828 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27829 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27830 if (txdata_constr.datalen > 0)
27831 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27833 txdata_constr.data = NULL;
27834 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27835 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27836 int64_t txdata_conv_28 = txdata_vals[c];
27837 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27838 CHECK_ACCESS(txdata_conv_28_ptr);
27839 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27840 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27841 txdata_constr.data[c] = txdata_conv_28_conv;
27843 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27844 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27845 CHECK_ACCESS(broadcaster_ptr);
27846 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27847 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27848 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27849 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27851 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27852 CHECK_ACCESS(fee_estimator_ptr);
27853 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27854 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27855 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27856 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27858 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27859 CHECK_ACCESS(logger_ptr);
27860 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27861 if (logger_conv.free == LDKLogger_JCalls_free) {
27862 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27863 LDKLogger_JCalls_cloned(&logger_conv);
27865 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);
27866 int64_tArray ret_arr = NULL;
27867 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27868 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27869 for (size_t n = 0; n < ret_var.datalen; n++) {
27870 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27871 *ret_conv_39_conv = ret_var.data[n];
27872 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27874 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27875 FREE(ret_var.data);
27879 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) {
27880 LDKChannelMonitor this_arg_conv;
27881 this_arg_conv.inner = (void*)(this_arg & (~1));
27882 this_arg_conv.is_owned = false;
27883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27884 unsigned char txid_arr[32];
27885 CHECK((*env)->GetArrayLength(env, txid) == 32);
27886 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
27887 unsigned char (*txid_ref)[32] = &txid_arr;
27888 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27889 CHECK_ACCESS(broadcaster_ptr);
27890 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27891 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27892 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27893 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27895 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27896 CHECK_ACCESS(fee_estimator_ptr);
27897 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27898 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27899 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27900 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27902 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27903 CHECK_ACCESS(logger_ptr);
27904 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27905 if (logger_conv.free == LDKLogger_JCalls_free) {
27906 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27907 LDKLogger_JCalls_cloned(&logger_conv);
27909 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
27912 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) {
27913 LDKChannelMonitor this_arg_conv;
27914 this_arg_conv.inner = (void*)(this_arg & (~1));
27915 this_arg_conv.is_owned = false;
27916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27917 unsigned char header_arr[80];
27918 CHECK((*env)->GetArrayLength(env, header) == 80);
27919 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27920 unsigned char (*header_ref)[80] = &header_arr;
27921 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27922 CHECK_ACCESS(broadcaster_ptr);
27923 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27924 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27926 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27928 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27929 CHECK_ACCESS(fee_estimator_ptr);
27930 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27931 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27932 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27933 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27935 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27936 CHECK_ACCESS(logger_ptr);
27937 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27938 if (logger_conv.free == LDKLogger_JCalls_free) {
27939 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27940 LDKLogger_JCalls_cloned(&logger_conv);
27942 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27943 int64_tArray ret_arr = NULL;
27944 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27945 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27946 for (size_t n = 0; n < ret_var.datalen; n++) {
27947 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27948 *ret_conv_39_conv = ret_var.data[n];
27949 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27951 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27952 FREE(ret_var.data);
27956 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
27957 LDKChannelMonitor this_arg_conv;
27958 this_arg_conv.inner = (void*)(this_arg & (~1));
27959 this_arg_conv.is_owned = false;
27960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27961 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
27962 jobjectArray ret_arr = NULL;
27963 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27965 for (size_t i = 0; i < ret_var.datalen; i++) {
27966 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
27967 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
27968 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27971 FREE(ret_var.data);
27975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
27976 LDKChannelMonitor this_arg_conv;
27977 this_arg_conv.inner = (void*)(this_arg & (~1));
27978 this_arg_conv.is_owned = false;
27979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27980 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
27981 int64_t ret_ref = 0;
27982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27985 ret_ref = (uintptr_t)ret_var.inner;
27986 if (ret_var.is_owned) {
27992 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
27993 LDKChannelMonitor this_arg_conv;
27994 this_arg_conv.inner = (void*)(this_arg & (~1));
27995 this_arg_conv.is_owned = false;
27996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27997 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
27998 int64_tArray ret_arr = NULL;
27999 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28000 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28001 for (size_t j = 0; j < ret_var.datalen; j++) {
28002 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28003 *ret_conv_9_copy = ret_var.data[j];
28004 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
28005 ret_arr_ptr[j] = ret_conv_9_ref;
28007 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28008 FREE(ret_var.data);
28012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
28013 LDKu8slice ser_ref;
28014 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28015 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28016 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
28017 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28018 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
28019 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
28020 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
28021 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28022 return (int64_t)ret_conv;
28025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28026 LDKOutPoint this_obj_conv;
28027 this_obj_conv.inner = (void*)(this_obj & (~1));
28028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28030 OutPoint_free(this_obj_conv);
28033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28034 LDKOutPoint this_ptr_conv;
28035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28036 this_ptr_conv.is_owned = false;
28037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28038 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28039 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
28043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28044 LDKOutPoint this_ptr_conv;
28045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28046 this_ptr_conv.is_owned = false;
28047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28048 LDKThirtyTwoBytes val_ref;
28049 CHECK((*env)->GetArrayLength(env, val) == 32);
28050 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28051 OutPoint_set_txid(&this_ptr_conv, val_ref);
28054 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
28055 LDKOutPoint this_ptr_conv;
28056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28057 this_ptr_conv.is_owned = false;
28058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28059 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
28063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28064 LDKOutPoint this_ptr_conv;
28065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28066 this_ptr_conv.is_owned = false;
28067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28068 OutPoint_set_index(&this_ptr_conv, val);
28071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
28072 LDKThirtyTwoBytes txid_arg_ref;
28073 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
28074 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
28075 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
28076 int64_t ret_ref = 0;
28077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28080 ret_ref = (uintptr_t)ret_var.inner;
28081 if (ret_var.is_owned) {
28087 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
28088 LDKOutPoint ret_var = OutPoint_clone(arg);
28089 int64_t ret_ref = 0;
28090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28093 ret_ref = (uintptr_t)ret_var.inner;
28094 if (ret_var.is_owned) {
28099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28100 LDKOutPoint arg_conv;
28101 arg_conv.inner = (void*)(arg & (~1));
28102 arg_conv.is_owned = false;
28103 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28104 int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
28108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28109 LDKOutPoint orig_conv;
28110 orig_conv.inner = (void*)(orig & (~1));
28111 orig_conv.is_owned = false;
28112 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28113 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
28114 int64_t ret_ref = 0;
28115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28118 ret_ref = (uintptr_t)ret_var.inner;
28119 if (ret_var.is_owned) {
28125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28126 LDKOutPoint a_conv;
28127 a_conv.inner = (void*)(a & (~1));
28128 a_conv.is_owned = false;
28129 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28130 LDKOutPoint b_conv;
28131 b_conv.inner = (void*)(b & (~1));
28132 b_conv.is_owned = false;
28133 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28134 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
28138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
28139 LDKOutPoint o_conv;
28140 o_conv.inner = (void*)(o & (~1));
28141 o_conv.is_owned = false;
28142 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28143 int64_t ret_conv = OutPoint_hash(&o_conv);
28147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28148 LDKOutPoint this_arg_conv;
28149 this_arg_conv.inner = (void*)(this_arg & (~1));
28150 this_arg_conv.is_owned = false;
28151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28152 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28153 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
28157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
28158 LDKOutPoint obj_conv;
28159 obj_conv.inner = (void*)(obj & (~1));
28160 obj_conv.is_owned = false;
28161 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28162 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
28163 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28164 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28165 CVec_u8Z_free(ret_var);
28169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28170 LDKu8slice ser_ref;
28171 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28172 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28173 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28174 *ret_conv = OutPoint_read(ser_ref);
28175 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28176 return (int64_t)ret_conv;
28179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28180 LDKDelayedPaymentOutputDescriptor this_obj_conv;
28181 this_obj_conv.inner = (void*)(this_obj & (~1));
28182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28184 DelayedPaymentOutputDescriptor_free(this_obj_conv);
28187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28188 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28190 this_ptr_conv.is_owned = false;
28191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28192 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28193 int64_t ret_ref = 0;
28194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28197 ret_ref = (uintptr_t)ret_var.inner;
28198 if (ret_var.is_owned) {
28204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28205 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28207 this_ptr_conv.is_owned = false;
28208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28209 LDKOutPoint val_conv;
28210 val_conv.inner = (void*)(val & (~1));
28211 val_conv.is_owned = (val & 1) || (val == 0);
28212 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28213 val_conv = OutPoint_clone(&val_conv);
28214 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28218 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28220 this_ptr_conv.is_owned = false;
28221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28222 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
28227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28228 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28230 this_ptr_conv.is_owned = false;
28231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28232 LDKPublicKey val_ref;
28233 CHECK((*env)->GetArrayLength(env, val) == 33);
28234 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28235 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
28238 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28239 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28241 this_ptr_conv.is_owned = false;
28242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28243 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
28247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28248 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28250 this_ptr_conv.is_owned = false;
28251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28252 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
28255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28256 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28258 this_ptr_conv.is_owned = false;
28259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28260 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28261 *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
28262 return (int64_t)ret_ref;
28265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28266 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28268 this_ptr_conv.is_owned = false;
28269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28270 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28271 CHECK_ACCESS(val_ptr);
28272 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
28273 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
28274 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
28277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28278 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28280 this_ptr_conv.is_owned = false;
28281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28282 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28283 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
28287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28288 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28290 this_ptr_conv.is_owned = false;
28291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28292 LDKPublicKey val_ref;
28293 CHECK((*env)->GetArrayLength(env, val) == 33);
28294 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28295 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
28298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28299 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28301 this_ptr_conv.is_owned = false;
28302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
28308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28309 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28311 this_ptr_conv.is_owned = false;
28312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28313 LDKThirtyTwoBytes val_ref;
28314 CHECK((*env)->GetArrayLength(env, val) == 32);
28315 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28316 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
28319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28320 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28322 this_ptr_conv.is_owned = false;
28323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28324 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
28328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28329 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28331 this_ptr_conv.is_owned = false;
28332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28333 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
28336 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) {
28337 LDKOutPoint outpoint_arg_conv;
28338 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
28339 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
28340 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
28341 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
28342 LDKPublicKey per_commitment_point_arg_ref;
28343 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
28344 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
28345 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
28346 CHECK_ACCESS(output_arg_ptr);
28347 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
28348 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
28349 LDKPublicKey revocation_pubkey_arg_ref;
28350 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
28351 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
28352 LDKThirtyTwoBytes channel_keys_id_arg_ref;
28353 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
28354 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
28355 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);
28356 int64_t ret_ref = 0;
28357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28360 ret_ref = (uintptr_t)ret_var.inner;
28361 if (ret_var.is_owned) {
28367 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
28368 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
28369 int64_t ret_ref = 0;
28370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28373 ret_ref = (uintptr_t)ret_var.inner;
28374 if (ret_var.is_owned) {
28379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28380 LDKDelayedPaymentOutputDescriptor arg_conv;
28381 arg_conv.inner = (void*)(arg & (~1));
28382 arg_conv.is_owned = false;
28383 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28384 int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
28388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28389 LDKDelayedPaymentOutputDescriptor orig_conv;
28390 orig_conv.inner = (void*)(orig & (~1));
28391 orig_conv.is_owned = false;
28392 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28393 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
28394 int64_t ret_ref = 0;
28395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28398 ret_ref = (uintptr_t)ret_var.inner;
28399 if (ret_var.is_owned) {
28405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28406 LDKDelayedPaymentOutputDescriptor obj_conv;
28407 obj_conv.inner = (void*)(obj & (~1));
28408 obj_conv.is_owned = false;
28409 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28410 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
28411 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28412 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28413 CVec_u8Z_free(ret_var);
28417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28418 LDKu8slice ser_ref;
28419 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28420 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28421 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
28422 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
28423 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28424 return (int64_t)ret_conv;
28427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28428 LDKStaticPaymentOutputDescriptor this_obj_conv;
28429 this_obj_conv.inner = (void*)(this_obj & (~1));
28430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28432 StaticPaymentOutputDescriptor_free(this_obj_conv);
28435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28436 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28438 this_ptr_conv.is_owned = false;
28439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28440 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28441 int64_t ret_ref = 0;
28442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28445 ret_ref = (uintptr_t)ret_var.inner;
28446 if (ret_var.is_owned) {
28452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28453 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28455 this_ptr_conv.is_owned = false;
28456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28457 LDKOutPoint val_conv;
28458 val_conv.inner = (void*)(val & (~1));
28459 val_conv.is_owned = (val & 1) || (val == 0);
28460 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28461 val_conv = OutPoint_clone(&val_conv);
28462 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28466 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28468 this_ptr_conv.is_owned = false;
28469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28470 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28471 *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
28472 return (int64_t)ret_ref;
28475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28476 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28478 this_ptr_conv.is_owned = false;
28479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28480 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28481 CHECK_ACCESS(val_ptr);
28482 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
28483 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
28484 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
28487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28488 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28490 this_ptr_conv.is_owned = false;
28491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28492 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28493 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
28497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28498 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28500 this_ptr_conv.is_owned = false;
28501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28502 LDKThirtyTwoBytes val_ref;
28503 CHECK((*env)->GetArrayLength(env, val) == 32);
28504 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28505 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
28508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28509 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28511 this_ptr_conv.is_owned = false;
28512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28513 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
28517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28518 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28520 this_ptr_conv.is_owned = false;
28521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28522 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
28525 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) {
28526 LDKOutPoint outpoint_arg_conv;
28527 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
28528 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
28529 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
28530 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
28531 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
28532 CHECK_ACCESS(output_arg_ptr);
28533 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
28534 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
28535 LDKThirtyTwoBytes channel_keys_id_arg_ref;
28536 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
28537 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
28538 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
28539 int64_t ret_ref = 0;
28540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28543 ret_ref = (uintptr_t)ret_var.inner;
28544 if (ret_var.is_owned) {
28550 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
28551 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
28552 int64_t ret_ref = 0;
28553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28556 ret_ref = (uintptr_t)ret_var.inner;
28557 if (ret_var.is_owned) {
28562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28563 LDKStaticPaymentOutputDescriptor arg_conv;
28564 arg_conv.inner = (void*)(arg & (~1));
28565 arg_conv.is_owned = false;
28566 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28567 int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
28571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28572 LDKStaticPaymentOutputDescriptor orig_conv;
28573 orig_conv.inner = (void*)(orig & (~1));
28574 orig_conv.is_owned = false;
28575 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28576 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
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 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28589 LDKStaticPaymentOutputDescriptor obj_conv;
28590 obj_conv.inner = (void*)(obj & (~1));
28591 obj_conv.is_owned = false;
28592 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28593 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
28594 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28595 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28596 CVec_u8Z_free(ret_var);
28600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28601 LDKu8slice ser_ref;
28602 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28603 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28604 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
28605 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
28606 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28607 return (int64_t)ret_conv;
28610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28611 if ((this_ptr & 1) != 0) return;
28612 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28613 CHECK_ACCESS(this_ptr_ptr);
28614 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
28615 FREE((void*)this_ptr);
28616 SpendableOutputDescriptor_free(this_ptr_conv);
28619 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
28620 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28621 *ret_copy = SpendableOutputDescriptor_clone(arg);
28622 int64_t ret_ref = (uintptr_t)ret_copy;
28625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28626 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
28627 int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
28631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28632 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
28633 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28634 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
28635 int64_t ret_ref = (uintptr_t)ret_copy;
28639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
28640 LDKOutPoint outpoint_conv;
28641 outpoint_conv.inner = (void*)(outpoint & (~1));
28642 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
28643 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
28644 outpoint_conv = OutPoint_clone(&outpoint_conv);
28645 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
28646 CHECK_ACCESS(output_ptr);
28647 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
28648 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
28649 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28650 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
28651 int64_t ret_ref = (uintptr_t)ret_copy;
28655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
28656 LDKDelayedPaymentOutputDescriptor a_conv;
28657 a_conv.inner = (void*)(a & (~1));
28658 a_conv.is_owned = (a & 1) || (a == 0);
28659 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28660 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
28661 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28662 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
28663 int64_t ret_ref = (uintptr_t)ret_copy;
28667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
28668 LDKStaticPaymentOutputDescriptor a_conv;
28669 a_conv.inner = (void*)(a & (~1));
28670 a_conv.is_owned = (a & 1) || (a == 0);
28671 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28672 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
28673 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28674 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
28675 int64_t ret_ref = (uintptr_t)ret_copy;
28679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28680 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
28681 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
28682 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28683 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28684 CVec_u8Z_free(ret_var);
28688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28689 LDKu8slice ser_ref;
28690 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28691 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28692 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
28693 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
28694 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28695 return (int64_t)ret_conv;
28698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28699 if ((this_ptr & 1) != 0) return;
28700 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28701 CHECK_ACCESS(this_ptr_ptr);
28702 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
28703 FREE((void*)this_ptr);
28704 BaseSign_free(this_ptr_conv);
28707 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
28708 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28709 *ret_ret = Sign_clone(arg);
28710 return (int64_t)ret_ret;
28712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28713 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
28714 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28715 LDKSign* arg_conv = (LDKSign*)arg_ptr;
28716 int64_t ret_conv = Sign_clone_ptr(arg_conv);
28720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28721 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
28722 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28723 LDKSign* orig_conv = (LDKSign*)orig_ptr;
28724 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28725 *ret_ret = Sign_clone(orig_conv);
28726 return (int64_t)ret_ret;
28729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28730 if ((this_ptr & 1) != 0) return;
28731 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28732 CHECK_ACCESS(this_ptr_ptr);
28733 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
28734 FREE((void*)this_ptr);
28735 Sign_free(this_ptr_conv);
28738 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28739 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
28740 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
28744 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
28745 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
28749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
28750 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
28754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28755 if ((this_ptr & 1) != 0) return;
28756 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28757 CHECK_ACCESS(this_ptr_ptr);
28758 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
28759 FREE((void*)this_ptr);
28760 KeysInterface_free(this_ptr_conv);
28763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28764 LDKInMemorySigner this_obj_conv;
28765 this_obj_conv.inner = (void*)(this_obj & (~1));
28766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28768 InMemorySigner_free(this_obj_conv);
28771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28772 LDKInMemorySigner this_ptr_conv;
28773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28774 this_ptr_conv.is_owned = false;
28775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28776 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
28781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28782 LDKInMemorySigner this_ptr_conv;
28783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28784 this_ptr_conv.is_owned = false;
28785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28786 LDKSecretKey val_ref;
28787 CHECK((*env)->GetArrayLength(env, val) == 32);
28788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28789 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
28792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28793 LDKInMemorySigner this_ptr_conv;
28794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28795 this_ptr_conv.is_owned = false;
28796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
28802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28803 LDKInMemorySigner this_ptr_conv;
28804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28805 this_ptr_conv.is_owned = false;
28806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28807 LDKSecretKey val_ref;
28808 CHECK((*env)->GetArrayLength(env, val) == 32);
28809 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28810 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
28813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28814 LDKInMemorySigner this_ptr_conv;
28815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28816 this_ptr_conv.is_owned = false;
28817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28818 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
28823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28824 LDKInMemorySigner this_ptr_conv;
28825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28826 this_ptr_conv.is_owned = false;
28827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28828 LDKSecretKey val_ref;
28829 CHECK((*env)->GetArrayLength(env, val) == 32);
28830 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28831 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
28834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28835 LDKInMemorySigner this_ptr_conv;
28836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28837 this_ptr_conv.is_owned = false;
28838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28840 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
28844 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) {
28845 LDKInMemorySigner this_ptr_conv;
28846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28847 this_ptr_conv.is_owned = false;
28848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28849 LDKSecretKey val_ref;
28850 CHECK((*env)->GetArrayLength(env, val) == 32);
28851 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28852 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
28855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28856 LDKInMemorySigner this_ptr_conv;
28857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28858 this_ptr_conv.is_owned = false;
28859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28860 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28861 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
28865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28866 LDKInMemorySigner this_ptr_conv;
28867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28868 this_ptr_conv.is_owned = false;
28869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28870 LDKSecretKey val_ref;
28871 CHECK((*env)->GetArrayLength(env, val) == 32);
28872 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28873 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
28876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
28877 LDKInMemorySigner this_ptr_conv;
28878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28879 this_ptr_conv.is_owned = false;
28880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28881 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28882 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
28886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28887 LDKInMemorySigner this_ptr_conv;
28888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28889 this_ptr_conv.is_owned = false;
28890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28891 LDKThirtyTwoBytes val_ref;
28892 CHECK((*env)->GetArrayLength(env, val) == 32);
28893 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28894 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
28897 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
28898 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
28899 int64_t ret_ref = 0;
28900 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28901 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28903 ret_ref = (uintptr_t)ret_var.inner;
28904 if (ret_var.is_owned) {
28909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28910 LDKInMemorySigner arg_conv;
28911 arg_conv.inner = (void*)(arg & (~1));
28912 arg_conv.is_owned = false;
28913 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28914 int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
28918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28919 LDKInMemorySigner orig_conv;
28920 orig_conv.inner = (void*)(orig & (~1));
28921 orig_conv.is_owned = false;
28922 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28923 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
28924 int64_t ret_ref = 0;
28925 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28926 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28927 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28928 ret_ref = (uintptr_t)ret_var.inner;
28929 if (ret_var.is_owned) {
28935 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) {
28936 LDKSecretKey node_secret_ref;
28937 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
28938 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
28939 LDKSecretKey funding_key_ref;
28940 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
28941 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
28942 LDKSecretKey revocation_base_key_ref;
28943 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
28944 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
28945 LDKSecretKey payment_key_ref;
28946 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
28947 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
28948 LDKSecretKey delayed_payment_base_key_ref;
28949 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
28950 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
28951 LDKSecretKey htlc_base_key_ref;
28952 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
28953 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
28954 LDKThirtyTwoBytes commitment_seed_ref;
28955 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
28956 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
28957 LDKThirtyTwoBytes channel_keys_id_ref;
28958 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
28959 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
28960 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);
28961 int64_t ret_ref = 0;
28962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28965 ret_ref = (uintptr_t)ret_var.inner;
28966 if (ret_var.is_owned) {
28972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28973 LDKInMemorySigner this_arg_conv;
28974 this_arg_conv.inner = (void*)(this_arg & (~1));
28975 this_arg_conv.is_owned = false;
28976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28977 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
28978 int64_t ret_ref = 0;
28979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28982 ret_ref = (uintptr_t)ret_var.inner;
28983 if (ret_var.is_owned) {
28989 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28990 LDKInMemorySigner this_arg_conv;
28991 this_arg_conv.inner = (void*)(this_arg & (~1));
28992 this_arg_conv.is_owned = false;
28993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28994 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
28998 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28999 LDKInMemorySigner this_arg_conv;
29000 this_arg_conv.inner = (void*)(this_arg & (~1));
29001 this_arg_conv.is_owned = false;
29002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29003 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
29007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
29008 LDKInMemorySigner this_arg_conv;
29009 this_arg_conv.inner = (void*)(this_arg & (~1));
29010 this_arg_conv.is_owned = false;
29011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29012 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
29016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
29017 LDKInMemorySigner this_arg_conv;
29018 this_arg_conv.inner = (void*)(this_arg & (~1));
29019 this_arg_conv.is_owned = false;
29020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29021 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
29022 int64_t ret_ref = 0;
29023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29026 ret_ref = (uintptr_t)ret_var.inner;
29027 if (ret_var.is_owned) {
29033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
29034 LDKInMemorySigner this_arg_conv;
29035 this_arg_conv.inner = (void*)(this_arg & (~1));
29036 this_arg_conv.is_owned = false;
29037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29038 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
29039 int64_t ret_ref = 0;
29040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29043 ret_ref = (uintptr_t)ret_var.inner;
29044 if (ret_var.is_owned) {
29050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
29051 LDKInMemorySigner this_arg_conv;
29052 this_arg_conv.inner = (void*)(this_arg & (~1));
29053 this_arg_conv.is_owned = false;
29054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29055 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
29059 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) {
29060 LDKInMemorySigner this_arg_conv;
29061 this_arg_conv.inner = (void*)(this_arg & (~1));
29062 this_arg_conv.is_owned = false;
29063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29064 LDKTransaction spend_tx_ref;
29065 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29066 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29067 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29068 spend_tx_ref.data_is_owned = true;
29069 LDKStaticPaymentOutputDescriptor descriptor_conv;
29070 descriptor_conv.inner = (void*)(descriptor & (~1));
29071 descriptor_conv.is_owned = false;
29072 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29073 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29074 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29075 return (int64_t)ret_conv;
29078 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) {
29079 LDKInMemorySigner this_arg_conv;
29080 this_arg_conv.inner = (void*)(this_arg & (~1));
29081 this_arg_conv.is_owned = false;
29082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29083 LDKTransaction spend_tx_ref;
29084 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29085 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29086 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29087 spend_tx_ref.data_is_owned = true;
29088 LDKDelayedPaymentOutputDescriptor descriptor_conv;
29089 descriptor_conv.inner = (void*)(descriptor & (~1));
29090 descriptor_conv.is_owned = false;
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29092 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29093 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29094 return (int64_t)ret_conv;
29097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
29098 LDKInMemorySigner this_arg_conv;
29099 this_arg_conv.inner = (void*)(this_arg & (~1));
29100 this_arg_conv.is_owned = false;
29101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29102 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
29103 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
29104 return (int64_t)ret_ret;
29107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
29108 LDKInMemorySigner this_arg_conv;
29109 this_arg_conv.inner = (void*)(this_arg & (~1));
29110 this_arg_conv.is_owned = false;
29111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29112 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
29113 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
29114 return (int64_t)ret_ret;
29117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
29118 LDKInMemorySigner obj_conv;
29119 obj_conv.inner = (void*)(obj & (~1));
29120 obj_conv.is_owned = false;
29121 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29122 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
29123 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29124 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29125 CVec_u8Z_free(ret_var);
29129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
29130 LDKu8slice ser_ref;
29131 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29132 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29133 LDKSecretKey arg_ref;
29134 CHECK((*env)->GetArrayLength(env, arg) == 32);
29135 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
29136 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
29137 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
29138 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29139 return (int64_t)ret_conv;
29142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29143 LDKKeysManager this_obj_conv;
29144 this_obj_conv.inner = (void*)(this_obj & (~1));
29145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29147 KeysManager_free(this_obj_conv);
29150 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) {
29151 unsigned char seed_arr[32];
29152 CHECK((*env)->GetArrayLength(env, seed) == 32);
29153 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29154 unsigned char (*seed_ref)[32] = &seed_arr;
29155 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
29156 int64_t ret_ref = 0;
29157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29160 ret_ref = (uintptr_t)ret_var.inner;
29161 if (ret_var.is_owned) {
29167 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) {
29168 LDKKeysManager this_arg_conv;
29169 this_arg_conv.inner = (void*)(this_arg & (~1));
29170 this_arg_conv.is_owned = false;
29171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29172 unsigned char params_arr[32];
29173 CHECK((*env)->GetArrayLength(env, params) == 32);
29174 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29175 unsigned char (*params_ref)[32] = ¶ms_arr;
29176 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29177 int64_t ret_ref = 0;
29178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29181 ret_ref = (uintptr_t)ret_var.inner;
29182 if (ret_var.is_owned) {
29188 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) {
29189 LDKKeysManager this_arg_conv;
29190 this_arg_conv.inner = (void*)(this_arg & (~1));
29191 this_arg_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29193 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29194 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29195 if (descriptors_constr.datalen > 0)
29196 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29198 descriptors_constr.data = NULL;
29199 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29200 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29201 int64_t descriptors_conv_27 = descriptors_vals[b];
29202 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
29203 CHECK_ACCESS(descriptors_conv_27_ptr);
29204 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29205 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
29206 descriptors_constr.data[b] = descriptors_conv_27_conv;
29208 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29209 LDKCVec_TxOutZ outputs_constr;
29210 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29211 if (outputs_constr.datalen > 0)
29212 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29214 outputs_constr.data = NULL;
29215 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29216 for (size_t h = 0; h < outputs_constr.datalen; h++) {
29217 int64_t outputs_conv_7 = outputs_vals[h];
29218 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
29219 CHECK_ACCESS(outputs_conv_7_ptr);
29220 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29221 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
29222 outputs_constr.data[h] = outputs_conv_7_conv;
29224 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29225 LDKCVec_u8Z change_destination_script_ref;
29226 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29227 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29228 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29229 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29230 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29231 return (int64_t)ret_conv;
29234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29235 LDKKeysManager this_arg_conv;
29236 this_arg_conv.inner = (void*)(this_arg & (~1));
29237 this_arg_conv.is_owned = false;
29238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29239 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29240 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
29241 return (int64_t)ret_ret;
29244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29245 LDKPhantomKeysManager this_obj_conv;
29246 this_obj_conv.inner = (void*)(this_obj & (~1));
29247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29249 PhantomKeysManager_free(this_obj_conv);
29252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29253 LDKPhantomKeysManager this_arg_conv;
29254 this_arg_conv.inner = (void*)(this_arg & (~1));
29255 this_arg_conv.is_owned = false;
29256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29257 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29258 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
29259 return (int64_t)ret_ret;
29262 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) {
29263 unsigned char seed_arr[32];
29264 CHECK((*env)->GetArrayLength(env, seed) == 32);
29265 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29266 unsigned char (*seed_ref)[32] = &seed_arr;
29267 unsigned char cross_node_seed_arr[32];
29268 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
29269 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
29270 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
29271 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
29272 int64_t ret_ref = 0;
29273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29276 ret_ref = (uintptr_t)ret_var.inner;
29277 if (ret_var.is_owned) {
29283 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) {
29284 LDKPhantomKeysManager this_arg_conv;
29285 this_arg_conv.inner = (void*)(this_arg & (~1));
29286 this_arg_conv.is_owned = false;
29287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29288 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29289 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29290 if (descriptors_constr.datalen > 0)
29291 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29293 descriptors_constr.data = NULL;
29294 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29295 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29296 int64_t descriptors_conv_27 = descriptors_vals[b];
29297 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
29298 CHECK_ACCESS(descriptors_conv_27_ptr);
29299 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29300 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
29301 descriptors_constr.data[b] = descriptors_conv_27_conv;
29303 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29304 LDKCVec_TxOutZ outputs_constr;
29305 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29306 if (outputs_constr.datalen > 0)
29307 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29309 outputs_constr.data = NULL;
29310 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29311 for (size_t h = 0; h < outputs_constr.datalen; h++) {
29312 int64_t outputs_conv_7 = outputs_vals[h];
29313 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
29314 CHECK_ACCESS(outputs_conv_7_ptr);
29315 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29316 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
29317 outputs_constr.data[h] = outputs_conv_7_conv;
29319 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29320 LDKCVec_u8Z change_destination_script_ref;
29321 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29322 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29323 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29324 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29325 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29326 return (int64_t)ret_conv;
29329 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) {
29330 LDKPhantomKeysManager this_arg_conv;
29331 this_arg_conv.inner = (void*)(this_arg & (~1));
29332 this_arg_conv.is_owned = false;
29333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29334 unsigned char params_arr[32];
29335 CHECK((*env)->GetArrayLength(env, params) == 32);
29336 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29337 unsigned char (*params_ref)[32] = ¶ms_arr;
29338 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29339 int64_t ret_ref = 0;
29340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29343 ret_ref = (uintptr_t)ret_var.inner;
29344 if (ret_var.is_owned) {
29350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29351 LDKChannelManager this_obj_conv;
29352 this_obj_conv.inner = (void*)(this_obj & (~1));
29353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29355 ChannelManager_free(this_obj_conv);
29358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29359 LDKChainParameters this_obj_conv;
29360 this_obj_conv.inner = (void*)(this_obj & (~1));
29361 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29363 ChainParameters_free(this_obj_conv);
29366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
29367 LDKChainParameters this_ptr_conv;
29368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29369 this_ptr_conv.is_owned = false;
29370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29371 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
29375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
29376 LDKChainParameters this_ptr_conv;
29377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29378 this_ptr_conv.is_owned = false;
29379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29380 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
29381 ChainParameters_set_network(&this_ptr_conv, val_conv);
29384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
29385 LDKChainParameters this_ptr_conv;
29386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29387 this_ptr_conv.is_owned = false;
29388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29389 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
29390 int64_t ret_ref = 0;
29391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29394 ret_ref = (uintptr_t)ret_var.inner;
29395 if (ret_var.is_owned) {
29401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29402 LDKChainParameters this_ptr_conv;
29403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29404 this_ptr_conv.is_owned = false;
29405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29406 LDKBestBlock val_conv;
29407 val_conv.inner = (void*)(val & (~1));
29408 val_conv.is_owned = (val & 1) || (val == 0);
29409 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29410 val_conv = BestBlock_clone(&val_conv);
29411 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
29414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
29415 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
29416 LDKBestBlock best_block_arg_conv;
29417 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
29418 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
29419 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
29420 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
29421 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
29422 int64_t ret_ref = 0;
29423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29426 ret_ref = (uintptr_t)ret_var.inner;
29427 if (ret_var.is_owned) {
29433 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
29434 LDKChainParameters ret_var = ChainParameters_clone(arg);
29435 int64_t ret_ref = 0;
29436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29439 ret_ref = (uintptr_t)ret_var.inner;
29440 if (ret_var.is_owned) {
29445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29446 LDKChainParameters arg_conv;
29447 arg_conv.inner = (void*)(arg & (~1));
29448 arg_conv.is_owned = false;
29449 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29450 int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
29454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29455 LDKChainParameters orig_conv;
29456 orig_conv.inner = (void*)(orig & (~1));
29457 orig_conv.is_owned = false;
29458 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29459 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
29460 int64_t ret_ref = 0;
29461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29464 ret_ref = (uintptr_t)ret_var.inner;
29465 if (ret_var.is_owned) {
29471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29472 LDKCounterpartyForwardingInfo this_obj_conv;
29473 this_obj_conv.inner = (void*)(this_obj & (~1));
29474 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29476 CounterpartyForwardingInfo_free(this_obj_conv);
29479 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29480 LDKCounterpartyForwardingInfo this_ptr_conv;
29481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29482 this_ptr_conv.is_owned = false;
29483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29484 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
29488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29489 LDKCounterpartyForwardingInfo this_ptr_conv;
29490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29491 this_ptr_conv.is_owned = false;
29492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29493 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
29496 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
29497 LDKCounterpartyForwardingInfo this_ptr_conv;
29498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29499 this_ptr_conv.is_owned = false;
29500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29501 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
29505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29506 LDKCounterpartyForwardingInfo this_ptr_conv;
29507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29508 this_ptr_conv.is_owned = false;
29509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29510 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
29513 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29514 LDKCounterpartyForwardingInfo this_ptr_conv;
29515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29516 this_ptr_conv.is_owned = false;
29517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29518 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
29522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29523 LDKCounterpartyForwardingInfo this_ptr_conv;
29524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29525 this_ptr_conv.is_owned = false;
29526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29527 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
29530 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) {
29531 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
29532 int64_t ret_ref = 0;
29533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29536 ret_ref = (uintptr_t)ret_var.inner;
29537 if (ret_var.is_owned) {
29543 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
29544 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
29545 int64_t ret_ref = 0;
29546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29549 ret_ref = (uintptr_t)ret_var.inner;
29550 if (ret_var.is_owned) {
29555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29556 LDKCounterpartyForwardingInfo arg_conv;
29557 arg_conv.inner = (void*)(arg & (~1));
29558 arg_conv.is_owned = false;
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29560 int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
29564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29565 LDKCounterpartyForwardingInfo orig_conv;
29566 orig_conv.inner = (void*)(orig & (~1));
29567 orig_conv.is_owned = false;
29568 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29569 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
29570 int64_t ret_ref = 0;
29571 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29572 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29574 ret_ref = (uintptr_t)ret_var.inner;
29575 if (ret_var.is_owned) {
29581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29582 LDKChannelCounterparty this_obj_conv;
29583 this_obj_conv.inner = (void*)(this_obj & (~1));
29584 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29586 ChannelCounterparty_free(this_obj_conv);
29589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29590 LDKChannelCounterparty this_ptr_conv;
29591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29592 this_ptr_conv.is_owned = false;
29593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29594 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29595 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
29599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29600 LDKChannelCounterparty this_ptr_conv;
29601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29602 this_ptr_conv.is_owned = false;
29603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29604 LDKPublicKey val_ref;
29605 CHECK((*env)->GetArrayLength(env, val) == 33);
29606 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29607 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
29610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29611 LDKChannelCounterparty this_ptr_conv;
29612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29613 this_ptr_conv.is_owned = false;
29614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29615 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
29616 int64_t ret_ref = 0;
29617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29620 ret_ref = (uintptr_t)ret_var.inner;
29621 if (ret_var.is_owned) {
29627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29628 LDKChannelCounterparty this_ptr_conv;
29629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29630 this_ptr_conv.is_owned = false;
29631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29632 LDKInitFeatures val_conv;
29633 val_conv.inner = (void*)(val & (~1));
29634 val_conv.is_owned = (val & 1) || (val == 0);
29635 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29636 val_conv = InitFeatures_clone(&val_conv);
29637 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
29640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
29641 LDKChannelCounterparty this_ptr_conv;
29642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29643 this_ptr_conv.is_owned = false;
29644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29645 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
29649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29650 LDKChannelCounterparty this_ptr_conv;
29651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29652 this_ptr_conv.is_owned = false;
29653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29654 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
29657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
29658 LDKChannelCounterparty this_ptr_conv;
29659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29660 this_ptr_conv.is_owned = false;
29661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29662 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
29663 int64_t ret_ref = 0;
29664 if ((uintptr_t)ret_var.inner > 4096) {
29665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29668 ret_ref = (uintptr_t)ret_var.inner;
29669 if (ret_var.is_owned) {
29676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29677 LDKChannelCounterparty this_ptr_conv;
29678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29679 this_ptr_conv.is_owned = false;
29680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29681 LDKCounterpartyForwardingInfo val_conv;
29682 val_conv.inner = (void*)(val & (~1));
29683 val_conv.is_owned = (val & 1) || (val == 0);
29684 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29685 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
29686 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
29689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29690 LDKChannelCounterparty this_ptr_conv;
29691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29692 this_ptr_conv.is_owned = false;
29693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29694 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29695 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
29696 int64_t ret_ref = (uintptr_t)ret_copy;
29700 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) {
29701 LDKChannelCounterparty this_ptr_conv;
29702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29703 this_ptr_conv.is_owned = false;
29704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29705 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29706 CHECK_ACCESS(val_ptr);
29707 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29708 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29709 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29713 LDKChannelCounterparty this_ptr_conv;
29714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29715 this_ptr_conv.is_owned = false;
29716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29717 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29718 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
29719 int64_t ret_ref = (uintptr_t)ret_copy;
29723 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) {
29724 LDKChannelCounterparty this_ptr_conv;
29725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29726 this_ptr_conv.is_owned = false;
29727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29728 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29729 CHECK_ACCESS(val_ptr);
29730 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29731 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29732 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29735 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) {
29736 LDKPublicKey node_id_arg_ref;
29737 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
29738 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
29739 LDKInitFeatures features_arg_conv;
29740 features_arg_conv.inner = (void*)(features_arg & (~1));
29741 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29742 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29743 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29744 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
29745 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
29746 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
29747 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
29748 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
29749 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
29750 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
29751 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
29752 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
29753 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
29754 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
29755 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
29756 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
29757 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);
29758 int64_t ret_ref = 0;
29759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29762 ret_ref = (uintptr_t)ret_var.inner;
29763 if (ret_var.is_owned) {
29769 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
29770 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
29771 int64_t ret_ref = 0;
29772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29775 ret_ref = (uintptr_t)ret_var.inner;
29776 if (ret_var.is_owned) {
29781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29782 LDKChannelCounterparty arg_conv;
29783 arg_conv.inner = (void*)(arg & (~1));
29784 arg_conv.is_owned = false;
29785 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29786 int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
29790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29791 LDKChannelCounterparty orig_conv;
29792 orig_conv.inner = (void*)(orig & (~1));
29793 orig_conv.is_owned = false;
29794 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29795 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
29796 int64_t ret_ref = 0;
29797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29800 ret_ref = (uintptr_t)ret_var.inner;
29801 if (ret_var.is_owned) {
29807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29808 LDKChannelDetails this_obj_conv;
29809 this_obj_conv.inner = (void*)(this_obj & (~1));
29810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29812 ChannelDetails_free(this_obj_conv);
29815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29816 LDKChannelDetails this_ptr_conv;
29817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29818 this_ptr_conv.is_owned = false;
29819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29820 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
29825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29826 LDKChannelDetails this_ptr_conv;
29827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29828 this_ptr_conv.is_owned = false;
29829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29830 LDKThirtyTwoBytes val_ref;
29831 CHECK((*env)->GetArrayLength(env, val) == 32);
29832 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29833 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
29836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
29837 LDKChannelDetails this_ptr_conv;
29838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29839 this_ptr_conv.is_owned = false;
29840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29841 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
29842 int64_t ret_ref = 0;
29843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29846 ret_ref = (uintptr_t)ret_var.inner;
29847 if (ret_var.is_owned) {
29853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29854 LDKChannelDetails this_ptr_conv;
29855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29856 this_ptr_conv.is_owned = false;
29857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29858 LDKChannelCounterparty val_conv;
29859 val_conv.inner = (void*)(val & (~1));
29860 val_conv.is_owned = (val & 1) || (val == 0);
29861 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29862 val_conv = ChannelCounterparty_clone(&val_conv);
29863 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
29866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
29867 LDKChannelDetails this_ptr_conv;
29868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29869 this_ptr_conv.is_owned = false;
29870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29871 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
29872 int64_t ret_ref = 0;
29873 if ((uintptr_t)ret_var.inner > 4096) {
29874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29877 ret_ref = (uintptr_t)ret_var.inner;
29878 if (ret_var.is_owned) {
29885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29886 LDKChannelDetails this_ptr_conv;
29887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29888 this_ptr_conv.is_owned = false;
29889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29890 LDKOutPoint val_conv;
29891 val_conv.inner = (void*)(val & (~1));
29892 val_conv.is_owned = (val & 1) || (val == 0);
29893 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29894 val_conv = OutPoint_clone(&val_conv);
29895 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
29898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
29899 LDKChannelDetails this_ptr_conv;
29900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29901 this_ptr_conv.is_owned = false;
29902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29903 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
29904 int64_t ret_ref = 0;
29905 if ((uintptr_t)ret_var.inner > 4096) {
29906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29909 ret_ref = (uintptr_t)ret_var.inner;
29910 if (ret_var.is_owned) {
29917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29918 LDKChannelDetails this_ptr_conv;
29919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29920 this_ptr_conv.is_owned = false;
29921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29922 LDKChannelTypeFeatures val_conv;
29923 val_conv.inner = (void*)(val & (~1));
29924 val_conv.is_owned = (val & 1) || (val == 0);
29925 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29926 val_conv = ChannelTypeFeatures_clone(&val_conv);
29927 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
29930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29931 LDKChannelDetails this_ptr_conv;
29932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29933 this_ptr_conv.is_owned = false;
29934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29935 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29936 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
29937 int64_t ret_ref = (uintptr_t)ret_copy;
29941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29942 LDKChannelDetails this_ptr_conv;
29943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29944 this_ptr_conv.is_owned = false;
29945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29946 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29947 CHECK_ACCESS(val_ptr);
29948 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29949 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29950 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
29953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29954 LDKChannelDetails this_ptr_conv;
29955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29956 this_ptr_conv.is_owned = false;
29957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29958 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29959 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
29960 int64_t ret_ref = (uintptr_t)ret_copy;
29964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29965 LDKChannelDetails this_ptr_conv;
29966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29967 this_ptr_conv.is_owned = false;
29968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29969 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29970 CHECK_ACCESS(val_ptr);
29971 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29972 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29973 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
29976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29977 LDKChannelDetails this_ptr_conv;
29978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29979 this_ptr_conv.is_owned = false;
29980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29981 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29982 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
29983 int64_t ret_ref = (uintptr_t)ret_copy;
29987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29988 LDKChannelDetails this_ptr_conv;
29989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29990 this_ptr_conv.is_owned = false;
29991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29992 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29993 CHECK_ACCESS(val_ptr);
29994 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29995 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29996 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
29999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30000 LDKChannelDetails this_ptr_conv;
30001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30002 this_ptr_conv.is_owned = false;
30003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30004 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
30008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30009 LDKChannelDetails this_ptr_conv;
30010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30011 this_ptr_conv.is_owned = false;
30012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30013 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
30016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
30017 LDKChannelDetails this_ptr_conv;
30018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30019 this_ptr_conv.is_owned = false;
30020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30021 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30022 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
30023 int64_t ret_ref = (uintptr_t)ret_copy;
30027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30028 LDKChannelDetails this_ptr_conv;
30029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30030 this_ptr_conv.is_owned = false;
30031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30032 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30033 CHECK_ACCESS(val_ptr);
30034 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30035 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30036 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
30039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30040 LDKChannelDetails this_ptr_conv;
30041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30042 this_ptr_conv.is_owned = false;
30043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30044 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
30048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30049 LDKChannelDetails this_ptr_conv;
30050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30051 this_ptr_conv.is_owned = false;
30052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30053 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
30056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30057 LDKChannelDetails this_ptr_conv;
30058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30059 this_ptr_conv.is_owned = false;
30060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30061 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
30065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30066 LDKChannelDetails this_ptr_conv;
30067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30068 this_ptr_conv.is_owned = false;
30069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30070 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
30073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30074 LDKChannelDetails this_ptr_conv;
30075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30076 this_ptr_conv.is_owned = false;
30077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30078 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
30082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30083 LDKChannelDetails this_ptr_conv;
30084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30085 this_ptr_conv.is_owned = false;
30086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30087 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
30090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30091 LDKChannelDetails this_ptr_conv;
30092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30093 this_ptr_conv.is_owned = false;
30094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30095 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
30099 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) {
30100 LDKChannelDetails this_ptr_conv;
30101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30102 this_ptr_conv.is_owned = false;
30103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30104 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
30107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30108 LDKChannelDetails this_ptr_conv;
30109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30110 this_ptr_conv.is_owned = false;
30111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30112 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
30116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30117 LDKChannelDetails this_ptr_conv;
30118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30119 this_ptr_conv.is_owned = false;
30120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30121 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
30124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
30125 LDKChannelDetails this_ptr_conv;
30126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30127 this_ptr_conv.is_owned = false;
30128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30129 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30130 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
30131 int64_t ret_ref = (uintptr_t)ret_copy;
30135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30136 LDKChannelDetails this_ptr_conv;
30137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30138 this_ptr_conv.is_owned = false;
30139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30140 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30141 CHECK_ACCESS(val_ptr);
30142 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30143 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
30144 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
30147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30148 LDKChannelDetails this_ptr_conv;
30149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30150 this_ptr_conv.is_owned = false;
30151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30152 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
30153 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
30154 int64_t ret_ref = (uintptr_t)ret_copy;
30158 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) {
30159 LDKChannelDetails this_ptr_conv;
30160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30161 this_ptr_conv.is_owned = false;
30162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30163 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30164 CHECK_ACCESS(val_ptr);
30165 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
30166 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
30167 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
30170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
30171 LDKChannelDetails this_ptr_conv;
30172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30173 this_ptr_conv.is_owned = false;
30174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30175 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
30179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30180 LDKChannelDetails this_ptr_conv;
30181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30182 this_ptr_conv.is_owned = false;
30183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30184 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
30187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
30188 LDKChannelDetails this_ptr_conv;
30189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30190 this_ptr_conv.is_owned = false;
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30192 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
30196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30197 LDKChannelDetails this_ptr_conv;
30198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30199 this_ptr_conv.is_owned = false;
30200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30201 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
30204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
30205 LDKChannelDetails this_ptr_conv;
30206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30207 this_ptr_conv.is_owned = false;
30208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30209 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
30213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30214 LDKChannelDetails this_ptr_conv;
30215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30216 this_ptr_conv.is_owned = false;
30217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30218 ChannelDetails_set_is_usable(&this_ptr_conv, val);
30221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
30222 LDKChannelDetails this_ptr_conv;
30223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30224 this_ptr_conv.is_owned = false;
30225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30226 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
30230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30231 LDKChannelDetails this_ptr_conv;
30232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30233 this_ptr_conv.is_owned = false;
30234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30235 ChannelDetails_set_is_public(&this_ptr_conv, val);
30238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30239 LDKChannelDetails this_ptr_conv;
30240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30241 this_ptr_conv.is_owned = false;
30242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30243 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30244 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
30245 int64_t ret_ref = (uintptr_t)ret_copy;
30249 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) {
30250 LDKChannelDetails this_ptr_conv;
30251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30252 this_ptr_conv.is_owned = false;
30253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30254 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30255 CHECK_ACCESS(val_ptr);
30256 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30257 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30258 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
30261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30262 LDKChannelDetails this_ptr_conv;
30263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30264 this_ptr_conv.is_owned = false;
30265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30266 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30267 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
30268 int64_t ret_ref = (uintptr_t)ret_copy;
30272 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) {
30273 LDKChannelDetails this_ptr_conv;
30274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30275 this_ptr_conv.is_owned = false;
30276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30277 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30278 CHECK_ACCESS(val_ptr);
30279 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30280 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30281 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
30284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30285 LDKChannelDetails this_ptr_conv;
30286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30287 this_ptr_conv.is_owned = false;
30288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30289 LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
30290 int64_t ret_ref = 0;
30291 if ((uintptr_t)ret_var.inner > 4096) {
30292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30295 ret_ref = (uintptr_t)ret_var.inner;
30296 if (ret_var.is_owned) {
30303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30304 LDKChannelDetails this_ptr_conv;
30305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30306 this_ptr_conv.is_owned = false;
30307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30308 LDKChannelConfig val_conv;
30309 val_conv.inner = (void*)(val & (~1));
30310 val_conv.is_owned = (val & 1) || (val == 0);
30311 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30312 val_conv = ChannelConfig_clone(&val_conv);
30313 ChannelDetails_set_config(&this_ptr_conv, val_conv);
30316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
30317 LDKThirtyTwoBytes channel_id_arg_ref;
30318 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30319 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30320 LDKChannelCounterparty counterparty_arg_conv;
30321 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
30322 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
30323 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
30324 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
30325 LDKOutPoint funding_txo_arg_conv;
30326 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
30327 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
30328 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
30329 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
30330 LDKChannelTypeFeatures channel_type_arg_conv;
30331 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
30332 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
30333 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
30334 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
30335 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
30336 CHECK_ACCESS(short_channel_id_arg_ptr);
30337 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
30338 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
30339 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
30340 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
30341 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
30342 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
30343 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
30344 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
30345 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
30346 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
30347 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
30348 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
30349 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
30350 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
30351 CHECK_ACCESS(confirmations_required_arg_ptr);
30352 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
30353 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
30354 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
30355 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
30356 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
30357 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
30358 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
30359 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
30360 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
30361 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
30362 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
30363 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
30364 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
30365 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
30366 LDKChannelConfig config_arg_conv;
30367 config_arg_conv.inner = (void*)(config_arg & (~1));
30368 config_arg_conv.is_owned = (config_arg & 1) || (config_arg == 0);
30369 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
30370 config_arg_conv = ChannelConfig_clone(&config_arg_conv);
30371 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
30372 int64_t ret_ref = 0;
30373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30376 ret_ref = (uintptr_t)ret_var.inner;
30377 if (ret_var.is_owned) {
30383 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
30384 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
30385 int64_t ret_ref = 0;
30386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30389 ret_ref = (uintptr_t)ret_var.inner;
30390 if (ret_var.is_owned) {
30395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30396 LDKChannelDetails arg_conv;
30397 arg_conv.inner = (void*)(arg & (~1));
30398 arg_conv.is_owned = false;
30399 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30400 int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
30404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30405 LDKChannelDetails orig_conv;
30406 orig_conv.inner = (void*)(orig & (~1));
30407 orig_conv.is_owned = false;
30408 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30409 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
30410 int64_t ret_ref = 0;
30411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30414 ret_ref = (uintptr_t)ret_var.inner;
30415 if (ret_var.is_owned) {
30421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30422 LDKChannelDetails this_arg_conv;
30423 this_arg_conv.inner = (void*)(this_arg & (~1));
30424 this_arg_conv.is_owned = false;
30425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30426 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30427 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
30428 int64_t ret_ref = (uintptr_t)ret_copy;
30432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30433 LDKChannelDetails this_arg_conv;
30434 this_arg_conv.inner = (void*)(this_arg & (~1));
30435 this_arg_conv.is_owned = false;
30436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30437 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30438 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
30439 int64_t ret_ref = (uintptr_t)ret_copy;
30443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30444 if ((this_ptr & 1) != 0) return;
30445 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30446 CHECK_ACCESS(this_ptr_ptr);
30447 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
30448 FREE((void*)this_ptr);
30449 PaymentSendFailure_free(this_ptr_conv);
30452 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
30453 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30454 *ret_copy = PaymentSendFailure_clone(arg);
30455 int64_t ret_ref = (uintptr_t)ret_copy;
30458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30459 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
30460 int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
30464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30465 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
30466 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30467 *ret_copy = PaymentSendFailure_clone(orig_conv);
30468 int64_t ret_ref = (uintptr_t)ret_copy;
30472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
30473 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
30474 CHECK_ACCESS(a_ptr);
30475 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
30476 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
30477 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30478 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
30479 int64_t ret_ref = (uintptr_t)ret_copy;
30483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
30484 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
30485 a_constr.datalen = (*env)->GetArrayLength(env, a);
30486 if (a_constr.datalen > 0)
30487 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
30489 a_constr.data = NULL;
30490 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30491 for (size_t w = 0; w < a_constr.datalen; w++) {
30492 int64_t a_conv_22 = a_vals[w];
30493 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
30494 CHECK_ACCESS(a_conv_22_ptr);
30495 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
30496 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
30497 a_constr.data[w] = a_conv_22_conv;
30499 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30500 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30501 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
30502 int64_t ret_ref = (uintptr_t)ret_copy;
30506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
30507 LDKCVec_APIErrorZ a_constr;
30508 a_constr.datalen = (*env)->GetArrayLength(env, a);
30509 if (a_constr.datalen > 0)
30510 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
30512 a_constr.data = NULL;
30513 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30514 for (size_t k = 0; k < a_constr.datalen; k++) {
30515 int64_t a_conv_10 = a_vals[k];
30516 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
30517 CHECK_ACCESS(a_conv_10_ptr);
30518 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
30519 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
30520 a_constr.data[k] = a_conv_10_conv;
30522 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30523 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30524 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
30525 int64_t ret_ref = (uintptr_t)ret_copy;
30529 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) {
30530 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
30531 results_constr.datalen = (*env)->GetArrayLength(env, results);
30532 if (results_constr.datalen > 0)
30533 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
30535 results_constr.data = NULL;
30536 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
30537 for (size_t w = 0; w < results_constr.datalen; w++) {
30538 int64_t results_conv_22 = results_vals[w];
30539 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
30540 CHECK_ACCESS(results_conv_22_ptr);
30541 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
30542 results_constr.data[w] = results_conv_22_conv;
30544 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
30545 LDKRouteParameters failed_paths_retry_conv;
30546 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
30547 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
30548 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
30549 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
30550 LDKThirtyTwoBytes payment_id_ref;
30551 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30552 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30553 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30554 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
30555 int64_t ret_ref = (uintptr_t)ret_copy;
30559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30560 LDKPhantomRouteHints this_obj_conv;
30561 this_obj_conv.inner = (void*)(this_obj & (~1));
30562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30564 PhantomRouteHints_free(this_obj_conv);
30567 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
30568 LDKPhantomRouteHints this_ptr_conv;
30569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30570 this_ptr_conv.is_owned = false;
30571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30572 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
30573 int64_tArray ret_arr = NULL;
30574 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30575 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30576 for (size_t q = 0; q < ret_var.datalen; q++) {
30577 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30578 int64_t ret_conv_16_ref = 0;
30579 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30580 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30582 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30583 if (ret_conv_16_var.is_owned) {
30584 ret_conv_16_ref |= 1;
30586 ret_arr_ptr[q] = ret_conv_16_ref;
30588 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30589 FREE(ret_var.data);
30593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30594 LDKPhantomRouteHints this_ptr_conv;
30595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30596 this_ptr_conv.is_owned = false;
30597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30598 LDKCVec_ChannelDetailsZ val_constr;
30599 val_constr.datalen = (*env)->GetArrayLength(env, val);
30600 if (val_constr.datalen > 0)
30601 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30603 val_constr.data = NULL;
30604 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30605 for (size_t q = 0; q < val_constr.datalen; q++) {
30606 int64_t val_conv_16 = val_vals[q];
30607 LDKChannelDetails val_conv_16_conv;
30608 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
30609 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
30610 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
30611 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
30612 val_constr.data[q] = val_conv_16_conv;
30614 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30615 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
30618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
30619 LDKPhantomRouteHints this_ptr_conv;
30620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30621 this_ptr_conv.is_owned = false;
30622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30623 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
30627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30628 LDKPhantomRouteHints this_ptr_conv;
30629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30630 this_ptr_conv.is_owned = false;
30631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30632 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
30635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30636 LDKPhantomRouteHints this_ptr_conv;
30637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30638 this_ptr_conv.is_owned = false;
30639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30640 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30641 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
30645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30646 LDKPhantomRouteHints this_ptr_conv;
30647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30648 this_ptr_conv.is_owned = false;
30649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30650 LDKPublicKey val_ref;
30651 CHECK((*env)->GetArrayLength(env, val) == 33);
30652 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30653 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
30656 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) {
30657 LDKCVec_ChannelDetailsZ channels_arg_constr;
30658 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
30659 if (channels_arg_constr.datalen > 0)
30660 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30662 channels_arg_constr.data = NULL;
30663 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
30664 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
30665 int64_t channels_arg_conv_16 = channels_arg_vals[q];
30666 LDKChannelDetails channels_arg_conv_16_conv;
30667 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
30668 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
30669 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
30670 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
30671 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
30673 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
30674 LDKPublicKey real_node_pubkey_arg_ref;
30675 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
30676 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
30677 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
30678 int64_t ret_ref = 0;
30679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30682 ret_ref = (uintptr_t)ret_var.inner;
30683 if (ret_var.is_owned) {
30689 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
30690 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
30691 int64_t ret_ref = 0;
30692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30695 ret_ref = (uintptr_t)ret_var.inner;
30696 if (ret_var.is_owned) {
30701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30702 LDKPhantomRouteHints arg_conv;
30703 arg_conv.inner = (void*)(arg & (~1));
30704 arg_conv.is_owned = false;
30705 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30706 int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
30710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30711 LDKPhantomRouteHints orig_conv;
30712 orig_conv.inner = (void*)(orig & (~1));
30713 orig_conv.is_owned = false;
30714 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30715 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
30716 int64_t ret_ref = 0;
30717 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30718 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30720 ret_ref = (uintptr_t)ret_var.inner;
30721 if (ret_var.is_owned) {
30727 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) {
30728 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
30729 CHECK_ACCESS(fee_est_ptr);
30730 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
30731 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
30732 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30733 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
30735 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
30736 CHECK_ACCESS(chain_monitor_ptr);
30737 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30738 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30739 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30740 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30742 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
30743 CHECK_ACCESS(tx_broadcaster_ptr);
30744 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30745 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30746 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30747 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30749 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
30750 CHECK_ACCESS(logger_ptr);
30751 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30752 if (logger_conv.free == LDKLogger_JCalls_free) {
30753 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30754 LDKLogger_JCalls_cloned(&logger_conv);
30756 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30757 CHECK_ACCESS(keys_manager_ptr);
30758 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30759 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30761 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30763 LDKUserConfig config_conv;
30764 config_conv.inner = (void*)(config & (~1));
30765 config_conv.is_owned = (config & 1) || (config == 0);
30766 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
30767 config_conv = UserConfig_clone(&config_conv);
30768 LDKChainParameters params_conv;
30769 params_conv.inner = (void*)(params & (~1));
30770 params_conv.is_owned = (params & 1) || (params == 0);
30771 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
30772 params_conv = ChainParameters_clone(¶ms_conv);
30773 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
30774 int64_t ret_ref = 0;
30775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30778 ret_ref = (uintptr_t)ret_var.inner;
30779 if (ret_var.is_owned) {
30785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
30786 LDKChannelManager this_arg_conv;
30787 this_arg_conv.inner = (void*)(this_arg & (~1));
30788 this_arg_conv.is_owned = false;
30789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30790 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
30791 int64_t ret_ref = 0;
30792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30795 ret_ref = (uintptr_t)ret_var.inner;
30796 if (ret_var.is_owned) {
30802 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) {
30803 LDKChannelManager this_arg_conv;
30804 this_arg_conv.inner = (void*)(this_arg & (~1));
30805 this_arg_conv.is_owned = false;
30806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30807 LDKPublicKey their_network_key_ref;
30808 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
30809 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
30810 LDKUserConfig override_config_conv;
30811 override_config_conv.inner = (void*)(override_config & (~1));
30812 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
30813 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
30814 override_config_conv = UserConfig_clone(&override_config_conv);
30815 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
30816 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
30817 return (int64_t)ret_conv;
30820 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30821 LDKChannelManager this_arg_conv;
30822 this_arg_conv.inner = (void*)(this_arg & (~1));
30823 this_arg_conv.is_owned = false;
30824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30825 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
30826 int64_tArray ret_arr = NULL;
30827 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30828 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30829 for (size_t q = 0; q < ret_var.datalen; q++) {
30830 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30831 int64_t ret_conv_16_ref = 0;
30832 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30833 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30835 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30836 if (ret_conv_16_var.is_owned) {
30837 ret_conv_16_ref |= 1;
30839 ret_arr_ptr[q] = ret_conv_16_ref;
30841 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30842 FREE(ret_var.data);
30846 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30847 LDKChannelManager this_arg_conv;
30848 this_arg_conv.inner = (void*)(this_arg & (~1));
30849 this_arg_conv.is_owned = false;
30850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30851 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
30852 int64_tArray ret_arr = NULL;
30853 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30854 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30855 for (size_t q = 0; q < ret_var.datalen; q++) {
30856 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30857 int64_t ret_conv_16_ref = 0;
30858 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30859 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30861 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30862 if (ret_conv_16_var.is_owned) {
30863 ret_conv_16_ref |= 1;
30865 ret_arr_ptr[q] = ret_conv_16_ref;
30867 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30868 FREE(ret_var.data);
30872 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) {
30873 LDKChannelManager this_arg_conv;
30874 this_arg_conv.inner = (void*)(this_arg & (~1));
30875 this_arg_conv.is_owned = false;
30876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30877 unsigned char channel_id_arr[32];
30878 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30879 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30880 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30881 LDKPublicKey counterparty_node_id_ref;
30882 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30883 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30884 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30885 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30886 return (int64_t)ret_conv;
30889 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) {
30890 LDKChannelManager this_arg_conv;
30891 this_arg_conv.inner = (void*)(this_arg & (~1));
30892 this_arg_conv.is_owned = false;
30893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30894 unsigned char channel_id_arr[32];
30895 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30896 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30897 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30898 LDKPublicKey counterparty_node_id_ref;
30899 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30900 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30901 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30902 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
30903 return (int64_t)ret_conv;
30906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
30907 LDKChannelManager this_arg_conv;
30908 this_arg_conv.inner = (void*)(this_arg & (~1));
30909 this_arg_conv.is_owned = false;
30910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30911 unsigned char channel_id_arr[32];
30912 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30913 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30914 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30915 LDKPublicKey counterparty_node_id_ref;
30916 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30917 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30918 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30919 *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30920 return (int64_t)ret_conv;
30923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
30924 LDKChannelManager this_arg_conv;
30925 this_arg_conv.inner = (void*)(this_arg & (~1));
30926 this_arg_conv.is_owned = false;
30927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30928 unsigned char channel_id_arr[32];
30929 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30930 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30931 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30932 LDKPublicKey counterparty_node_id_ref;
30933 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30934 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30935 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30936 *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30937 return (int64_t)ret_conv;
30940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30941 LDKChannelManager this_arg_conv;
30942 this_arg_conv.inner = (void*)(this_arg & (~1));
30943 this_arg_conv.is_owned = false;
30944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30945 ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
30948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30949 LDKChannelManager this_arg_conv;
30950 this_arg_conv.inner = (void*)(this_arg & (~1));
30951 this_arg_conv.is_owned = false;
30952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30953 ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
30956 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) {
30957 LDKChannelManager this_arg_conv;
30958 this_arg_conv.inner = (void*)(this_arg & (~1));
30959 this_arg_conv.is_owned = false;
30960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30961 LDKRoute route_conv;
30962 route_conv.inner = (void*)(route & (~1));
30963 route_conv.is_owned = false;
30964 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30965 LDKThirtyTwoBytes payment_hash_ref;
30966 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30967 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30968 LDKThirtyTwoBytes payment_secret_ref;
30969 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30970 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30971 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
30972 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
30973 return (int64_t)ret_conv;
30976 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) {
30977 LDKChannelManager this_arg_conv;
30978 this_arg_conv.inner = (void*)(this_arg & (~1));
30979 this_arg_conv.is_owned = false;
30980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30981 LDKRoute route_conv;
30982 route_conv.inner = (void*)(route & (~1));
30983 route_conv.is_owned = false;
30984 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30985 LDKThirtyTwoBytes payment_id_ref;
30986 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30987 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30988 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30989 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
30990 return (int64_t)ret_conv;
30993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
30994 LDKChannelManager this_arg_conv;
30995 this_arg_conv.inner = (void*)(this_arg & (~1));
30996 this_arg_conv.is_owned = false;
30997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30998 LDKThirtyTwoBytes payment_id_ref;
30999 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
31000 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
31001 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
31004 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) {
31005 LDKChannelManager this_arg_conv;
31006 this_arg_conv.inner = (void*)(this_arg & (~1));
31007 this_arg_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31009 LDKRoute route_conv;
31010 route_conv.inner = (void*)(route & (~1));
31011 route_conv.is_owned = false;
31012 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
31013 LDKThirtyTwoBytes payment_preimage_ref;
31014 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31015 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31016 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31017 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
31018 return (int64_t)ret_conv;
31021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
31022 LDKChannelManager this_arg_conv;
31023 this_arg_conv.inner = (void*)(this_arg & (~1));
31024 this_arg_conv.is_owned = false;
31025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31026 LDKCVec_RouteHopZ hops_constr;
31027 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
31028 if (hops_constr.datalen > 0)
31029 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
31031 hops_constr.data = NULL;
31032 int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
31033 for (size_t k = 0; k < hops_constr.datalen; k++) {
31034 int64_t hops_conv_10 = hops_vals[k];
31035 LDKRouteHop hops_conv_10_conv;
31036 hops_conv_10_conv.inner = (void*)(hops_conv_10 & (~1));
31037 hops_conv_10_conv.is_owned = (hops_conv_10 & 1) || (hops_conv_10 == 0);
31038 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
31039 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
31040 hops_constr.data[k] = hops_conv_10_conv;
31042 (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
31043 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31044 *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
31045 return (int64_t)ret_conv;
31048 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) {
31049 LDKChannelManager this_arg_conv;
31050 this_arg_conv.inner = (void*)(this_arg & (~1));
31051 this_arg_conv.is_owned = false;
31052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31053 unsigned char temporary_channel_id_arr[32];
31054 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31055 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31056 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31057 LDKPublicKey counterparty_node_id_ref;
31058 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31059 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31060 LDKTransaction funding_transaction_ref;
31061 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
31062 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
31063 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
31064 funding_transaction_ref.data_is_owned = true;
31065 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31066 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
31067 return (int64_t)ret_conv;
31070 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) {
31071 LDKChannelManager this_arg_conv;
31072 this_arg_conv.inner = (void*)(this_arg & (~1));
31073 this_arg_conv.is_owned = false;
31074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31075 LDKThreeBytes rgb_ref;
31076 CHECK((*env)->GetArrayLength(env, rgb) == 3);
31077 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
31078 LDKThirtyTwoBytes alias_ref;
31079 CHECK((*env)->GetArrayLength(env, alias) == 32);
31080 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
31081 LDKCVec_NetAddressZ addresses_constr;
31082 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
31083 if (addresses_constr.datalen > 0)
31084 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
31086 addresses_constr.data = NULL;
31087 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
31088 for (size_t m = 0; m < addresses_constr.datalen; m++) {
31089 int64_t addresses_conv_12 = addresses_vals[m];
31090 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
31091 CHECK_ACCESS(addresses_conv_12_ptr);
31092 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
31093 addresses_constr.data[m] = addresses_conv_12_conv;
31095 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
31096 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
31099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
31100 LDKChannelManager this_arg_conv;
31101 this_arg_conv.inner = (void*)(this_arg & (~1));
31102 this_arg_conv.is_owned = false;
31103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31104 LDKPublicKey counterparty_node_id_ref;
31105 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31106 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31107 LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
31108 channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
31109 if (channel_ids_constr.datalen > 0)
31110 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
31112 channel_ids_constr.data = NULL;
31113 for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
31114 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
31115 LDKThirtyTwoBytes channel_ids_conv_8_ref;
31116 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
31117 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
31118 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
31120 LDKChannelConfig config_conv;
31121 config_conv.inner = (void*)(config & (~1));
31122 config_conv.is_owned = false;
31123 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
31124 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31125 *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
31126 return (int64_t)ret_conv;
31129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
31130 LDKChannelManager this_arg_conv;
31131 this_arg_conv.inner = (void*)(this_arg & (~1));
31132 this_arg_conv.is_owned = false;
31133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31134 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
31137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
31138 LDKChannelManager this_arg_conv;
31139 this_arg_conv.inner = (void*)(this_arg & (~1));
31140 this_arg_conv.is_owned = false;
31141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31142 ChannelManager_timer_tick_occurred(&this_arg_conv);
31145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
31146 LDKChannelManager this_arg_conv;
31147 this_arg_conv.inner = (void*)(this_arg & (~1));
31148 this_arg_conv.is_owned = false;
31149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31150 unsigned char payment_hash_arr[32];
31151 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31152 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
31153 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
31154 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
31157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
31158 LDKChannelManager this_arg_conv;
31159 this_arg_conv.inner = (void*)(this_arg & (~1));
31160 this_arg_conv.is_owned = false;
31161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31162 LDKThirtyTwoBytes payment_preimage_ref;
31163 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31164 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31165 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
31168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
31169 LDKChannelManager this_arg_conv;
31170 this_arg_conv.inner = (void*)(this_arg & (~1));
31171 this_arg_conv.is_owned = false;
31172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31173 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31174 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
31178 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) {
31179 LDKChannelManager this_arg_conv;
31180 this_arg_conv.inner = (void*)(this_arg & (~1));
31181 this_arg_conv.is_owned = false;
31182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31183 unsigned char temporary_channel_id_arr[32];
31184 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31185 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31186 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31187 LDKPublicKey counterparty_node_id_ref;
31188 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31189 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31190 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31191 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31192 return (int64_t)ret_conv;
31195 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) {
31196 LDKChannelManager this_arg_conv;
31197 this_arg_conv.inner = (void*)(this_arg & (~1));
31198 this_arg_conv.is_owned = false;
31199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31200 unsigned char temporary_channel_id_arr[32];
31201 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31202 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31203 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31204 LDKPublicKey counterparty_node_id_ref;
31205 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31206 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31207 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31208 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31209 return (int64_t)ret_conv;
31212 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) {
31213 LDKChannelManager this_arg_conv;
31214 this_arg_conv.inner = (void*)(this_arg & (~1));
31215 this_arg_conv.is_owned = false;
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31217 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31218 CHECK_ACCESS(min_value_msat_ptr);
31219 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31220 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31221 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31222 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31223 return (int64_t)ret_conv;
31226 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) {
31227 LDKChannelManager this_arg_conv;
31228 this_arg_conv.inner = (void*)(this_arg & (~1));
31229 this_arg_conv.is_owned = false;
31230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31231 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31232 CHECK_ACCESS(min_value_msat_ptr);
31233 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31234 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31235 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
31236 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31237 return (int64_t)ret_conv;
31240 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) {
31241 LDKChannelManager this_arg_conv;
31242 this_arg_conv.inner = (void*)(this_arg & (~1));
31243 this_arg_conv.is_owned = false;
31244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31245 LDKThirtyTwoBytes payment_hash_ref;
31246 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31247 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31248 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31249 CHECK_ACCESS(min_value_msat_ptr);
31250 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31251 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31252 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31253 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31254 return (int64_t)ret_conv;
31257 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) {
31258 LDKChannelManager this_arg_conv;
31259 this_arg_conv.inner = (void*)(this_arg & (~1));
31260 this_arg_conv.is_owned = false;
31261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31262 LDKThirtyTwoBytes payment_hash_ref;
31263 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31264 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31265 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31266 CHECK_ACCESS(min_value_msat_ptr);
31267 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31268 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31269 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
31270 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31271 return (int64_t)ret_conv;
31274 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) {
31275 LDKChannelManager this_arg_conv;
31276 this_arg_conv.inner = (void*)(this_arg & (~1));
31277 this_arg_conv.is_owned = false;
31278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31279 LDKThirtyTwoBytes payment_hash_ref;
31280 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31281 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31282 LDKThirtyTwoBytes payment_secret_ref;
31283 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
31284 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
31285 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
31286 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
31287 return (int64_t)ret_conv;
31290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
31291 LDKChannelManager this_arg_conv;
31292 this_arg_conv.inner = (void*)(this_arg & (~1));
31293 this_arg_conv.is_owned = false;
31294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31295 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
31299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
31300 LDKChannelManager this_arg_conv;
31301 this_arg_conv.inner = (void*)(this_arg & (~1));
31302 this_arg_conv.is_owned = false;
31303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31304 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
31305 int64_t ret_ref = 0;
31306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31309 ret_ref = (uintptr_t)ret_var.inner;
31310 if (ret_var.is_owned) {
31316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31317 LDKChannelManager this_arg_conv;
31318 this_arg_conv.inner = (void*)(this_arg & (~1));
31319 this_arg_conv.is_owned = false;
31320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31321 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31322 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
31323 return (int64_t)ret_ret;
31326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31327 LDKChannelManager this_arg_conv;
31328 this_arg_conv.inner = (void*)(this_arg & (~1));
31329 this_arg_conv.is_owned = false;
31330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31331 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
31332 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
31333 return (int64_t)ret_ret;
31336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
31337 LDKChannelManager this_arg_conv;
31338 this_arg_conv.inner = (void*)(this_arg & (~1));
31339 this_arg_conv.is_owned = false;
31340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31341 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
31342 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
31343 return (int64_t)ret_ret;
31346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
31347 LDKChannelManager this_arg_conv;
31348 this_arg_conv.inner = (void*)(this_arg & (~1));
31349 this_arg_conv.is_owned = false;
31350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31351 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
31352 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
31353 return (int64_t)ret_ret;
31356 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) {
31357 LDKChannelManager this_arg_conv;
31358 this_arg_conv.inner = (void*)(this_arg & (~1));
31359 this_arg_conv.is_owned = false;
31360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31361 jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
31365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
31366 LDKChannelManager this_arg_conv;
31367 this_arg_conv.inner = (void*)(this_arg & (~1));
31368 this_arg_conv.is_owned = false;
31369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31370 ChannelManager_await_persistable_update(&this_arg_conv);
31373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
31374 LDKChannelManager this_arg_conv;
31375 this_arg_conv.inner = (void*)(this_arg & (~1));
31376 this_arg_conv.is_owned = false;
31377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31378 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
31379 int64_t ret_ref = 0;
31380 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31381 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31383 ret_ref = (uintptr_t)ret_var.inner;
31384 if (ret_var.is_owned) {
31390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
31391 LDKChannelManager this_arg_conv;
31392 this_arg_conv.inner = (void*)(this_arg & (~1));
31393 this_arg_conv.is_owned = false;
31394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31395 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
31396 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
31397 return (int64_t)ret_ret;
31400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
31401 LDKCounterpartyForwardingInfo obj_conv;
31402 obj_conv.inner = (void*)(obj & (~1));
31403 obj_conv.is_owned = false;
31404 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31405 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
31406 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31407 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31408 CVec_u8Z_free(ret_var);
31412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31413 LDKu8slice ser_ref;
31414 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31415 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31416 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31417 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
31418 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31419 return (int64_t)ret_conv;
31422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
31423 LDKChannelCounterparty obj_conv;
31424 obj_conv.inner = (void*)(obj & (~1));
31425 obj_conv.is_owned = false;
31426 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31427 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
31428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31430 CVec_u8Z_free(ret_var);
31434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31435 LDKu8slice ser_ref;
31436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31438 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31439 *ret_conv = ChannelCounterparty_read(ser_ref);
31440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31441 return (int64_t)ret_conv;
31444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
31445 LDKChannelDetails obj_conv;
31446 obj_conv.inner = (void*)(obj & (~1));
31447 obj_conv.is_owned = false;
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31449 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
31450 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31451 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31452 CVec_u8Z_free(ret_var);
31456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31457 LDKu8slice ser_ref;
31458 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31459 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31460 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31461 *ret_conv = ChannelDetails_read(ser_ref);
31462 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31463 return (int64_t)ret_conv;
31466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
31467 LDKPhantomRouteHints obj_conv;
31468 obj_conv.inner = (void*)(obj & (~1));
31469 obj_conv.is_owned = false;
31470 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31471 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
31472 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31473 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31474 CVec_u8Z_free(ret_var);
31478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31479 LDKu8slice ser_ref;
31480 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31481 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31482 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
31483 *ret_conv = PhantomRouteHints_read(ser_ref);
31484 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31485 return (int64_t)ret_conv;
31488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
31489 LDKChannelManager obj_conv;
31490 obj_conv.inner = (void*)(obj & (~1));
31491 obj_conv.is_owned = false;
31492 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31493 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
31494 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31495 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31496 CVec_u8Z_free(ret_var);
31500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31501 LDKChannelManagerReadArgs this_obj_conv;
31502 this_obj_conv.inner = (void*)(this_obj & (~1));
31503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31505 ChannelManagerReadArgs_free(this_obj_conv);
31508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
31509 LDKChannelManagerReadArgs this_ptr_conv;
31510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31511 this_ptr_conv.is_owned = false;
31512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31513 // WARNING: This object doesn't live past this scope, needs clone!
31514 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
31518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31519 LDKChannelManagerReadArgs this_ptr_conv;
31520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31521 this_ptr_conv.is_owned = false;
31522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31523 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31524 CHECK_ACCESS(val_ptr);
31525 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
31526 if (val_conv.free == LDKKeysInterface_JCalls_free) {
31527 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31528 LDKKeysInterface_JCalls_cloned(&val_conv);
31530 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
31533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
31534 LDKChannelManagerReadArgs this_ptr_conv;
31535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31536 this_ptr_conv.is_owned = false;
31537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31538 // WARNING: This object doesn't live past this scope, needs clone!
31539 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
31543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31544 LDKChannelManagerReadArgs this_ptr_conv;
31545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31546 this_ptr_conv.is_owned = false;
31547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31548 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31549 CHECK_ACCESS(val_ptr);
31550 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
31551 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
31552 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31553 LDKFeeEstimator_JCalls_cloned(&val_conv);
31555 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
31558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
31559 LDKChannelManagerReadArgs this_ptr_conv;
31560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31561 this_ptr_conv.is_owned = false;
31562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31563 // WARNING: This object doesn't live past this scope, needs clone!
31564 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
31568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31569 LDKChannelManagerReadArgs this_ptr_conv;
31570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31571 this_ptr_conv.is_owned = false;
31572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31573 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31574 CHECK_ACCESS(val_ptr);
31575 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
31576 if (val_conv.free == LDKWatch_JCalls_free) {
31577 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31578 LDKWatch_JCalls_cloned(&val_conv);
31580 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
31583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
31584 LDKChannelManagerReadArgs 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 // WARNING: This object doesn't live past this scope, needs clone!
31589 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
31593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31594 LDKChannelManagerReadArgs 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31599 CHECK_ACCESS(val_ptr);
31600 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
31601 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
31602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31603 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
31605 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
31608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
31609 LDKChannelManagerReadArgs this_ptr_conv;
31610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31611 this_ptr_conv.is_owned = false;
31612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31613 // WARNING: This object doesn't live past this scope, needs clone!
31614 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
31618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31619 LDKChannelManagerReadArgs this_ptr_conv;
31620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31621 this_ptr_conv.is_owned = false;
31622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31623 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31624 CHECK_ACCESS(val_ptr);
31625 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
31626 if (val_conv.free == LDKLogger_JCalls_free) {
31627 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31628 LDKLogger_JCalls_cloned(&val_conv);
31630 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
31633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
31634 LDKChannelManagerReadArgs this_ptr_conv;
31635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31636 this_ptr_conv.is_owned = false;
31637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31638 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
31639 int64_t ret_ref = 0;
31640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31643 ret_ref = (uintptr_t)ret_var.inner;
31644 if (ret_var.is_owned) {
31650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31651 LDKChannelManagerReadArgs this_ptr_conv;
31652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31653 this_ptr_conv.is_owned = false;
31654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31655 LDKUserConfig val_conv;
31656 val_conv.inner = (void*)(val & (~1));
31657 val_conv.is_owned = (val & 1) || (val == 0);
31658 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31659 val_conv = UserConfig_clone(&val_conv);
31660 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
31663 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) {
31664 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
31665 CHECK_ACCESS(keys_manager_ptr);
31666 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
31667 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
31668 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31669 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
31671 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
31672 CHECK_ACCESS(fee_estimator_ptr);
31673 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
31674 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
31675 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31676 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
31678 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
31679 CHECK_ACCESS(chain_monitor_ptr);
31680 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
31681 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
31682 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31683 LDKWatch_JCalls_cloned(&chain_monitor_conv);
31685 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
31686 CHECK_ACCESS(tx_broadcaster_ptr);
31687 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
31688 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31689 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31690 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
31692 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
31693 CHECK_ACCESS(logger_ptr);
31694 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31695 if (logger_conv.free == LDKLogger_JCalls_free) {
31696 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31697 LDKLogger_JCalls_cloned(&logger_conv);
31699 LDKUserConfig default_config_conv;
31700 default_config_conv.inner = (void*)(default_config & (~1));
31701 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
31702 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
31703 default_config_conv = UserConfig_clone(&default_config_conv);
31704 LDKCVec_ChannelMonitorZ channel_monitors_constr;
31705 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
31706 if (channel_monitors_constr.datalen > 0)
31707 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
31709 channel_monitors_constr.data = NULL;
31710 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
31711 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
31712 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
31713 LDKChannelMonitor channel_monitors_conv_16_conv;
31714 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
31715 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
31716 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
31717 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
31719 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
31720 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);
31721 int64_t ret_ref = 0;
31722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31725 ret_ref = (uintptr_t)ret_var.inner;
31726 if (ret_var.is_owned) {
31732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
31733 LDKu8slice ser_ref;
31734 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31735 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31736 LDKChannelManagerReadArgs arg_conv;
31737 arg_conv.inner = (void*)(arg & (~1));
31738 arg_conv.is_owned = (arg & 1) || (arg == 0);
31739 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31740 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
31741 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
31742 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
31743 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31744 return (int64_t)ret_conv;
31747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31748 LDKExpandedKey this_obj_conv;
31749 this_obj_conv.inner = (void*)(this_obj & (~1));
31750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31752 ExpandedKey_free(this_obj_conv);
31755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
31756 unsigned char key_material_arr[32];
31757 CHECK((*env)->GetArrayLength(env, key_material) == 32);
31758 (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
31759 unsigned char (*key_material_ref)[32] = &key_material_arr;
31760 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
31761 int64_t ret_ref = 0;
31762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31765 ret_ref = (uintptr_t)ret_var.inner;
31766 if (ret_var.is_owned) {
31772 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) {
31773 LDKExpandedKey keys_conv;
31774 keys_conv.inner = (void*)(keys & (~1));
31775 keys_conv.is_owned = false;
31776 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31777 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31778 CHECK_ACCESS(min_value_msat_ptr);
31779 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31780 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31781 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
31782 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
31783 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
31784 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31785 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
31786 return (int64_t)ret_conv;
31789 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) {
31790 LDKExpandedKey keys_conv;
31791 keys_conv.inner = (void*)(keys & (~1));
31792 keys_conv.is_owned = false;
31793 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31794 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31795 CHECK_ACCESS(min_value_msat_ptr);
31796 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31797 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31798 LDKThirtyTwoBytes payment_hash_ref;
31799 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31800 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31801 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31802 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
31803 return (int64_t)ret_conv;
31806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31807 LDKDecodeError this_obj_conv;
31808 this_obj_conv.inner = (void*)(this_obj & (~1));
31809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31811 DecodeError_free(this_obj_conv);
31814 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
31815 LDKDecodeError ret_var = DecodeError_clone(arg);
31816 int64_t ret_ref = 0;
31817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31820 ret_ref = (uintptr_t)ret_var.inner;
31821 if (ret_var.is_owned) {
31826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31827 LDKDecodeError arg_conv;
31828 arg_conv.inner = (void*)(arg & (~1));
31829 arg_conv.is_owned = false;
31830 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31831 int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
31835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31836 LDKDecodeError orig_conv;
31837 orig_conv.inner = (void*)(orig & (~1));
31838 orig_conv.is_owned = false;
31839 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31840 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
31841 int64_t ret_ref = 0;
31842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31845 ret_ref = (uintptr_t)ret_var.inner;
31846 if (ret_var.is_owned) {
31852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31853 LDKInit this_obj_conv;
31854 this_obj_conv.inner = (void*)(this_obj & (~1));
31855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31857 Init_free(this_obj_conv);
31860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
31861 LDKInit 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 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
31866 int64_t ret_ref = 0;
31867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31870 ret_ref = (uintptr_t)ret_var.inner;
31871 if (ret_var.is_owned) {
31877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31878 LDKInit this_ptr_conv;
31879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31880 this_ptr_conv.is_owned = false;
31881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31882 LDKInitFeatures val_conv;
31883 val_conv.inner = (void*)(val & (~1));
31884 val_conv.is_owned = (val & 1) || (val == 0);
31885 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31886 val_conv = InitFeatures_clone(&val_conv);
31887 Init_set_features(&this_ptr_conv, val_conv);
31890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
31891 LDKInit this_ptr_conv;
31892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31893 this_ptr_conv.is_owned = false;
31894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31895 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
31896 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
31897 int64_t ret_ref = (uintptr_t)ret_copy;
31901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31902 LDKInit this_ptr_conv;
31903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31904 this_ptr_conv.is_owned = false;
31905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31906 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31907 CHECK_ACCESS(val_ptr);
31908 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
31909 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
31910 Init_set_remote_network_address(&this_ptr_conv, val_conv);
31913 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) {
31914 LDKInitFeatures features_arg_conv;
31915 features_arg_conv.inner = (void*)(features_arg & (~1));
31916 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31917 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31918 features_arg_conv = InitFeatures_clone(&features_arg_conv);
31919 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
31920 CHECK_ACCESS(remote_network_address_arg_ptr);
31921 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
31922 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
31923 int64_t ret_ref = 0;
31924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31927 ret_ref = (uintptr_t)ret_var.inner;
31928 if (ret_var.is_owned) {
31934 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
31935 LDKInit ret_var = Init_clone(arg);
31936 int64_t ret_ref = 0;
31937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31940 ret_ref = (uintptr_t)ret_var.inner;
31941 if (ret_var.is_owned) {
31946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31948 arg_conv.inner = (void*)(arg & (~1));
31949 arg_conv.is_owned = false;
31950 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31951 int64_t ret_conv = Init_clone_ptr(&arg_conv);
31955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31957 orig_conv.inner = (void*)(orig & (~1));
31958 orig_conv.is_owned = false;
31959 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31960 LDKInit ret_var = Init_clone(&orig_conv);
31961 int64_t ret_ref = 0;
31962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31965 ret_ref = (uintptr_t)ret_var.inner;
31966 if (ret_var.is_owned) {
31972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31973 LDKErrorMessage this_obj_conv;
31974 this_obj_conv.inner = (void*)(this_obj & (~1));
31975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31977 ErrorMessage_free(this_obj_conv);
31980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31981 LDKErrorMessage this_ptr_conv;
31982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31983 this_ptr_conv.is_owned = false;
31984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31985 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31986 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
31990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31991 LDKErrorMessage this_ptr_conv;
31992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31993 this_ptr_conv.is_owned = false;
31994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31995 LDKThirtyTwoBytes val_ref;
31996 CHECK((*env)->GetArrayLength(env, val) == 32);
31997 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31998 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
32001 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32002 LDKErrorMessage this_ptr_conv;
32003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32004 this_ptr_conv.is_owned = false;
32005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
32007 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32013 LDKErrorMessage this_ptr_conv;
32014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32015 this_ptr_conv.is_owned = false;
32016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017 LDKStr val_conv = java_to_owned_str(env, val);
32018 ErrorMessage_set_data(&this_ptr_conv, val_conv);
32021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32022 LDKThirtyTwoBytes channel_id_arg_ref;
32023 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32024 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32025 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32026 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
32027 int64_t ret_ref = 0;
32028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32031 ret_ref = (uintptr_t)ret_var.inner;
32032 if (ret_var.is_owned) {
32038 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
32039 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
32040 int64_t ret_ref = 0;
32041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32044 ret_ref = (uintptr_t)ret_var.inner;
32045 if (ret_var.is_owned) {
32050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32051 LDKErrorMessage arg_conv;
32052 arg_conv.inner = (void*)(arg & (~1));
32053 arg_conv.is_owned = false;
32054 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32055 int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
32059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32060 LDKErrorMessage orig_conv;
32061 orig_conv.inner = (void*)(orig & (~1));
32062 orig_conv.is_owned = false;
32063 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32064 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
32065 int64_t ret_ref = 0;
32066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32069 ret_ref = (uintptr_t)ret_var.inner;
32070 if (ret_var.is_owned) {
32076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32077 LDKWarningMessage this_obj_conv;
32078 this_obj_conv.inner = (void*)(this_obj & (~1));
32079 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32081 WarningMessage_free(this_obj_conv);
32084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32085 LDKWarningMessage this_ptr_conv;
32086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32087 this_ptr_conv.is_owned = false;
32088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32089 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32090 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
32094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32095 LDKWarningMessage 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 LDKThirtyTwoBytes val_ref;
32100 CHECK((*env)->GetArrayLength(env, val) == 32);
32101 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32102 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
32105 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32106 LDKWarningMessage this_ptr_conv;
32107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32108 this_ptr_conv.is_owned = false;
32109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32110 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
32111 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32117 LDKWarningMessage this_ptr_conv;
32118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32119 this_ptr_conv.is_owned = false;
32120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32121 LDKStr val_conv = java_to_owned_str(env, val);
32122 WarningMessage_set_data(&this_ptr_conv, val_conv);
32125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32126 LDKThirtyTwoBytes channel_id_arg_ref;
32127 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32128 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32129 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32130 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
32131 int64_t ret_ref = 0;
32132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32135 ret_ref = (uintptr_t)ret_var.inner;
32136 if (ret_var.is_owned) {
32142 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
32143 LDKWarningMessage ret_var = WarningMessage_clone(arg);
32144 int64_t ret_ref = 0;
32145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32148 ret_ref = (uintptr_t)ret_var.inner;
32149 if (ret_var.is_owned) {
32154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32155 LDKWarningMessage arg_conv;
32156 arg_conv.inner = (void*)(arg & (~1));
32157 arg_conv.is_owned = false;
32158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32159 int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
32163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32164 LDKWarningMessage orig_conv;
32165 orig_conv.inner = (void*)(orig & (~1));
32166 orig_conv.is_owned = false;
32167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32168 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
32169 int64_t ret_ref = 0;
32170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32173 ret_ref = (uintptr_t)ret_var.inner;
32174 if (ret_var.is_owned) {
32180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32181 LDKPing this_obj_conv;
32182 this_obj_conv.inner = (void*)(this_obj & (~1));
32183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32185 Ping_free(this_obj_conv);
32188 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32189 LDKPing this_ptr_conv;
32190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32191 this_ptr_conv.is_owned = false;
32192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32193 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
32197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32198 LDKPing this_ptr_conv;
32199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32200 this_ptr_conv.is_owned = false;
32201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32202 Ping_set_ponglen(&this_ptr_conv, val);
32205 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32206 LDKPing this_ptr_conv;
32207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32208 this_ptr_conv.is_owned = false;
32209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32210 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
32214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32215 LDKPing this_ptr_conv;
32216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32217 this_ptr_conv.is_owned = false;
32218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32219 Ping_set_byteslen(&this_ptr_conv, val);
32222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
32223 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
32224 int64_t ret_ref = 0;
32225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32228 ret_ref = (uintptr_t)ret_var.inner;
32229 if (ret_var.is_owned) {
32235 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
32236 LDKPing ret_var = Ping_clone(arg);
32237 int64_t ret_ref = 0;
32238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32241 ret_ref = (uintptr_t)ret_var.inner;
32242 if (ret_var.is_owned) {
32247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32249 arg_conv.inner = (void*)(arg & (~1));
32250 arg_conv.is_owned = false;
32251 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32252 int64_t ret_conv = Ping_clone_ptr(&arg_conv);
32256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32258 orig_conv.inner = (void*)(orig & (~1));
32259 orig_conv.is_owned = false;
32260 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32261 LDKPing ret_var = Ping_clone(&orig_conv);
32262 int64_t ret_ref = 0;
32263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32266 ret_ref = (uintptr_t)ret_var.inner;
32267 if (ret_var.is_owned) {
32273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32274 LDKPong this_obj_conv;
32275 this_obj_conv.inner = (void*)(this_obj & (~1));
32276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32278 Pong_free(this_obj_conv);
32281 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32282 LDKPong this_ptr_conv;
32283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32284 this_ptr_conv.is_owned = false;
32285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32286 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
32290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32291 LDKPong this_ptr_conv;
32292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32293 this_ptr_conv.is_owned = false;
32294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32295 Pong_set_byteslen(&this_ptr_conv, val);
32298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
32299 LDKPong ret_var = Pong_new(byteslen_arg);
32300 int64_t ret_ref = 0;
32301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32304 ret_ref = (uintptr_t)ret_var.inner;
32305 if (ret_var.is_owned) {
32311 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
32312 LDKPong ret_var = Pong_clone(arg);
32313 int64_t ret_ref = 0;
32314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32317 ret_ref = (uintptr_t)ret_var.inner;
32318 if (ret_var.is_owned) {
32323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32325 arg_conv.inner = (void*)(arg & (~1));
32326 arg_conv.is_owned = false;
32327 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32328 int64_t ret_conv = Pong_clone_ptr(&arg_conv);
32332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32334 orig_conv.inner = (void*)(orig & (~1));
32335 orig_conv.is_owned = false;
32336 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32337 LDKPong ret_var = Pong_clone(&orig_conv);
32338 int64_t ret_ref = 0;
32339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32342 ret_ref = (uintptr_t)ret_var.inner;
32343 if (ret_var.is_owned) {
32349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32350 LDKOpenChannel this_obj_conv;
32351 this_obj_conv.inner = (void*)(this_obj & (~1));
32352 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32354 OpenChannel_free(this_obj_conv);
32357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32358 LDKOpenChannel this_ptr_conv;
32359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32360 this_ptr_conv.is_owned = false;
32361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32362 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32363 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
32367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32368 LDKOpenChannel this_ptr_conv;
32369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32370 this_ptr_conv.is_owned = false;
32371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32372 LDKThirtyTwoBytes val_ref;
32373 CHECK((*env)->GetArrayLength(env, val) == 32);
32374 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32375 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
32378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32379 LDKOpenChannel this_ptr_conv;
32380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32381 this_ptr_conv.is_owned = false;
32382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32383 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32384 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
32388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32389 LDKOpenChannel this_ptr_conv;
32390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32391 this_ptr_conv.is_owned = false;
32392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32393 LDKThirtyTwoBytes val_ref;
32394 CHECK((*env)->GetArrayLength(env, val) == 32);
32395 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32396 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32400 LDKOpenChannel this_ptr_conv;
32401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32402 this_ptr_conv.is_owned = false;
32403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32404 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
32408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32409 LDKOpenChannel this_ptr_conv;
32410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32411 this_ptr_conv.is_owned = false;
32412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32413 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
32416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32417 LDKOpenChannel this_ptr_conv;
32418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32419 this_ptr_conv.is_owned = false;
32420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32421 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
32425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32426 LDKOpenChannel this_ptr_conv;
32427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32428 this_ptr_conv.is_owned = false;
32429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32430 OpenChannel_set_push_msat(&this_ptr_conv, val);
32433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32434 LDKOpenChannel this_ptr_conv;
32435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32436 this_ptr_conv.is_owned = false;
32437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32438 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
32442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32443 LDKOpenChannel 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 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32450 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) {
32451 LDKOpenChannel this_ptr_conv;
32452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32453 this_ptr_conv.is_owned = false;
32454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32455 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32459 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) {
32460 LDKOpenChannel this_ptr_conv;
32461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32462 this_ptr_conv.is_owned = false;
32463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32464 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32468 LDKOpenChannel this_ptr_conv;
32469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32470 this_ptr_conv.is_owned = false;
32471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32472 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32477 LDKOpenChannel this_ptr_conv;
32478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32479 this_ptr_conv.is_owned = false;
32480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32481 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32485 LDKOpenChannel this_ptr_conv;
32486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32487 this_ptr_conv.is_owned = false;
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32489 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
32493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32494 LDKOpenChannel this_ptr_conv;
32495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32496 this_ptr_conv.is_owned = false;
32497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32498 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32501 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32502 LDKOpenChannel this_ptr_conv;
32503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32504 this_ptr_conv.is_owned = false;
32505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32506 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
32510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32511 LDKOpenChannel this_ptr_conv;
32512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32513 this_ptr_conv.is_owned = false;
32514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32515 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
32518 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32519 LDKOpenChannel this_ptr_conv;
32520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32521 this_ptr_conv.is_owned = false;
32522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32523 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
32527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32528 LDKOpenChannel this_ptr_conv;
32529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32530 this_ptr_conv.is_owned = false;
32531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32532 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
32535 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32536 LDKOpenChannel this_ptr_conv;
32537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32538 this_ptr_conv.is_owned = false;
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32540 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
32544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32545 LDKOpenChannel this_ptr_conv;
32546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32547 this_ptr_conv.is_owned = false;
32548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32549 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32553 LDKOpenChannel this_ptr_conv;
32554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32555 this_ptr_conv.is_owned = false;
32556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32557 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32558 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32563 LDKOpenChannel this_ptr_conv;
32564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32565 this_ptr_conv.is_owned = false;
32566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32567 LDKPublicKey val_ref;
32568 CHECK((*env)->GetArrayLength(env, val) == 33);
32569 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32570 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
32573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32574 LDKOpenChannel this_ptr_conv;
32575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32576 this_ptr_conv.is_owned = false;
32577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32578 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32584 LDKOpenChannel this_ptr_conv;
32585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32586 this_ptr_conv.is_owned = false;
32587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32588 LDKPublicKey val_ref;
32589 CHECK((*env)->GetArrayLength(env, val) == 33);
32590 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32591 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
32594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32595 LDKOpenChannel this_ptr_conv;
32596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32597 this_ptr_conv.is_owned = false;
32598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32599 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32600 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
32604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32605 LDKOpenChannel this_ptr_conv;
32606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32607 this_ptr_conv.is_owned = false;
32608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32609 LDKPublicKey val_ref;
32610 CHECK((*env)->GetArrayLength(env, val) == 33);
32611 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32612 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
32615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32616 LDKOpenChannel this_ptr_conv;
32617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32618 this_ptr_conv.is_owned = false;
32619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32620 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32626 LDKOpenChannel this_ptr_conv;
32627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32628 this_ptr_conv.is_owned = false;
32629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32630 LDKPublicKey val_ref;
32631 CHECK((*env)->GetArrayLength(env, val) == 33);
32632 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32633 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32637 LDKOpenChannel this_ptr_conv;
32638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32639 this_ptr_conv.is_owned = false;
32640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32641 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
32646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32647 LDKOpenChannel this_ptr_conv;
32648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32649 this_ptr_conv.is_owned = false;
32650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32651 LDKPublicKey val_ref;
32652 CHECK((*env)->GetArrayLength(env, val) == 33);
32653 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32654 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
32657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32658 LDKOpenChannel this_ptr_conv;
32659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32660 this_ptr_conv.is_owned = false;
32661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32662 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32663 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
32667 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) {
32668 LDKOpenChannel this_ptr_conv;
32669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32670 this_ptr_conv.is_owned = false;
32671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32672 LDKPublicKey val_ref;
32673 CHECK((*env)->GetArrayLength(env, val) == 33);
32674 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32675 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
32678 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
32679 LDKOpenChannel this_ptr_conv;
32680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32681 this_ptr_conv.is_owned = false;
32682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32683 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
32687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
32688 LDKOpenChannel this_ptr_conv;
32689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32690 this_ptr_conv.is_owned = false;
32691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32692 OpenChannel_set_channel_flags(&this_ptr_conv, val);
32695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
32696 LDKOpenChannel this_ptr_conv;
32697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32698 this_ptr_conv.is_owned = false;
32699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32700 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
32701 int64_t ret_ref = 0;
32702 if ((uintptr_t)ret_var.inner > 4096) {
32703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32706 ret_ref = (uintptr_t)ret_var.inner;
32707 if (ret_var.is_owned) {
32714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32715 LDKOpenChannel this_ptr_conv;
32716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32717 this_ptr_conv.is_owned = false;
32718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32719 LDKChannelTypeFeatures val_conv;
32720 val_conv.inner = (void*)(val & (~1));
32721 val_conv.is_owned = (val & 1) || (val == 0);
32722 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32723 val_conv = ChannelTypeFeatures_clone(&val_conv);
32724 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
32727 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
32728 LDKOpenChannel ret_var = OpenChannel_clone(arg);
32729 int64_t ret_ref = 0;
32730 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32731 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32733 ret_ref = (uintptr_t)ret_var.inner;
32734 if (ret_var.is_owned) {
32739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32740 LDKOpenChannel arg_conv;
32741 arg_conv.inner = (void*)(arg & (~1));
32742 arg_conv.is_owned = false;
32743 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32744 int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
32748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32749 LDKOpenChannel orig_conv;
32750 orig_conv.inner = (void*)(orig & (~1));
32751 orig_conv.is_owned = false;
32752 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32753 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
32754 int64_t ret_ref = 0;
32755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32758 ret_ref = (uintptr_t)ret_var.inner;
32759 if (ret_var.is_owned) {
32765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32766 LDKAcceptChannel this_obj_conv;
32767 this_obj_conv.inner = (void*)(this_obj & (~1));
32768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32770 AcceptChannel_free(this_obj_conv);
32773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32774 LDKAcceptChannel this_ptr_conv;
32775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32776 this_ptr_conv.is_owned = false;
32777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32778 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
32783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32784 LDKAcceptChannel this_ptr_conv;
32785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32786 this_ptr_conv.is_owned = false;
32787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32788 LDKThirtyTwoBytes val_ref;
32789 CHECK((*env)->GetArrayLength(env, val) == 32);
32790 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32791 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32795 LDKAcceptChannel this_ptr_conv;
32796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32797 this_ptr_conv.is_owned = false;
32798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32799 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
32803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32804 LDKAcceptChannel this_ptr_conv;
32805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32806 this_ptr_conv.is_owned = false;
32807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32808 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32811 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) {
32812 LDKAcceptChannel this_ptr_conv;
32813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32814 this_ptr_conv.is_owned = false;
32815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32816 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32820 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) {
32821 LDKAcceptChannel this_ptr_conv;
32822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32823 this_ptr_conv.is_owned = false;
32824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32825 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32829 LDKAcceptChannel this_ptr_conv;
32830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32831 this_ptr_conv.is_owned = false;
32832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32833 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32838 LDKAcceptChannel this_ptr_conv;
32839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32840 this_ptr_conv.is_owned = false;
32841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32842 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32846 LDKAcceptChannel this_ptr_conv;
32847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32848 this_ptr_conv.is_owned = false;
32849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32850 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
32854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32855 LDKAcceptChannel this_ptr_conv;
32856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32857 this_ptr_conv.is_owned = false;
32858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32859 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32862 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
32863 LDKAcceptChannel this_ptr_conv;
32864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32865 this_ptr_conv.is_owned = false;
32866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32867 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
32871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32872 LDKAcceptChannel this_ptr_conv;
32873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32874 this_ptr_conv.is_owned = false;
32875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32876 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
32879 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32880 LDKAcceptChannel this_ptr_conv;
32881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32882 this_ptr_conv.is_owned = false;
32883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32884 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
32888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32889 LDKAcceptChannel this_ptr_conv;
32890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32891 this_ptr_conv.is_owned = false;
32892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32893 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
32896 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32897 LDKAcceptChannel this_ptr_conv;
32898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32899 this_ptr_conv.is_owned = false;
32900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32901 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
32905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32906 LDKAcceptChannel this_ptr_conv;
32907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32908 this_ptr_conv.is_owned = false;
32909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32910 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32914 LDKAcceptChannel this_ptr_conv;
32915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32916 this_ptr_conv.is_owned = false;
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32918 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32924 LDKAcceptChannel this_ptr_conv;
32925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32926 this_ptr_conv.is_owned = false;
32927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32928 LDKPublicKey val_ref;
32929 CHECK((*env)->GetArrayLength(env, val) == 33);
32930 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32931 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
32934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32935 LDKAcceptChannel this_ptr_conv;
32936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32937 this_ptr_conv.is_owned = false;
32938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32939 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32940 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32945 LDKAcceptChannel this_ptr_conv;
32946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32947 this_ptr_conv.is_owned = false;
32948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32949 LDKPublicKey val_ref;
32950 CHECK((*env)->GetArrayLength(env, val) == 33);
32951 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32952 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
32955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32956 LDKAcceptChannel this_ptr_conv;
32957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32958 this_ptr_conv.is_owned = false;
32959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32960 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32961 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
32965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32966 LDKAcceptChannel 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 LDKPublicKey val_ref;
32971 CHECK((*env)->GetArrayLength(env, val) == 33);
32972 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32973 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
32976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32977 LDKAcceptChannel this_ptr_conv;
32978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32979 this_ptr_conv.is_owned = false;
32980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32981 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32987 LDKAcceptChannel this_ptr_conv;
32988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32989 this_ptr_conv.is_owned = false;
32990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32991 LDKPublicKey val_ref;
32992 CHECK((*env)->GetArrayLength(env, val) == 33);
32993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32994 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32998 LDKAcceptChannel this_ptr_conv;
32999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33000 this_ptr_conv.is_owned = false;
33001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33002 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33003 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
33007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33008 LDKAcceptChannel this_ptr_conv;
33009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33010 this_ptr_conv.is_owned = false;
33011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33012 LDKPublicKey val_ref;
33013 CHECK((*env)->GetArrayLength(env, val) == 33);
33014 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33015 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
33018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33019 LDKAcceptChannel this_ptr_conv;
33020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33021 this_ptr_conv.is_owned = false;
33022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33023 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33024 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
33028 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) {
33029 LDKAcceptChannel this_ptr_conv;
33030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33031 this_ptr_conv.is_owned = false;
33032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33033 LDKPublicKey val_ref;
33034 CHECK((*env)->GetArrayLength(env, val) == 33);
33035 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33036 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
33039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
33040 LDKAcceptChannel this_ptr_conv;
33041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33042 this_ptr_conv.is_owned = false;
33043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33044 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
33045 int64_t ret_ref = 0;
33046 if ((uintptr_t)ret_var.inner > 4096) {
33047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33050 ret_ref = (uintptr_t)ret_var.inner;
33051 if (ret_var.is_owned) {
33058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33059 LDKAcceptChannel this_ptr_conv;
33060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33061 this_ptr_conv.is_owned = false;
33062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33063 LDKChannelTypeFeatures val_conv;
33064 val_conv.inner = (void*)(val & (~1));
33065 val_conv.is_owned = (val & 1) || (val == 0);
33066 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33067 val_conv = ChannelTypeFeatures_clone(&val_conv);
33068 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
33071 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
33072 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
33073 int64_t ret_ref = 0;
33074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33077 ret_ref = (uintptr_t)ret_var.inner;
33078 if (ret_var.is_owned) {
33083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33084 LDKAcceptChannel arg_conv;
33085 arg_conv.inner = (void*)(arg & (~1));
33086 arg_conv.is_owned = false;
33087 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33088 int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
33092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33093 LDKAcceptChannel orig_conv;
33094 orig_conv.inner = (void*)(orig & (~1));
33095 orig_conv.is_owned = false;
33096 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33097 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
33098 int64_t ret_ref = 0;
33099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33102 ret_ref = (uintptr_t)ret_var.inner;
33103 if (ret_var.is_owned) {
33109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33110 LDKFundingCreated this_obj_conv;
33111 this_obj_conv.inner = (void*)(this_obj & (~1));
33112 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33114 FundingCreated_free(this_obj_conv);
33117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33118 LDKFundingCreated this_ptr_conv;
33119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33120 this_ptr_conv.is_owned = false;
33121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33122 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
33127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33128 LDKFundingCreated this_ptr_conv;
33129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33130 this_ptr_conv.is_owned = false;
33131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33132 LDKThirtyTwoBytes val_ref;
33133 CHECK((*env)->GetArrayLength(env, val) == 32);
33134 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33135 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
33138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
33139 LDKFundingCreated this_ptr_conv;
33140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33141 this_ptr_conv.is_owned = false;
33142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33144 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
33148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33149 LDKFundingCreated this_ptr_conv;
33150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33151 this_ptr_conv.is_owned = false;
33152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33153 LDKThirtyTwoBytes val_ref;
33154 CHECK((*env)->GetArrayLength(env, val) == 32);
33155 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33156 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
33159 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
33160 LDKFundingCreated this_ptr_conv;
33161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33162 this_ptr_conv.is_owned = false;
33163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33164 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
33168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33169 LDKFundingCreated this_ptr_conv;
33170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33171 this_ptr_conv.is_owned = false;
33172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33173 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
33176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33177 LDKFundingCreated this_ptr_conv;
33178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33179 this_ptr_conv.is_owned = false;
33180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33181 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
33186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33187 LDKFundingCreated this_ptr_conv;
33188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33189 this_ptr_conv.is_owned = false;
33190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33191 LDKSignature val_ref;
33192 CHECK((*env)->GetArrayLength(env, val) == 64);
33193 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33194 FundingCreated_set_signature(&this_ptr_conv, val_ref);
33197 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) {
33198 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
33199 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
33200 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
33201 LDKThirtyTwoBytes funding_txid_arg_ref;
33202 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
33203 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
33204 LDKSignature signature_arg_ref;
33205 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33206 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33207 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
33208 int64_t ret_ref = 0;
33209 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33210 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33212 ret_ref = (uintptr_t)ret_var.inner;
33213 if (ret_var.is_owned) {
33219 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
33220 LDKFundingCreated ret_var = FundingCreated_clone(arg);
33221 int64_t ret_ref = 0;
33222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33225 ret_ref = (uintptr_t)ret_var.inner;
33226 if (ret_var.is_owned) {
33231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33232 LDKFundingCreated arg_conv;
33233 arg_conv.inner = (void*)(arg & (~1));
33234 arg_conv.is_owned = false;
33235 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33236 int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
33240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33241 LDKFundingCreated orig_conv;
33242 orig_conv.inner = (void*)(orig & (~1));
33243 orig_conv.is_owned = false;
33244 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33245 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
33246 int64_t ret_ref = 0;
33247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33250 ret_ref = (uintptr_t)ret_var.inner;
33251 if (ret_var.is_owned) {
33257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33258 LDKFundingSigned this_obj_conv;
33259 this_obj_conv.inner = (void*)(this_obj & (~1));
33260 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33262 FundingSigned_free(this_obj_conv);
33265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33266 LDKFundingSigned 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, 32);
33271 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
33275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33276 LDKFundingSigned 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 LDKThirtyTwoBytes val_ref;
33281 CHECK((*env)->GetArrayLength(env, val) == 32);
33282 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33283 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
33286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33287 LDKFundingSigned 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33292 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
33296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33297 LDKFundingSigned this_ptr_conv;
33298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33299 this_ptr_conv.is_owned = false;
33300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33301 LDKSignature val_ref;
33302 CHECK((*env)->GetArrayLength(env, val) == 64);
33303 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33304 FundingSigned_set_signature(&this_ptr_conv, val_ref);
33307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_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 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
33315 int64_t ret_ref = 0;
33316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33319 ret_ref = (uintptr_t)ret_var.inner;
33320 if (ret_var.is_owned) {
33326 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
33327 LDKFundingSigned ret_var = FundingSigned_clone(arg);
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) {
33338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33339 LDKFundingSigned arg_conv;
33340 arg_conv.inner = (void*)(arg & (~1));
33341 arg_conv.is_owned = false;
33342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33343 int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
33347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33348 LDKFundingSigned orig_conv;
33349 orig_conv.inner = (void*)(orig & (~1));
33350 orig_conv.is_owned = false;
33351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33352 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
33353 int64_t ret_ref = 0;
33354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33357 ret_ref = (uintptr_t)ret_var.inner;
33358 if (ret_var.is_owned) {
33364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33365 LDKChannelReady this_obj_conv;
33366 this_obj_conv.inner = (void*)(this_obj & (~1));
33367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33369 ChannelReady_free(this_obj_conv);
33372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33373 LDKChannelReady this_ptr_conv;
33374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33375 this_ptr_conv.is_owned = false;
33376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33377 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33378 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
33382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33383 LDKChannelReady this_ptr_conv;
33384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33385 this_ptr_conv.is_owned = false;
33386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33387 LDKThirtyTwoBytes val_ref;
33388 CHECK((*env)->GetArrayLength(env, val) == 32);
33389 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33390 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
33393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33394 LDKChannelReady this_ptr_conv;
33395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33396 this_ptr_conv.is_owned = false;
33397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33398 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33399 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33403 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) {
33404 LDKChannelReady this_ptr_conv;
33405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33406 this_ptr_conv.is_owned = false;
33407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33408 LDKPublicKey val_ref;
33409 CHECK((*env)->GetArrayLength(env, val) == 33);
33410 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33411 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33415 LDKChannelReady this_ptr_conv;
33416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33417 this_ptr_conv.is_owned = false;
33418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33419 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33420 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
33421 int64_t ret_ref = (uintptr_t)ret_copy;
33425 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) {
33426 LDKChannelReady this_ptr_conv;
33427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33428 this_ptr_conv.is_owned = false;
33429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33430 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33431 CHECK_ACCESS(val_ptr);
33432 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33433 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
33434 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
33437 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) {
33438 LDKThirtyTwoBytes channel_id_arg_ref;
33439 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33440 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33441 LDKPublicKey next_per_commitment_point_arg_ref;
33442 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33443 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33444 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
33445 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
33446 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
33447 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
33448 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
33449 int64_t ret_ref = 0;
33450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33453 ret_ref = (uintptr_t)ret_var.inner;
33454 if (ret_var.is_owned) {
33460 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
33461 LDKChannelReady ret_var = ChannelReady_clone(arg);
33462 int64_t ret_ref = 0;
33463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33466 ret_ref = (uintptr_t)ret_var.inner;
33467 if (ret_var.is_owned) {
33472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33473 LDKChannelReady arg_conv;
33474 arg_conv.inner = (void*)(arg & (~1));
33475 arg_conv.is_owned = false;
33476 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33477 int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
33481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33482 LDKChannelReady orig_conv;
33483 orig_conv.inner = (void*)(orig & (~1));
33484 orig_conv.is_owned = false;
33485 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33486 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
33487 int64_t ret_ref = 0;
33488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33491 ret_ref = (uintptr_t)ret_var.inner;
33492 if (ret_var.is_owned) {
33498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33499 LDKShutdown this_obj_conv;
33500 this_obj_conv.inner = (void*)(this_obj & (~1));
33501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33503 Shutdown_free(this_obj_conv);
33506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33507 LDKShutdown this_ptr_conv;
33508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33509 this_ptr_conv.is_owned = false;
33510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33511 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33512 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
33516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33517 LDKShutdown 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 LDKThirtyTwoBytes val_ref;
33522 CHECK((*env)->GetArrayLength(env, val) == 32);
33523 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33524 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
33527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33528 LDKShutdown this_ptr_conv;
33529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33530 this_ptr_conv.is_owned = false;
33531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33532 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
33533 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33534 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33539 LDKShutdown this_ptr_conv;
33540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33541 this_ptr_conv.is_owned = false;
33542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33543 LDKCVec_u8Z val_ref;
33544 val_ref.datalen = (*env)->GetArrayLength(env, val);
33545 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
33546 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
33547 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
33550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
33551 LDKThirtyTwoBytes channel_id_arg_ref;
33552 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33553 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33554 LDKCVec_u8Z scriptpubkey_arg_ref;
33555 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
33556 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
33557 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
33558 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
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 Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
33571 LDKShutdown ret_var = Shutdown_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_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33583 LDKShutdown 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 = Shutdown_clone_ptr(&arg_conv);
33591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33592 LDKShutdown 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 LDKShutdown ret_var = Shutdown_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_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33609 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_free(this_obj_conv);
33616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33617 LDKClosingSignedFeeRange 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 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
33625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33626 LDKClosingSignedFeeRange this_ptr_conv;
33627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33628 this_ptr_conv.is_owned = false;
33629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33630 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
33633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33634 LDKClosingSignedFeeRange this_ptr_conv;
33635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33636 this_ptr_conv.is_owned = false;
33637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33638 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
33642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33643 LDKClosingSignedFeeRange this_ptr_conv;
33644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33645 this_ptr_conv.is_owned = false;
33646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33647 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
33650 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) {
33651 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
33652 int64_t ret_ref = 0;
33653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33656 ret_ref = (uintptr_t)ret_var.inner;
33657 if (ret_var.is_owned) {
33663 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
33664 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
33665 int64_t ret_ref = 0;
33666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33669 ret_ref = (uintptr_t)ret_var.inner;
33670 if (ret_var.is_owned) {
33675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33676 LDKClosingSignedFeeRange arg_conv;
33677 arg_conv.inner = (void*)(arg & (~1));
33678 arg_conv.is_owned = false;
33679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33680 int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
33684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33685 LDKClosingSignedFeeRange orig_conv;
33686 orig_conv.inner = (void*)(orig & (~1));
33687 orig_conv.is_owned = false;
33688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33689 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
33690 int64_t ret_ref = 0;
33691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33694 ret_ref = (uintptr_t)ret_var.inner;
33695 if (ret_var.is_owned) {
33701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33702 LDKClosingSigned this_obj_conv;
33703 this_obj_conv.inner = (void*)(this_obj & (~1));
33704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33706 ClosingSigned_free(this_obj_conv);
33709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33710 LDKClosingSigned this_ptr_conv;
33711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33712 this_ptr_conv.is_owned = false;
33713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33714 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
33719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33720 LDKClosingSigned this_ptr_conv;
33721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33722 this_ptr_conv.is_owned = false;
33723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33724 LDKThirtyTwoBytes val_ref;
33725 CHECK((*env)->GetArrayLength(env, val) == 32);
33726 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33727 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
33730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33731 LDKClosingSigned this_ptr_conv;
33732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33733 this_ptr_conv.is_owned = false;
33734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33735 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
33739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33740 LDKClosingSigned this_ptr_conv;
33741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33742 this_ptr_conv.is_owned = false;
33743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33744 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
33747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33748 LDKClosingSigned this_ptr_conv;
33749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33750 this_ptr_conv.is_owned = false;
33751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33752 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
33757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33758 LDKClosingSigned this_ptr_conv;
33759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33760 this_ptr_conv.is_owned = false;
33761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33762 LDKSignature val_ref;
33763 CHECK((*env)->GetArrayLength(env, val) == 64);
33764 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33765 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
33768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
33769 LDKClosingSigned this_ptr_conv;
33770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33771 this_ptr_conv.is_owned = false;
33772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33773 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
33774 int64_t ret_ref = 0;
33775 if ((uintptr_t)ret_var.inner > 4096) {
33776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33779 ret_ref = (uintptr_t)ret_var.inner;
33780 if (ret_var.is_owned) {
33787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33788 LDKClosingSigned this_ptr_conv;
33789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33790 this_ptr_conv.is_owned = false;
33791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33792 LDKClosingSignedFeeRange val_conv;
33793 val_conv.inner = (void*)(val & (~1));
33794 val_conv.is_owned = (val & 1) || (val == 0);
33795 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33796 val_conv = ClosingSignedFeeRange_clone(&val_conv);
33797 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
33800 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) {
33801 LDKThirtyTwoBytes channel_id_arg_ref;
33802 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33803 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33804 LDKSignature signature_arg_ref;
33805 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33806 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33807 LDKClosingSignedFeeRange fee_range_arg_conv;
33808 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
33809 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
33810 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
33811 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
33812 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
33813 int64_t ret_ref = 0;
33814 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33815 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33817 ret_ref = (uintptr_t)ret_var.inner;
33818 if (ret_var.is_owned) {
33824 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
33825 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
33826 int64_t ret_ref = 0;
33827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33830 ret_ref = (uintptr_t)ret_var.inner;
33831 if (ret_var.is_owned) {
33836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33837 LDKClosingSigned arg_conv;
33838 arg_conv.inner = (void*)(arg & (~1));
33839 arg_conv.is_owned = false;
33840 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33841 int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
33845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33846 LDKClosingSigned orig_conv;
33847 orig_conv.inner = (void*)(orig & (~1));
33848 orig_conv.is_owned = false;
33849 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33850 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
33851 int64_t ret_ref = 0;
33852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33855 ret_ref = (uintptr_t)ret_var.inner;
33856 if (ret_var.is_owned) {
33862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33863 LDKUpdateAddHTLC this_obj_conv;
33864 this_obj_conv.inner = (void*)(this_obj & (~1));
33865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33867 UpdateAddHTLC_free(this_obj_conv);
33870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33871 LDKUpdateAddHTLC this_ptr_conv;
33872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33873 this_ptr_conv.is_owned = false;
33874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
33880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33881 LDKUpdateAddHTLC this_ptr_conv;
33882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33883 this_ptr_conv.is_owned = false;
33884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33885 LDKThirtyTwoBytes val_ref;
33886 CHECK((*env)->GetArrayLength(env, val) == 32);
33887 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33888 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
33891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33892 LDKUpdateAddHTLC this_ptr_conv;
33893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33894 this_ptr_conv.is_owned = false;
33895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33896 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
33900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33901 LDKUpdateAddHTLC this_ptr_conv;
33902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33903 this_ptr_conv.is_owned = false;
33904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33905 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
33908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33909 LDKUpdateAddHTLC this_ptr_conv;
33910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33911 this_ptr_conv.is_owned = false;
33912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33913 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
33917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33918 LDKUpdateAddHTLC this_ptr_conv;
33919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33920 this_ptr_conv.is_owned = false;
33921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33922 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
33925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33926 LDKUpdateAddHTLC this_ptr_conv;
33927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33928 this_ptr_conv.is_owned = false;
33929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33930 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33931 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
33935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33936 LDKUpdateAddHTLC this_ptr_conv;
33937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33938 this_ptr_conv.is_owned = false;
33939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33940 LDKThirtyTwoBytes val_ref;
33941 CHECK((*env)->GetArrayLength(env, val) == 32);
33942 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33943 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
33946 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
33947 LDKUpdateAddHTLC this_ptr_conv;
33948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33949 this_ptr_conv.is_owned = false;
33950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33951 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
33955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33956 LDKUpdateAddHTLC this_ptr_conv;
33957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33958 this_ptr_conv.is_owned = false;
33959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33960 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
33963 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
33964 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
33965 int64_t ret_ref = 0;
33966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33969 ret_ref = (uintptr_t)ret_var.inner;
33970 if (ret_var.is_owned) {
33975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33976 LDKUpdateAddHTLC arg_conv;
33977 arg_conv.inner = (void*)(arg & (~1));
33978 arg_conv.is_owned = false;
33979 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33980 int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
33984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33985 LDKUpdateAddHTLC orig_conv;
33986 orig_conv.inner = (void*)(orig & (~1));
33987 orig_conv.is_owned = false;
33988 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33989 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
33990 int64_t ret_ref = 0;
33991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33994 ret_ref = (uintptr_t)ret_var.inner;
33995 if (ret_var.is_owned) {
34001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34002 LDKUpdateFulfillHTLC this_obj_conv;
34003 this_obj_conv.inner = (void*)(this_obj & (~1));
34004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34006 UpdateFulfillHTLC_free(this_obj_conv);
34009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34010 LDKUpdateFulfillHTLC this_ptr_conv;
34011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34012 this_ptr_conv.is_owned = false;
34013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34014 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
34019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34020 LDKUpdateFulfillHTLC this_ptr_conv;
34021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34022 this_ptr_conv.is_owned = false;
34023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34024 LDKThirtyTwoBytes val_ref;
34025 CHECK((*env)->GetArrayLength(env, val) == 32);
34026 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34027 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
34030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34031 LDKUpdateFulfillHTLC this_ptr_conv;
34032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34033 this_ptr_conv.is_owned = false;
34034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34035 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
34039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34040 LDKUpdateFulfillHTLC this_ptr_conv;
34041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34042 this_ptr_conv.is_owned = false;
34043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34044 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
34047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
34048 LDKUpdateFulfillHTLC this_ptr_conv;
34049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34050 this_ptr_conv.is_owned = false;
34051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34052 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34053 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
34057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34058 LDKUpdateFulfillHTLC this_ptr_conv;
34059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34060 this_ptr_conv.is_owned = false;
34061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34062 LDKThirtyTwoBytes val_ref;
34063 CHECK((*env)->GetArrayLength(env, val) == 32);
34064 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34065 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
34068 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) {
34069 LDKThirtyTwoBytes channel_id_arg_ref;
34070 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34071 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34072 LDKThirtyTwoBytes payment_preimage_arg_ref;
34073 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
34074 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
34075 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
34076 int64_t ret_ref = 0;
34077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34080 ret_ref = (uintptr_t)ret_var.inner;
34081 if (ret_var.is_owned) {
34087 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
34088 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
34089 int64_t ret_ref = 0;
34090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34093 ret_ref = (uintptr_t)ret_var.inner;
34094 if (ret_var.is_owned) {
34099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34100 LDKUpdateFulfillHTLC arg_conv;
34101 arg_conv.inner = (void*)(arg & (~1));
34102 arg_conv.is_owned = false;
34103 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34104 int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
34108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34109 LDKUpdateFulfillHTLC orig_conv;
34110 orig_conv.inner = (void*)(orig & (~1));
34111 orig_conv.is_owned = false;
34112 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34113 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
34114 int64_t ret_ref = 0;
34115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34118 ret_ref = (uintptr_t)ret_var.inner;
34119 if (ret_var.is_owned) {
34125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34126 LDKUpdateFailHTLC this_obj_conv;
34127 this_obj_conv.inner = (void*)(this_obj & (~1));
34128 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34130 UpdateFailHTLC_free(this_obj_conv);
34133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34134 LDKUpdateFailHTLC this_ptr_conv;
34135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34136 this_ptr_conv.is_owned = false;
34137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34138 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
34143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34144 LDKUpdateFailHTLC this_ptr_conv;
34145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34146 this_ptr_conv.is_owned = false;
34147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34148 LDKThirtyTwoBytes val_ref;
34149 CHECK((*env)->GetArrayLength(env, val) == 32);
34150 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34151 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
34154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34155 LDKUpdateFailHTLC this_ptr_conv;
34156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34157 this_ptr_conv.is_owned = false;
34158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34159 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
34163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34164 LDKUpdateFailHTLC this_ptr_conv;
34165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34166 this_ptr_conv.is_owned = false;
34167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34168 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
34171 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
34172 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
34173 int64_t ret_ref = 0;
34174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34177 ret_ref = (uintptr_t)ret_var.inner;
34178 if (ret_var.is_owned) {
34183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34184 LDKUpdateFailHTLC arg_conv;
34185 arg_conv.inner = (void*)(arg & (~1));
34186 arg_conv.is_owned = false;
34187 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34188 int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
34192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34193 LDKUpdateFailHTLC orig_conv;
34194 orig_conv.inner = (void*)(orig & (~1));
34195 orig_conv.is_owned = false;
34196 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34197 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
34198 int64_t ret_ref = 0;
34199 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34200 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34201 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34202 ret_ref = (uintptr_t)ret_var.inner;
34203 if (ret_var.is_owned) {
34209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34210 LDKUpdateFailMalformedHTLC this_obj_conv;
34211 this_obj_conv.inner = (void*)(this_obj & (~1));
34212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34214 UpdateFailMalformedHTLC_free(this_obj_conv);
34217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34218 LDKUpdateFailMalformedHTLC this_ptr_conv;
34219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34220 this_ptr_conv.is_owned = false;
34221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34222 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
34227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34228 LDKUpdateFailMalformedHTLC this_ptr_conv;
34229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34230 this_ptr_conv.is_owned = false;
34231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34232 LDKThirtyTwoBytes val_ref;
34233 CHECK((*env)->GetArrayLength(env, val) == 32);
34234 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34235 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
34238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34239 LDKUpdateFailMalformedHTLC this_ptr_conv;
34240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34241 this_ptr_conv.is_owned = false;
34242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34243 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
34247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34248 LDKUpdateFailMalformedHTLC this_ptr_conv;
34249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34250 this_ptr_conv.is_owned = false;
34251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34252 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
34255 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
34256 LDKUpdateFailMalformedHTLC this_ptr_conv;
34257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34258 this_ptr_conv.is_owned = false;
34259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34260 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
34264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34265 LDKUpdateFailMalformedHTLC this_ptr_conv;
34266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34267 this_ptr_conv.is_owned = false;
34268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34269 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
34272 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
34273 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
34274 int64_t ret_ref = 0;
34275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34278 ret_ref = (uintptr_t)ret_var.inner;
34279 if (ret_var.is_owned) {
34284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34285 LDKUpdateFailMalformedHTLC arg_conv;
34286 arg_conv.inner = (void*)(arg & (~1));
34287 arg_conv.is_owned = false;
34288 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34289 int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
34293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34294 LDKUpdateFailMalformedHTLC orig_conv;
34295 orig_conv.inner = (void*)(orig & (~1));
34296 orig_conv.is_owned = false;
34297 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34298 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
34299 int64_t ret_ref = 0;
34300 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34301 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34303 ret_ref = (uintptr_t)ret_var.inner;
34304 if (ret_var.is_owned) {
34310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34311 LDKCommitmentSigned this_obj_conv;
34312 this_obj_conv.inner = (void*)(this_obj & (~1));
34313 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34315 CommitmentSigned_free(this_obj_conv);
34318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34319 LDKCommitmentSigned this_ptr_conv;
34320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34321 this_ptr_conv.is_owned = false;
34322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34323 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
34328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34329 LDKCommitmentSigned this_ptr_conv;
34330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34331 this_ptr_conv.is_owned = false;
34332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34333 LDKThirtyTwoBytes val_ref;
34334 CHECK((*env)->GetArrayLength(env, val) == 32);
34335 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34336 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
34339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34340 LDKCommitmentSigned this_ptr_conv;
34341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34342 this_ptr_conv.is_owned = false;
34343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34344 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
34349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34350 LDKCommitmentSigned this_ptr_conv;
34351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34352 this_ptr_conv.is_owned = false;
34353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34354 LDKSignature val_ref;
34355 CHECK((*env)->GetArrayLength(env, val) == 64);
34356 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34357 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
34360 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
34361 LDKCommitmentSigned this_ptr_conv;
34362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34363 this_ptr_conv.is_owned = false;
34364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34365 LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
34366 jobjectArray ret_arr = NULL;
34367 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
34369 for (size_t i = 0; i < ret_var.datalen; i++) {
34370 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
34371 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
34372 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
34375 FREE(ret_var.data);
34379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
34380 LDKCommitmentSigned this_ptr_conv;
34381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34382 this_ptr_conv.is_owned = false;
34383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34384 LDKCVec_SignatureZ val_constr;
34385 val_constr.datalen = (*env)->GetArrayLength(env, val);
34386 if (val_constr.datalen > 0)
34387 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34389 val_constr.data = NULL;
34390 for (size_t i = 0; i < val_constr.datalen; i++) {
34391 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
34392 LDKSignature val_conv_8_ref;
34393 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
34394 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
34395 val_constr.data[i] = val_conv_8_ref;
34397 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
34400 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) {
34401 LDKThirtyTwoBytes channel_id_arg_ref;
34402 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34403 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34404 LDKSignature signature_arg_ref;
34405 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34406 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34407 LDKCVec_SignatureZ htlc_signatures_arg_constr;
34408 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
34409 if (htlc_signatures_arg_constr.datalen > 0)
34410 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34412 htlc_signatures_arg_constr.data = NULL;
34413 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
34414 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
34415 LDKSignature htlc_signatures_arg_conv_8_ref;
34416 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
34417 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
34418 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
34420 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
34421 int64_t ret_ref = 0;
34422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34425 ret_ref = (uintptr_t)ret_var.inner;
34426 if (ret_var.is_owned) {
34432 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
34433 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
34434 int64_t ret_ref = 0;
34435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34438 ret_ref = (uintptr_t)ret_var.inner;
34439 if (ret_var.is_owned) {
34444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34445 LDKCommitmentSigned arg_conv;
34446 arg_conv.inner = (void*)(arg & (~1));
34447 arg_conv.is_owned = false;
34448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34449 int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
34453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34454 LDKCommitmentSigned orig_conv;
34455 orig_conv.inner = (void*)(orig & (~1));
34456 orig_conv.is_owned = false;
34457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34458 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
34459 int64_t ret_ref = 0;
34460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34463 ret_ref = (uintptr_t)ret_var.inner;
34464 if (ret_var.is_owned) {
34470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34471 LDKRevokeAndACK this_obj_conv;
34472 this_obj_conv.inner = (void*)(this_obj & (~1));
34473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34475 RevokeAndACK_free(this_obj_conv);
34478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34479 LDKRevokeAndACK 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34484 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
34488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34489 LDKRevokeAndACK this_ptr_conv;
34490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34491 this_ptr_conv.is_owned = false;
34492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34493 LDKThirtyTwoBytes val_ref;
34494 CHECK((*env)->GetArrayLength(env, val) == 32);
34495 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34496 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
34499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
34500 LDKRevokeAndACK 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
34509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34510 LDKRevokeAndACK this_ptr_conv;
34511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34512 this_ptr_conv.is_owned = false;
34513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34514 LDKThirtyTwoBytes val_ref;
34515 CHECK((*env)->GetArrayLength(env, val) == 32);
34516 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34517 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
34520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34521 LDKRevokeAndACK this_ptr_conv;
34522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34523 this_ptr_conv.is_owned = false;
34524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34525 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34526 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
34530 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) {
34531 LDKRevokeAndACK this_ptr_conv;
34532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34533 this_ptr_conv.is_owned = false;
34534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34535 LDKPublicKey val_ref;
34536 CHECK((*env)->GetArrayLength(env, val) == 33);
34537 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34538 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
34541 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) {
34542 LDKThirtyTwoBytes channel_id_arg_ref;
34543 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34544 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34545 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
34546 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
34547 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
34548 LDKPublicKey next_per_commitment_point_arg_ref;
34549 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
34550 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
34551 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
34552 int64_t ret_ref = 0;
34553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34556 ret_ref = (uintptr_t)ret_var.inner;
34557 if (ret_var.is_owned) {
34563 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
34564 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
34565 int64_t ret_ref = 0;
34566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34569 ret_ref = (uintptr_t)ret_var.inner;
34570 if (ret_var.is_owned) {
34575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34576 LDKRevokeAndACK arg_conv;
34577 arg_conv.inner = (void*)(arg & (~1));
34578 arg_conv.is_owned = false;
34579 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34580 int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
34584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34585 LDKRevokeAndACK orig_conv;
34586 orig_conv.inner = (void*)(orig & (~1));
34587 orig_conv.is_owned = false;
34588 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34589 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
34590 int64_t ret_ref = 0;
34591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34594 ret_ref = (uintptr_t)ret_var.inner;
34595 if (ret_var.is_owned) {
34601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34602 LDKUpdateFee this_obj_conv;
34603 this_obj_conv.inner = (void*)(this_obj & (~1));
34604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34606 UpdateFee_free(this_obj_conv);
34609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34610 LDKUpdateFee this_ptr_conv;
34611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34612 this_ptr_conv.is_owned = false;
34613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34614 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34615 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
34619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34620 LDKUpdateFee 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 LDKThirtyTwoBytes val_ref;
34625 CHECK((*env)->GetArrayLength(env, val) == 32);
34626 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34627 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
34630 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
34631 LDKUpdateFee this_ptr_conv;
34632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34633 this_ptr_conv.is_owned = false;
34634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34635 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
34639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34640 LDKUpdateFee this_ptr_conv;
34641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34642 this_ptr_conv.is_owned = false;
34643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34644 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
34647 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) {
34648 LDKThirtyTwoBytes channel_id_arg_ref;
34649 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34650 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34651 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
34652 int64_t ret_ref = 0;
34653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34656 ret_ref = (uintptr_t)ret_var.inner;
34657 if (ret_var.is_owned) {
34663 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
34664 LDKUpdateFee ret_var = UpdateFee_clone(arg);
34665 int64_t ret_ref = 0;
34666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34669 ret_ref = (uintptr_t)ret_var.inner;
34670 if (ret_var.is_owned) {
34675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34676 LDKUpdateFee arg_conv;
34677 arg_conv.inner = (void*)(arg & (~1));
34678 arg_conv.is_owned = false;
34679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34680 int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
34684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34685 LDKUpdateFee orig_conv;
34686 orig_conv.inner = (void*)(orig & (~1));
34687 orig_conv.is_owned = false;
34688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34689 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
34690 int64_t ret_ref = 0;
34691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34694 ret_ref = (uintptr_t)ret_var.inner;
34695 if (ret_var.is_owned) {
34701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34702 LDKDataLossProtect this_obj_conv;
34703 this_obj_conv.inner = (void*)(this_obj & (~1));
34704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34706 DataLossProtect_free(this_obj_conv);
34709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
34710 LDKDataLossProtect this_ptr_conv;
34711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34712 this_ptr_conv.is_owned = false;
34713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34714 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
34719 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) {
34720 LDKDataLossProtect this_ptr_conv;
34721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34722 this_ptr_conv.is_owned = false;
34723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34724 LDKThirtyTwoBytes val_ref;
34725 CHECK((*env)->GetArrayLength(env, val) == 32);
34726 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34727 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
34730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34731 LDKDataLossProtect this_ptr_conv;
34732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34733 this_ptr_conv.is_owned = false;
34734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34735 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
34740 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) {
34741 LDKDataLossProtect this_ptr_conv;
34742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34743 this_ptr_conv.is_owned = false;
34744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34745 LDKPublicKey val_ref;
34746 CHECK((*env)->GetArrayLength(env, val) == 33);
34747 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34748 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
34751 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) {
34752 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
34753 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
34754 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
34755 LDKPublicKey my_current_per_commitment_point_arg_ref;
34756 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
34757 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
34758 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
34759 int64_t ret_ref = 0;
34760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34763 ret_ref = (uintptr_t)ret_var.inner;
34764 if (ret_var.is_owned) {
34770 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
34771 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
34772 int64_t ret_ref = 0;
34773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34776 ret_ref = (uintptr_t)ret_var.inner;
34777 if (ret_var.is_owned) {
34782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34783 LDKDataLossProtect arg_conv;
34784 arg_conv.inner = (void*)(arg & (~1));
34785 arg_conv.is_owned = false;
34786 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34787 int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
34791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34792 LDKDataLossProtect orig_conv;
34793 orig_conv.inner = (void*)(orig & (~1));
34794 orig_conv.is_owned = false;
34795 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34796 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
34797 int64_t ret_ref = 0;
34798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34801 ret_ref = (uintptr_t)ret_var.inner;
34802 if (ret_var.is_owned) {
34808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34809 LDKChannelReestablish this_obj_conv;
34810 this_obj_conv.inner = (void*)(this_obj & (~1));
34811 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34813 ChannelReestablish_free(this_obj_conv);
34816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34817 LDKChannelReestablish this_ptr_conv;
34818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34819 this_ptr_conv.is_owned = false;
34820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34821 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
34826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34827 LDKChannelReestablish this_ptr_conv;
34828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34829 this_ptr_conv.is_owned = false;
34830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34831 LDKThirtyTwoBytes val_ref;
34832 CHECK((*env)->GetArrayLength(env, val) == 32);
34833 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34834 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
34837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34838 LDKChannelReestablish this_ptr_conv;
34839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34840 this_ptr_conv.is_owned = false;
34841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34842 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
34846 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) {
34847 LDKChannelReestablish this_ptr_conv;
34848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34849 this_ptr_conv.is_owned = false;
34850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34851 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
34854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34855 LDKChannelReestablish this_ptr_conv;
34856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34857 this_ptr_conv.is_owned = false;
34858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34859 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
34863 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) {
34864 LDKChannelReestablish this_ptr_conv;
34865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34866 this_ptr_conv.is_owned = false;
34867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34868 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
34871 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
34872 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
34873 int64_t ret_ref = 0;
34874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34877 ret_ref = (uintptr_t)ret_var.inner;
34878 if (ret_var.is_owned) {
34883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34884 LDKChannelReestablish arg_conv;
34885 arg_conv.inner = (void*)(arg & (~1));
34886 arg_conv.is_owned = false;
34887 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34888 int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
34892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34893 LDKChannelReestablish orig_conv;
34894 orig_conv.inner = (void*)(orig & (~1));
34895 orig_conv.is_owned = false;
34896 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34897 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
34898 int64_t ret_ref = 0;
34899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34902 ret_ref = (uintptr_t)ret_var.inner;
34903 if (ret_var.is_owned) {
34909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34910 LDKAnnouncementSignatures this_obj_conv;
34911 this_obj_conv.inner = (void*)(this_obj & (~1));
34912 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34914 AnnouncementSignatures_free(this_obj_conv);
34917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34918 LDKAnnouncementSignatures this_ptr_conv;
34919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34920 this_ptr_conv.is_owned = false;
34921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34922 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
34927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34928 LDKAnnouncementSignatures this_ptr_conv;
34929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34930 this_ptr_conv.is_owned = false;
34931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34932 LDKThirtyTwoBytes val_ref;
34933 CHECK((*env)->GetArrayLength(env, val) == 32);
34934 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34935 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
34938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34939 LDKAnnouncementSignatures this_ptr_conv;
34940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34941 this_ptr_conv.is_owned = false;
34942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34943 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
34947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34948 LDKAnnouncementSignatures this_ptr_conv;
34949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34950 this_ptr_conv.is_owned = false;
34951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34952 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
34955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34956 LDKAnnouncementSignatures this_ptr_conv;
34957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34958 this_ptr_conv.is_owned = false;
34959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34960 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34961 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
34965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34966 LDKAnnouncementSignatures 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 LDKSignature val_ref;
34971 CHECK((*env)->GetArrayLength(env, val) == 64);
34972 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34973 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
34976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34977 LDKAnnouncementSignatures this_ptr_conv;
34978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34979 this_ptr_conv.is_owned = false;
34980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34981 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
34986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34987 LDKAnnouncementSignatures this_ptr_conv;
34988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34989 this_ptr_conv.is_owned = false;
34990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34991 LDKSignature val_ref;
34992 CHECK((*env)->GetArrayLength(env, val) == 64);
34993 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34994 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
34997 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) {
34998 LDKThirtyTwoBytes channel_id_arg_ref;
34999 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
35000 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
35001 LDKSignature node_signature_arg_ref;
35002 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
35003 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
35004 LDKSignature bitcoin_signature_arg_ref;
35005 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
35006 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
35007 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
35008 int64_t ret_ref = 0;
35009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35012 ret_ref = (uintptr_t)ret_var.inner;
35013 if (ret_var.is_owned) {
35019 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
35020 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
35021 int64_t ret_ref = 0;
35022 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35023 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35025 ret_ref = (uintptr_t)ret_var.inner;
35026 if (ret_var.is_owned) {
35031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35032 LDKAnnouncementSignatures arg_conv;
35033 arg_conv.inner = (void*)(arg & (~1));
35034 arg_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35036 int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
35040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35041 LDKAnnouncementSignatures orig_conv;
35042 orig_conv.inner = (void*)(orig & (~1));
35043 orig_conv.is_owned = false;
35044 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35045 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
35046 int64_t ret_ref = 0;
35047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35050 ret_ref = (uintptr_t)ret_var.inner;
35051 if (ret_var.is_owned) {
35057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35058 if ((this_ptr & 1) != 0) return;
35059 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35060 CHECK_ACCESS(this_ptr_ptr);
35061 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
35062 FREE((void*)this_ptr);
35063 NetAddress_free(this_ptr_conv);
35066 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
35067 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35068 *ret_copy = NetAddress_clone(arg);
35069 int64_t ret_ref = (uintptr_t)ret_copy;
35072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35073 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
35074 int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
35078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35079 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
35080 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35081 *ret_copy = NetAddress_clone(orig_conv);
35082 int64_t ret_ref = (uintptr_t)ret_copy;
35086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35087 LDKFourBytes addr_ref;
35088 CHECK((*env)->GetArrayLength(env, addr) == 4);
35089 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
35090 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35091 *ret_copy = NetAddress_ipv4(addr_ref, port);
35092 int64_t ret_ref = (uintptr_t)ret_copy;
35096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35097 LDKSixteenBytes addr_ref;
35098 CHECK((*env)->GetArrayLength(env, addr) == 16);
35099 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
35100 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35101 *ret_copy = NetAddress_ipv6(addr_ref, port);
35102 int64_t ret_ref = (uintptr_t)ret_copy;
35106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
35107 LDKTwelveBytes a_ref;
35108 CHECK((*env)->GetArrayLength(env, a) == 12);
35109 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
35110 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35111 *ret_copy = NetAddress_onion_v2(a_ref);
35112 int64_t ret_ref = (uintptr_t)ret_copy;
35116 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) {
35117 LDKThirtyTwoBytes ed25519_pubkey_ref;
35118 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
35119 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
35120 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35121 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
35122 int64_t ret_ref = (uintptr_t)ret_copy;
35126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
35127 LDKHostname hostname_conv;
35128 hostname_conv.inner = (void*)(hostname & (~1));
35129 hostname_conv.is_owned = (hostname & 1) || (hostname == 0);
35130 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
35131 hostname_conv = Hostname_clone(&hostname_conv);
35132 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35133 *ret_copy = NetAddress_hostname(hostname_conv, port);
35134 int64_t ret_ref = (uintptr_t)ret_copy;
35138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
35139 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
35140 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
35141 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35142 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35143 CVec_u8Z_free(ret_var);
35147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35148 LDKu8slice ser_ref;
35149 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35150 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35151 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
35152 *ret_conv = NetAddress_read(ser_ref);
35153 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35154 return (int64_t)ret_conv;
35157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35158 LDKUnsignedNodeAnnouncement this_obj_conv;
35159 this_obj_conv.inner = (void*)(this_obj & (~1));
35160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35162 UnsignedNodeAnnouncement_free(this_obj_conv);
35165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35166 LDKUnsignedNodeAnnouncement this_ptr_conv;
35167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35168 this_ptr_conv.is_owned = false;
35169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35170 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
35171 int64_t ret_ref = 0;
35172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35175 ret_ref = (uintptr_t)ret_var.inner;
35176 if (ret_var.is_owned) {
35182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35183 LDKUnsignedNodeAnnouncement this_ptr_conv;
35184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35185 this_ptr_conv.is_owned = false;
35186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35187 LDKNodeFeatures val_conv;
35188 val_conv.inner = (void*)(val & (~1));
35189 val_conv.is_owned = (val & 1) || (val == 0);
35190 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35191 val_conv = NodeFeatures_clone(&val_conv);
35192 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
35195 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35196 LDKUnsignedNodeAnnouncement this_ptr_conv;
35197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35198 this_ptr_conv.is_owned = false;
35199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35200 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
35204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35205 LDKUnsignedNodeAnnouncement this_ptr_conv;
35206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35207 this_ptr_conv.is_owned = false;
35208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35209 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
35212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35213 LDKUnsignedNodeAnnouncement this_ptr_conv;
35214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35215 this_ptr_conv.is_owned = false;
35216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35217 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
35222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35223 LDKUnsignedNodeAnnouncement this_ptr_conv;
35224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35225 this_ptr_conv.is_owned = false;
35226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35227 LDKPublicKey val_ref;
35228 CHECK((*env)->GetArrayLength(env, val) == 33);
35229 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35230 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
35233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
35234 LDKUnsignedNodeAnnouncement this_ptr_conv;
35235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35236 this_ptr_conv.is_owned = false;
35237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35238 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
35239 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
35243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35244 LDKUnsignedNodeAnnouncement 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 LDKThreeBytes val_ref;
35249 CHECK((*env)->GetArrayLength(env, val) == 3);
35250 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
35251 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
35254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
35255 LDKUnsignedNodeAnnouncement this_ptr_conv;
35256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35257 this_ptr_conv.is_owned = false;
35258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35259 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
35264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35265 LDKUnsignedNodeAnnouncement this_ptr_conv;
35266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35267 this_ptr_conv.is_owned = false;
35268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35269 LDKThirtyTwoBytes val_ref;
35270 CHECK((*env)->GetArrayLength(env, val) == 32);
35271 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35272 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
35275 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
35276 LDKUnsignedNodeAnnouncement this_ptr_conv;
35277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35278 this_ptr_conv.is_owned = false;
35279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35280 LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
35281 int64_tArray ret_arr = NULL;
35282 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35283 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35284 for (size_t m = 0; m < ret_var.datalen; m++) {
35285 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35286 *ret_conv_12_copy = ret_var.data[m];
35287 int64_t ret_conv_12_ref = (uintptr_t)ret_conv_12_copy;
35288 ret_arr_ptr[m] = ret_conv_12_ref;
35290 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35291 FREE(ret_var.data);
35295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35296 LDKUnsignedNodeAnnouncement this_ptr_conv;
35297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35298 this_ptr_conv.is_owned = false;
35299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35300 LDKCVec_NetAddressZ val_constr;
35301 val_constr.datalen = (*env)->GetArrayLength(env, val);
35302 if (val_constr.datalen > 0)
35303 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35305 val_constr.data = NULL;
35306 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35307 for (size_t m = 0; m < val_constr.datalen; m++) {
35308 int64_t val_conv_12 = val_vals[m];
35309 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
35310 CHECK_ACCESS(val_conv_12_ptr);
35311 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
35312 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
35313 val_constr.data[m] = val_conv_12_conv;
35315 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35316 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
35319 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
35320 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
35321 int64_t ret_ref = 0;
35322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35325 ret_ref = (uintptr_t)ret_var.inner;
35326 if (ret_var.is_owned) {
35331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35332 LDKUnsignedNodeAnnouncement arg_conv;
35333 arg_conv.inner = (void*)(arg & (~1));
35334 arg_conv.is_owned = false;
35335 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35336 int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
35340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35341 LDKUnsignedNodeAnnouncement orig_conv;
35342 orig_conv.inner = (void*)(orig & (~1));
35343 orig_conv.is_owned = false;
35344 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35345 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
35346 int64_t ret_ref = 0;
35347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35350 ret_ref = (uintptr_t)ret_var.inner;
35351 if (ret_var.is_owned) {
35357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35358 LDKNodeAnnouncement this_obj_conv;
35359 this_obj_conv.inner = (void*)(this_obj & (~1));
35360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35362 NodeAnnouncement_free(this_obj_conv);
35365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35366 LDKNodeAnnouncement this_ptr_conv;
35367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35368 this_ptr_conv.is_owned = false;
35369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35370 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35371 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
35375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35376 LDKNodeAnnouncement this_ptr_conv;
35377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35378 this_ptr_conv.is_owned = false;
35379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35380 LDKSignature val_ref;
35381 CHECK((*env)->GetArrayLength(env, val) == 64);
35382 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35383 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
35386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35387 LDKNodeAnnouncement this_ptr_conv;
35388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35389 this_ptr_conv.is_owned = false;
35390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35391 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
35392 int64_t ret_ref = 0;
35393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35396 ret_ref = (uintptr_t)ret_var.inner;
35397 if (ret_var.is_owned) {
35403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35404 LDKNodeAnnouncement this_ptr_conv;
35405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35406 this_ptr_conv.is_owned = false;
35407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35408 LDKUnsignedNodeAnnouncement val_conv;
35409 val_conv.inner = (void*)(val & (~1));
35410 val_conv.is_owned = (val & 1) || (val == 0);
35411 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35412 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
35413 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
35416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
35417 LDKSignature signature_arg_ref;
35418 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
35419 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
35420 LDKUnsignedNodeAnnouncement contents_arg_conv;
35421 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35422 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35423 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35424 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
35425 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
35426 int64_t ret_ref = 0;
35427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35430 ret_ref = (uintptr_t)ret_var.inner;
35431 if (ret_var.is_owned) {
35437 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
35438 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
35439 int64_t ret_ref = 0;
35440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35443 ret_ref = (uintptr_t)ret_var.inner;
35444 if (ret_var.is_owned) {
35449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35450 LDKNodeAnnouncement arg_conv;
35451 arg_conv.inner = (void*)(arg & (~1));
35452 arg_conv.is_owned = false;
35453 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35454 int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
35458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35459 LDKNodeAnnouncement orig_conv;
35460 orig_conv.inner = (void*)(orig & (~1));
35461 orig_conv.is_owned = false;
35462 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35463 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
35464 int64_t ret_ref = 0;
35465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35468 ret_ref = (uintptr_t)ret_var.inner;
35469 if (ret_var.is_owned) {
35475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35476 LDKUnsignedChannelAnnouncement this_obj_conv;
35477 this_obj_conv.inner = (void*)(this_obj & (~1));
35478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35480 UnsignedChannelAnnouncement_free(this_obj_conv);
35483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35484 LDKUnsignedChannelAnnouncement this_ptr_conv;
35485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35486 this_ptr_conv.is_owned = false;
35487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35488 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
35489 int64_t ret_ref = 0;
35490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35493 ret_ref = (uintptr_t)ret_var.inner;
35494 if (ret_var.is_owned) {
35500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35501 LDKUnsignedChannelAnnouncement this_ptr_conv;
35502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35503 this_ptr_conv.is_owned = false;
35504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35505 LDKChannelFeatures val_conv;
35506 val_conv.inner = (void*)(val & (~1));
35507 val_conv.is_owned = (val & 1) || (val == 0);
35508 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35509 val_conv = ChannelFeatures_clone(&val_conv);
35510 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
35513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35514 LDKUnsignedChannelAnnouncement this_ptr_conv;
35515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35516 this_ptr_conv.is_owned = false;
35517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35518 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
35523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35524 LDKUnsignedChannelAnnouncement this_ptr_conv;
35525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35526 this_ptr_conv.is_owned = false;
35527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35528 LDKThirtyTwoBytes val_ref;
35529 CHECK((*env)->GetArrayLength(env, val) == 32);
35530 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35531 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
35534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35535 LDKUnsignedChannelAnnouncement this_ptr_conv;
35536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35537 this_ptr_conv.is_owned = false;
35538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35539 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
35543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35544 LDKUnsignedChannelAnnouncement this_ptr_conv;
35545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35546 this_ptr_conv.is_owned = false;
35547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35548 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
35551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35552 LDKUnsignedChannelAnnouncement this_ptr_conv;
35553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35554 this_ptr_conv.is_owned = false;
35555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35556 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35557 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
35561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35562 LDKUnsignedChannelAnnouncement this_ptr_conv;
35563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35564 this_ptr_conv.is_owned = false;
35565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35566 LDKPublicKey val_ref;
35567 CHECK((*env)->GetArrayLength(env, val) == 33);
35568 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35569 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
35572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35573 LDKUnsignedChannelAnnouncement this_ptr_conv;
35574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35575 this_ptr_conv.is_owned = false;
35576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35577 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
35582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35583 LDKUnsignedChannelAnnouncement this_ptr_conv;
35584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35585 this_ptr_conv.is_owned = false;
35586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35587 LDKPublicKey val_ref;
35588 CHECK((*env)->GetArrayLength(env, val) == 33);
35589 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35590 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
35593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35594 LDKUnsignedChannelAnnouncement this_ptr_conv;
35595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35596 this_ptr_conv.is_owned = false;
35597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35598 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35599 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
35603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35604 LDKUnsignedChannelAnnouncement this_ptr_conv;
35605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35606 this_ptr_conv.is_owned = false;
35607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35608 LDKPublicKey val_ref;
35609 CHECK((*env)->GetArrayLength(env, val) == 33);
35610 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35611 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
35614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35615 LDKUnsignedChannelAnnouncement this_ptr_conv;
35616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35617 this_ptr_conv.is_owned = false;
35618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35619 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35620 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
35624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35625 LDKUnsignedChannelAnnouncement this_ptr_conv;
35626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35627 this_ptr_conv.is_owned = false;
35628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35629 LDKPublicKey val_ref;
35630 CHECK((*env)->GetArrayLength(env, val) == 33);
35631 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35632 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
35635 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
35636 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
35637 int64_t ret_ref = 0;
35638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35641 ret_ref = (uintptr_t)ret_var.inner;
35642 if (ret_var.is_owned) {
35647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35648 LDKUnsignedChannelAnnouncement arg_conv;
35649 arg_conv.inner = (void*)(arg & (~1));
35650 arg_conv.is_owned = false;
35651 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35652 int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
35656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35657 LDKUnsignedChannelAnnouncement orig_conv;
35658 orig_conv.inner = (void*)(orig & (~1));
35659 orig_conv.is_owned = false;
35660 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35661 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
35662 int64_t ret_ref = 0;
35663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35666 ret_ref = (uintptr_t)ret_var.inner;
35667 if (ret_var.is_owned) {
35673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35674 LDKChannelAnnouncement this_obj_conv;
35675 this_obj_conv.inner = (void*)(this_obj & (~1));
35676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35678 ChannelAnnouncement_free(this_obj_conv);
35681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35682 LDKChannelAnnouncement this_ptr_conv;
35683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35684 this_ptr_conv.is_owned = false;
35685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35686 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35687 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
35691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35692 LDKChannelAnnouncement this_ptr_conv;
35693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35694 this_ptr_conv.is_owned = false;
35695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35696 LDKSignature val_ref;
35697 CHECK((*env)->GetArrayLength(env, val) == 64);
35698 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35699 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
35702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35703 LDKChannelAnnouncement this_ptr_conv;
35704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35705 this_ptr_conv.is_owned = false;
35706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35707 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35708 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
35712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35713 LDKChannelAnnouncement this_ptr_conv;
35714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35715 this_ptr_conv.is_owned = false;
35716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35717 LDKSignature val_ref;
35718 CHECK((*env)->GetArrayLength(env, val) == 64);
35719 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35720 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
35723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35724 LDKChannelAnnouncement this_ptr_conv;
35725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35726 this_ptr_conv.is_owned = false;
35727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35728 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35729 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
35733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35734 LDKChannelAnnouncement this_ptr_conv;
35735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35736 this_ptr_conv.is_owned = false;
35737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35738 LDKSignature val_ref;
35739 CHECK((*env)->GetArrayLength(env, val) == 64);
35740 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35741 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
35744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35745 LDKChannelAnnouncement this_ptr_conv;
35746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35747 this_ptr_conv.is_owned = false;
35748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35749 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35750 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
35754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35755 LDKChannelAnnouncement this_ptr_conv;
35756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35757 this_ptr_conv.is_owned = false;
35758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35759 LDKSignature val_ref;
35760 CHECK((*env)->GetArrayLength(env, val) == 64);
35761 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35762 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
35765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35766 LDKChannelAnnouncement 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 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
35771 int64_t ret_ref = 0;
35772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35775 ret_ref = (uintptr_t)ret_var.inner;
35776 if (ret_var.is_owned) {
35782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35783 LDKChannelAnnouncement this_ptr_conv;
35784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35785 this_ptr_conv.is_owned = false;
35786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35787 LDKUnsignedChannelAnnouncement val_conv;
35788 val_conv.inner = (void*)(val & (~1));
35789 val_conv.is_owned = (val & 1) || (val == 0);
35790 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35791 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
35792 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
35795 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) {
35796 LDKSignature node_signature_1_arg_ref;
35797 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
35798 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
35799 LDKSignature node_signature_2_arg_ref;
35800 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
35801 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
35802 LDKSignature bitcoin_signature_1_arg_ref;
35803 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
35804 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
35805 LDKSignature bitcoin_signature_2_arg_ref;
35806 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
35807 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
35808 LDKUnsignedChannelAnnouncement contents_arg_conv;
35809 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35810 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35811 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35812 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
35813 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);
35814 int64_t ret_ref = 0;
35815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35818 ret_ref = (uintptr_t)ret_var.inner;
35819 if (ret_var.is_owned) {
35825 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
35826 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
35827 int64_t ret_ref = 0;
35828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35831 ret_ref = (uintptr_t)ret_var.inner;
35832 if (ret_var.is_owned) {
35837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35838 LDKChannelAnnouncement arg_conv;
35839 arg_conv.inner = (void*)(arg & (~1));
35840 arg_conv.is_owned = false;
35841 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35842 int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
35846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35847 LDKChannelAnnouncement orig_conv;
35848 orig_conv.inner = (void*)(orig & (~1));
35849 orig_conv.is_owned = false;
35850 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35851 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
35852 int64_t ret_ref = 0;
35853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35856 ret_ref = (uintptr_t)ret_var.inner;
35857 if (ret_var.is_owned) {
35863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35864 LDKUnsignedChannelUpdate this_obj_conv;
35865 this_obj_conv.inner = (void*)(this_obj & (~1));
35866 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35868 UnsignedChannelUpdate_free(this_obj_conv);
35871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35872 LDKUnsignedChannelUpdate this_ptr_conv;
35873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35874 this_ptr_conv.is_owned = false;
35875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35876 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35877 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
35881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35882 LDKUnsignedChannelUpdate this_ptr_conv;
35883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35884 this_ptr_conv.is_owned = false;
35885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35886 LDKThirtyTwoBytes val_ref;
35887 CHECK((*env)->GetArrayLength(env, val) == 32);
35888 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35889 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
35892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35893 LDKUnsignedChannelUpdate this_ptr_conv;
35894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35895 this_ptr_conv.is_owned = false;
35896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35897 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
35901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35902 LDKUnsignedChannelUpdate this_ptr_conv;
35903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35904 this_ptr_conv.is_owned = false;
35905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35906 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
35909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35910 LDKUnsignedChannelUpdate this_ptr_conv;
35911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35912 this_ptr_conv.is_owned = false;
35913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35914 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
35918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35919 LDKUnsignedChannelUpdate this_ptr_conv;
35920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35921 this_ptr_conv.is_owned = false;
35922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35923 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
35926 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
35927 LDKUnsignedChannelUpdate this_ptr_conv;
35928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35929 this_ptr_conv.is_owned = false;
35930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35931 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
35935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
35936 LDKUnsignedChannelUpdate this_ptr_conv;
35937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35938 this_ptr_conv.is_owned = false;
35939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35940 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
35943 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
35944 LDKUnsignedChannelUpdate this_ptr_conv;
35945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35946 this_ptr_conv.is_owned = false;
35947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35948 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
35952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35953 LDKUnsignedChannelUpdate this_ptr_conv;
35954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35955 this_ptr_conv.is_owned = false;
35956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35957 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
35960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35961 LDKUnsignedChannelUpdate this_ptr_conv;
35962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35963 this_ptr_conv.is_owned = false;
35964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35965 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
35969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35970 LDKUnsignedChannelUpdate this_ptr_conv;
35971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35972 this_ptr_conv.is_owned = false;
35973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35974 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
35977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35978 LDKUnsignedChannelUpdate this_ptr_conv;
35979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35980 this_ptr_conv.is_owned = false;
35981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
35986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35987 LDKUnsignedChannelUpdate this_ptr_conv;
35988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35989 this_ptr_conv.is_owned = false;
35990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35991 UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
35994 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35995 LDKUnsignedChannelUpdate this_ptr_conv;
35996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35997 this_ptr_conv.is_owned = false;
35998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35999 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
36003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36004 LDKUnsignedChannelUpdate this_ptr_conv;
36005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36006 this_ptr_conv.is_owned = false;
36007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36008 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
36011 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36012 LDKUnsignedChannelUpdate this_ptr_conv;
36013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36014 this_ptr_conv.is_owned = false;
36015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36016 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
36020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36021 LDKUnsignedChannelUpdate this_ptr_conv;
36022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36023 this_ptr_conv.is_owned = false;
36024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36025 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
36028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
36029 LDKUnsignedChannelUpdate this_ptr_conv;
36030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36031 this_ptr_conv.is_owned = false;
36032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36033 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
36034 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36035 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36036 CVec_u8Z_free(ret_var);
36040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36041 LDKUnsignedChannelUpdate this_ptr_conv;
36042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36043 this_ptr_conv.is_owned = false;
36044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36045 LDKCVec_u8Z val_ref;
36046 val_ref.datalen = (*env)->GetArrayLength(env, val);
36047 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36048 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36049 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
36052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
36053 LDKThirtyTwoBytes chain_hash_arg_ref;
36054 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36055 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36056 LDKCVec_u8Z excess_data_arg_ref;
36057 excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
36058 excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36059 (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
36060 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
36061 int64_t ret_ref = 0;
36062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36065 ret_ref = (uintptr_t)ret_var.inner;
36066 if (ret_var.is_owned) {
36072 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
36073 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
36074 int64_t ret_ref = 0;
36075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36078 ret_ref = (uintptr_t)ret_var.inner;
36079 if (ret_var.is_owned) {
36084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36085 LDKUnsignedChannelUpdate arg_conv;
36086 arg_conv.inner = (void*)(arg & (~1));
36087 arg_conv.is_owned = false;
36088 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36089 int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
36093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36094 LDKUnsignedChannelUpdate orig_conv;
36095 orig_conv.inner = (void*)(orig & (~1));
36096 orig_conv.is_owned = false;
36097 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36098 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
36099 int64_t ret_ref = 0;
36100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36103 ret_ref = (uintptr_t)ret_var.inner;
36104 if (ret_var.is_owned) {
36110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36111 LDKChannelUpdate this_obj_conv;
36112 this_obj_conv.inner = (void*)(this_obj & (~1));
36113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36115 ChannelUpdate_free(this_obj_conv);
36118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36119 LDKChannelUpdate this_ptr_conv;
36120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36121 this_ptr_conv.is_owned = false;
36122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36123 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
36128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36129 LDKChannelUpdate this_ptr_conv;
36130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36131 this_ptr_conv.is_owned = false;
36132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36133 LDKSignature val_ref;
36134 CHECK((*env)->GetArrayLength(env, val) == 64);
36135 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36136 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
36139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
36140 LDKChannelUpdate this_ptr_conv;
36141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36142 this_ptr_conv.is_owned = false;
36143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36144 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
36145 int64_t ret_ref = 0;
36146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36149 ret_ref = (uintptr_t)ret_var.inner;
36150 if (ret_var.is_owned) {
36156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36157 LDKChannelUpdate this_ptr_conv;
36158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36159 this_ptr_conv.is_owned = false;
36160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36161 LDKUnsignedChannelUpdate val_conv;
36162 val_conv.inner = (void*)(val & (~1));
36163 val_conv.is_owned = (val & 1) || (val == 0);
36164 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36165 val_conv = UnsignedChannelUpdate_clone(&val_conv);
36166 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
36169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
36170 LDKSignature signature_arg_ref;
36171 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36172 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36173 LDKUnsignedChannelUpdate contents_arg_conv;
36174 contents_arg_conv.inner = (void*)(contents_arg & (~1));
36175 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
36176 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
36177 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
36178 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
36179 int64_t ret_ref = 0;
36180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36183 ret_ref = (uintptr_t)ret_var.inner;
36184 if (ret_var.is_owned) {
36190 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
36191 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
36192 int64_t ret_ref = 0;
36193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36196 ret_ref = (uintptr_t)ret_var.inner;
36197 if (ret_var.is_owned) {
36202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36203 LDKChannelUpdate arg_conv;
36204 arg_conv.inner = (void*)(arg & (~1));
36205 arg_conv.is_owned = false;
36206 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36207 int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
36211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36212 LDKChannelUpdate orig_conv;
36213 orig_conv.inner = (void*)(orig & (~1));
36214 orig_conv.is_owned = false;
36215 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36216 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
36217 int64_t ret_ref = 0;
36218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36221 ret_ref = (uintptr_t)ret_var.inner;
36222 if (ret_var.is_owned) {
36228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36229 LDKQueryChannelRange this_obj_conv;
36230 this_obj_conv.inner = (void*)(this_obj & (~1));
36231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36233 QueryChannelRange_free(this_obj_conv);
36236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36237 LDKQueryChannelRange this_ptr_conv;
36238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36239 this_ptr_conv.is_owned = false;
36240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36241 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
36246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36247 LDKQueryChannelRange this_ptr_conv;
36248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36249 this_ptr_conv.is_owned = false;
36250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36251 LDKThirtyTwoBytes val_ref;
36252 CHECK((*env)->GetArrayLength(env, val) == 32);
36253 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36254 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36257 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36258 LDKQueryChannelRange this_ptr_conv;
36259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36260 this_ptr_conv.is_owned = false;
36261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36262 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
36266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36267 LDKQueryChannelRange this_ptr_conv;
36268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36269 this_ptr_conv.is_owned = false;
36270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36271 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
36274 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36275 LDKQueryChannelRange this_ptr_conv;
36276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36277 this_ptr_conv.is_owned = false;
36278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36279 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
36283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36284 LDKQueryChannelRange this_ptr_conv;
36285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36286 this_ptr_conv.is_owned = false;
36287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36288 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36291 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) {
36292 LDKThirtyTwoBytes chain_hash_arg_ref;
36293 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36294 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36295 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
36296 int64_t ret_ref = 0;
36297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36300 ret_ref = (uintptr_t)ret_var.inner;
36301 if (ret_var.is_owned) {
36307 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
36308 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
36309 int64_t ret_ref = 0;
36310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36313 ret_ref = (uintptr_t)ret_var.inner;
36314 if (ret_var.is_owned) {
36319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36320 LDKQueryChannelRange arg_conv;
36321 arg_conv.inner = (void*)(arg & (~1));
36322 arg_conv.is_owned = false;
36323 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36324 int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
36328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36329 LDKQueryChannelRange orig_conv;
36330 orig_conv.inner = (void*)(orig & (~1));
36331 orig_conv.is_owned = false;
36332 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36333 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
36334 int64_t ret_ref = 0;
36335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36338 ret_ref = (uintptr_t)ret_var.inner;
36339 if (ret_var.is_owned) {
36345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36346 LDKReplyChannelRange this_obj_conv;
36347 this_obj_conv.inner = (void*)(this_obj & (~1));
36348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36350 ReplyChannelRange_free(this_obj_conv);
36353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36354 LDKReplyChannelRange this_ptr_conv;
36355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36356 this_ptr_conv.is_owned = false;
36357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36358 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
36363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36364 LDKReplyChannelRange this_ptr_conv;
36365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36366 this_ptr_conv.is_owned = false;
36367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36368 LDKThirtyTwoBytes val_ref;
36369 CHECK((*env)->GetArrayLength(env, val) == 32);
36370 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36371 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36374 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36375 LDKReplyChannelRange this_ptr_conv;
36376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36377 this_ptr_conv.is_owned = false;
36378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36379 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
36383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36384 LDKReplyChannelRange this_ptr_conv;
36385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36386 this_ptr_conv.is_owned = false;
36387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36388 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
36391 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36392 LDKReplyChannelRange this_ptr_conv;
36393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36394 this_ptr_conv.is_owned = false;
36395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36396 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
36400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36401 LDKReplyChannelRange this_ptr_conv;
36402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36403 this_ptr_conv.is_owned = false;
36404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36405 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
36409 LDKReplyChannelRange this_ptr_conv;
36410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36411 this_ptr_conv.is_owned = false;
36412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36413 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
36417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36418 LDKReplyChannelRange this_ptr_conv;
36419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36420 this_ptr_conv.is_owned = false;
36421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36422 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
36425 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36426 LDKReplyChannelRange this_ptr_conv;
36427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36428 this_ptr_conv.is_owned = false;
36429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36430 LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
36431 int64_tArray ret_arr = NULL;
36432 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36433 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36434 for (size_t g = 0; g < ret_var.datalen; g++) {
36435 int64_t ret_conv_6_conv = ret_var.data[g];
36436 ret_arr_ptr[g] = ret_conv_6_conv;
36438 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36439 FREE(ret_var.data);
36443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36444 LDKReplyChannelRange this_ptr_conv;
36445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36446 this_ptr_conv.is_owned = false;
36447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36448 LDKCVec_u64Z val_constr;
36449 val_constr.datalen = (*env)->GetArrayLength(env, val);
36450 if (val_constr.datalen > 0)
36451 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36453 val_constr.data = NULL;
36454 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36455 for (size_t g = 0; g < val_constr.datalen; g++) {
36456 int64_t val_conv_6 = val_vals[g];
36457 val_constr.data[g] = val_conv_6;
36459 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36460 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
36463 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) {
36464 LDKThirtyTwoBytes chain_hash_arg_ref;
36465 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36466 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36467 LDKCVec_u64Z short_channel_ids_arg_constr;
36468 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36469 if (short_channel_ids_arg_constr.datalen > 0)
36470 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36472 short_channel_ids_arg_constr.data = NULL;
36473 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36474 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36475 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36476 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36478 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36479 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
36480 int64_t ret_ref = 0;
36481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36484 ret_ref = (uintptr_t)ret_var.inner;
36485 if (ret_var.is_owned) {
36491 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
36492 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
36493 int64_t ret_ref = 0;
36494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36497 ret_ref = (uintptr_t)ret_var.inner;
36498 if (ret_var.is_owned) {
36503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36504 LDKReplyChannelRange arg_conv;
36505 arg_conv.inner = (void*)(arg & (~1));
36506 arg_conv.is_owned = false;
36507 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36508 int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
36512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36513 LDKReplyChannelRange orig_conv;
36514 orig_conv.inner = (void*)(orig & (~1));
36515 orig_conv.is_owned = false;
36516 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36517 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
36518 int64_t ret_ref = 0;
36519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36522 ret_ref = (uintptr_t)ret_var.inner;
36523 if (ret_var.is_owned) {
36529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36530 LDKQueryShortChannelIds this_obj_conv;
36531 this_obj_conv.inner = (void*)(this_obj & (~1));
36532 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36534 QueryShortChannelIds_free(this_obj_conv);
36537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36538 LDKQueryShortChannelIds this_ptr_conv;
36539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36540 this_ptr_conv.is_owned = false;
36541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36542 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36543 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
36547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36548 LDKQueryShortChannelIds this_ptr_conv;
36549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36550 this_ptr_conv.is_owned = false;
36551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36552 LDKThirtyTwoBytes val_ref;
36553 CHECK((*env)->GetArrayLength(env, val) == 32);
36554 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36555 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
36558 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36559 LDKQueryShortChannelIds this_ptr_conv;
36560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36561 this_ptr_conv.is_owned = false;
36562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36563 LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
36564 int64_tArray ret_arr = NULL;
36565 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36566 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36567 for (size_t g = 0; g < ret_var.datalen; g++) {
36568 int64_t ret_conv_6_conv = ret_var.data[g];
36569 ret_arr_ptr[g] = ret_conv_6_conv;
36571 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36572 FREE(ret_var.data);
36576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36577 LDKQueryShortChannelIds this_ptr_conv;
36578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36579 this_ptr_conv.is_owned = false;
36580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36581 LDKCVec_u64Z val_constr;
36582 val_constr.datalen = (*env)->GetArrayLength(env, val);
36583 if (val_constr.datalen > 0)
36584 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36586 val_constr.data = NULL;
36587 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36588 for (size_t g = 0; g < val_constr.datalen; g++) {
36589 int64_t val_conv_6 = val_vals[g];
36590 val_constr.data[g] = val_conv_6;
36592 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36593 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
36596 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) {
36597 LDKThirtyTwoBytes chain_hash_arg_ref;
36598 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36599 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36600 LDKCVec_u64Z short_channel_ids_arg_constr;
36601 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36602 if (short_channel_ids_arg_constr.datalen > 0)
36603 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36605 short_channel_ids_arg_constr.data = NULL;
36606 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36607 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36608 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36609 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36611 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36612 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
36613 int64_t ret_ref = 0;
36614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36617 ret_ref = (uintptr_t)ret_var.inner;
36618 if (ret_var.is_owned) {
36624 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
36625 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
36626 int64_t ret_ref = 0;
36627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36630 ret_ref = (uintptr_t)ret_var.inner;
36631 if (ret_var.is_owned) {
36636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36637 LDKQueryShortChannelIds arg_conv;
36638 arg_conv.inner = (void*)(arg & (~1));
36639 arg_conv.is_owned = false;
36640 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36641 int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
36645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36646 LDKQueryShortChannelIds orig_conv;
36647 orig_conv.inner = (void*)(orig & (~1));
36648 orig_conv.is_owned = false;
36649 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36650 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
36651 int64_t ret_ref = 0;
36652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36655 ret_ref = (uintptr_t)ret_var.inner;
36656 if (ret_var.is_owned) {
36662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36663 LDKReplyShortChannelIdsEnd this_obj_conv;
36664 this_obj_conv.inner = (void*)(this_obj & (~1));
36665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36667 ReplyShortChannelIdsEnd_free(this_obj_conv);
36670 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36671 LDKReplyShortChannelIdsEnd this_ptr_conv;
36672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36673 this_ptr_conv.is_owned = false;
36674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36675 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36676 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
36680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36681 LDKReplyShortChannelIdsEnd this_ptr_conv;
36682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36683 this_ptr_conv.is_owned = false;
36684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36685 LDKThirtyTwoBytes val_ref;
36686 CHECK((*env)->GetArrayLength(env, val) == 32);
36687 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36688 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
36691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
36692 LDKReplyShortChannelIdsEnd this_ptr_conv;
36693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36694 this_ptr_conv.is_owned = false;
36695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36696 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
36700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36701 LDKReplyShortChannelIdsEnd this_ptr_conv;
36702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36703 this_ptr_conv.is_owned = false;
36704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36705 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
36708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
36709 LDKThirtyTwoBytes chain_hash_arg_ref;
36710 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36711 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36712 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
36713 int64_t ret_ref = 0;
36714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36717 ret_ref = (uintptr_t)ret_var.inner;
36718 if (ret_var.is_owned) {
36724 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
36725 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
36726 int64_t ret_ref = 0;
36727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36730 ret_ref = (uintptr_t)ret_var.inner;
36731 if (ret_var.is_owned) {
36736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36737 LDKReplyShortChannelIdsEnd arg_conv;
36738 arg_conv.inner = (void*)(arg & (~1));
36739 arg_conv.is_owned = false;
36740 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36741 int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
36745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36746 LDKReplyShortChannelIdsEnd orig_conv;
36747 orig_conv.inner = (void*)(orig & (~1));
36748 orig_conv.is_owned = false;
36749 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36750 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
36751 int64_t ret_ref = 0;
36752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36755 ret_ref = (uintptr_t)ret_var.inner;
36756 if (ret_var.is_owned) {
36762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36763 LDKGossipTimestampFilter this_obj_conv;
36764 this_obj_conv.inner = (void*)(this_obj & (~1));
36765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36767 GossipTimestampFilter_free(this_obj_conv);
36770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36771 LDKGossipTimestampFilter this_ptr_conv;
36772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36773 this_ptr_conv.is_owned = false;
36774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36775 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
36780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36781 LDKGossipTimestampFilter this_ptr_conv;
36782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36783 this_ptr_conv.is_owned = false;
36784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36785 LDKThirtyTwoBytes val_ref;
36786 CHECK((*env)->GetArrayLength(env, val) == 32);
36787 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36788 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
36791 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
36792 LDKGossipTimestampFilter this_ptr_conv;
36793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36794 this_ptr_conv.is_owned = false;
36795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36796 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
36800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36801 LDKGossipTimestampFilter this_ptr_conv;
36802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36803 this_ptr_conv.is_owned = false;
36804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36805 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
36808 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
36809 LDKGossipTimestampFilter this_ptr_conv;
36810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36811 this_ptr_conv.is_owned = false;
36812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36813 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
36817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36818 LDKGossipTimestampFilter this_ptr_conv;
36819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36820 this_ptr_conv.is_owned = false;
36821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36822 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
36825 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) {
36826 LDKThirtyTwoBytes chain_hash_arg_ref;
36827 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36828 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36829 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
36830 int64_t ret_ref = 0;
36831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36834 ret_ref = (uintptr_t)ret_var.inner;
36835 if (ret_var.is_owned) {
36841 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
36842 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
36843 int64_t ret_ref = 0;
36844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36847 ret_ref = (uintptr_t)ret_var.inner;
36848 if (ret_var.is_owned) {
36853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36854 LDKGossipTimestampFilter arg_conv;
36855 arg_conv.inner = (void*)(arg & (~1));
36856 arg_conv.is_owned = false;
36857 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36858 int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
36862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36863 LDKGossipTimestampFilter orig_conv;
36864 orig_conv.inner = (void*)(orig & (~1));
36865 orig_conv.is_owned = false;
36866 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36867 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
36868 int64_t ret_ref = 0;
36869 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36870 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36872 ret_ref = (uintptr_t)ret_var.inner;
36873 if (ret_var.is_owned) {
36879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36880 if ((this_ptr & 1) != 0) return;
36881 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36882 CHECK_ACCESS(this_ptr_ptr);
36883 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
36884 FREE((void*)this_ptr);
36885 ErrorAction_free(this_ptr_conv);
36888 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
36889 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36890 *ret_copy = ErrorAction_clone(arg);
36891 int64_t ret_ref = (uintptr_t)ret_copy;
36894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36895 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
36896 int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
36900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36901 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
36902 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36903 *ret_copy = ErrorAction_clone(orig_conv);
36904 int64_t ret_ref = (uintptr_t)ret_copy;
36908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
36909 LDKErrorMessage msg_conv;
36910 msg_conv.inner = (void*)(msg & (~1));
36911 msg_conv.is_owned = (msg & 1) || (msg == 0);
36912 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36913 msg_conv = ErrorMessage_clone(&msg_conv);
36914 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36915 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
36916 int64_t ret_ref = (uintptr_t)ret_copy;
36920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
36921 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36922 *ret_copy = ErrorAction_ignore_error();
36923 int64_t ret_ref = (uintptr_t)ret_copy;
36927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
36928 LDKLevel a_conv = LDKLevel_from_java(env, a);
36929 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36930 *ret_copy = ErrorAction_ignore_and_log(a_conv);
36931 int64_t ret_ref = (uintptr_t)ret_copy;
36935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
36936 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36937 *ret_copy = ErrorAction_ignore_duplicate_gossip();
36938 int64_t ret_ref = (uintptr_t)ret_copy;
36942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
36943 LDKErrorMessage msg_conv;
36944 msg_conv.inner = (void*)(msg & (~1));
36945 msg_conv.is_owned = (msg & 1) || (msg == 0);
36946 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36947 msg_conv = ErrorMessage_clone(&msg_conv);
36948 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36949 *ret_copy = ErrorAction_send_error_message(msg_conv);
36950 int64_t ret_ref = (uintptr_t)ret_copy;
36954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
36955 LDKWarningMessage msg_conv;
36956 msg_conv.inner = (void*)(msg & (~1));
36957 msg_conv.is_owned = (msg & 1) || (msg == 0);
36958 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36959 msg_conv = WarningMessage_clone(&msg_conv);
36960 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
36961 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36962 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
36963 int64_t ret_ref = (uintptr_t)ret_copy;
36967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36968 LDKLightningError this_obj_conv;
36969 this_obj_conv.inner = (void*)(this_obj & (~1));
36970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36972 LightningError_free(this_obj_conv);
36975 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
36976 LDKLightningError this_ptr_conv;
36977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36978 this_ptr_conv.is_owned = false;
36979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36980 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
36981 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
36986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
36987 LDKLightningError this_ptr_conv;
36988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36989 this_ptr_conv.is_owned = false;
36990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36991 LDKStr val_conv = java_to_owned_str(env, val);
36992 LightningError_set_err(&this_ptr_conv, val_conv);
36995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
36996 LDKLightningError this_ptr_conv;
36997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36998 this_ptr_conv.is_owned = false;
36999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37000 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37001 *ret_copy = LightningError_get_action(&this_ptr_conv);
37002 int64_t ret_ref = (uintptr_t)ret_copy;
37006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37007 LDKLightningError this_ptr_conv;
37008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37009 this_ptr_conv.is_owned = false;
37010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37011 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37012 CHECK_ACCESS(val_ptr);
37013 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
37014 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
37015 LightningError_set_action(&this_ptr_conv, val_conv);
37018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
37019 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
37020 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
37021 CHECK_ACCESS(action_arg_ptr);
37022 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
37023 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
37024 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
37025 int64_t ret_ref = 0;
37026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37029 ret_ref = (uintptr_t)ret_var.inner;
37030 if (ret_var.is_owned) {
37036 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
37037 LDKLightningError ret_var = LightningError_clone(arg);
37038 int64_t ret_ref = 0;
37039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37042 ret_ref = (uintptr_t)ret_var.inner;
37043 if (ret_var.is_owned) {
37048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37049 LDKLightningError arg_conv;
37050 arg_conv.inner = (void*)(arg & (~1));
37051 arg_conv.is_owned = false;
37052 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37053 int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
37057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37058 LDKLightningError orig_conv;
37059 orig_conv.inner = (void*)(orig & (~1));
37060 orig_conv.is_owned = false;
37061 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37062 LDKLightningError ret_var = LightningError_clone(&orig_conv);
37063 int64_t ret_ref = 0;
37064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37067 ret_ref = (uintptr_t)ret_var.inner;
37068 if (ret_var.is_owned) {
37074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37075 LDKCommitmentUpdate this_obj_conv;
37076 this_obj_conv.inner = (void*)(this_obj & (~1));
37077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37079 CommitmentUpdate_free(this_obj_conv);
37082 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37083 LDKCommitmentUpdate this_ptr_conv;
37084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37085 this_ptr_conv.is_owned = false;
37086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37087 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
37088 int64_tArray ret_arr = NULL;
37089 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37090 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37091 for (size_t p = 0; p < ret_var.datalen; p++) {
37092 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
37093 int64_t ret_conv_15_ref = 0;
37094 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37095 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
37097 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
37098 if (ret_conv_15_var.is_owned) {
37099 ret_conv_15_ref |= 1;
37101 ret_arr_ptr[p] = ret_conv_15_ref;
37103 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37104 FREE(ret_var.data);
37108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37109 LDKCommitmentUpdate this_ptr_conv;
37110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37111 this_ptr_conv.is_owned = false;
37112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37113 LDKCVec_UpdateAddHTLCZ val_constr;
37114 val_constr.datalen = (*env)->GetArrayLength(env, val);
37115 if (val_constr.datalen > 0)
37116 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37118 val_constr.data = NULL;
37119 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37120 for (size_t p = 0; p < val_constr.datalen; p++) {
37121 int64_t val_conv_15 = val_vals[p];
37122 LDKUpdateAddHTLC val_conv_15_conv;
37123 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
37124 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
37125 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
37126 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
37127 val_constr.data[p] = val_conv_15_conv;
37129 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37130 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
37133 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37134 LDKCommitmentUpdate this_ptr_conv;
37135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37136 this_ptr_conv.is_owned = false;
37137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37138 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
37139 int64_tArray ret_arr = NULL;
37140 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37141 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37142 for (size_t t = 0; t < ret_var.datalen; t++) {
37143 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
37144 int64_t ret_conv_19_ref = 0;
37145 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37146 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
37148 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
37149 if (ret_conv_19_var.is_owned) {
37150 ret_conv_19_ref |= 1;
37152 ret_arr_ptr[t] = ret_conv_19_ref;
37154 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37155 FREE(ret_var.data);
37159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37160 LDKCommitmentUpdate this_ptr_conv;
37161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37162 this_ptr_conv.is_owned = false;
37163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37164 LDKCVec_UpdateFulfillHTLCZ val_constr;
37165 val_constr.datalen = (*env)->GetArrayLength(env, val);
37166 if (val_constr.datalen > 0)
37167 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37169 val_constr.data = NULL;
37170 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37171 for (size_t t = 0; t < val_constr.datalen; t++) {
37172 int64_t val_conv_19 = val_vals[t];
37173 LDKUpdateFulfillHTLC val_conv_19_conv;
37174 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
37175 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
37176 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
37177 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
37178 val_constr.data[t] = val_conv_19_conv;
37180 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37181 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
37184 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37185 LDKCommitmentUpdate this_ptr_conv;
37186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37187 this_ptr_conv.is_owned = false;
37188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37189 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
37190 int64_tArray ret_arr = NULL;
37191 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37192 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37193 for (size_t q = 0; q < ret_var.datalen; q++) {
37194 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
37195 int64_t ret_conv_16_ref = 0;
37196 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37197 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37199 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
37200 if (ret_conv_16_var.is_owned) {
37201 ret_conv_16_ref |= 1;
37203 ret_arr_ptr[q] = ret_conv_16_ref;
37205 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37206 FREE(ret_var.data);
37210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37211 LDKCommitmentUpdate this_ptr_conv;
37212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37213 this_ptr_conv.is_owned = false;
37214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37215 LDKCVec_UpdateFailHTLCZ val_constr;
37216 val_constr.datalen = (*env)->GetArrayLength(env, val);
37217 if (val_constr.datalen > 0)
37218 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37220 val_constr.data = NULL;
37221 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37222 for (size_t q = 0; q < val_constr.datalen; q++) {
37223 int64_t val_conv_16 = val_vals[q];
37224 LDKUpdateFailHTLC val_conv_16_conv;
37225 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
37226 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
37227 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37228 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
37229 val_constr.data[q] = val_conv_16_conv;
37231 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37232 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
37235 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37236 LDKCommitmentUpdate this_ptr_conv;
37237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37238 this_ptr_conv.is_owned = false;
37239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37240 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
37241 int64_tArray ret_arr = NULL;
37242 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37243 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37244 for (size_t z = 0; z < ret_var.datalen; z++) {
37245 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
37246 int64_t ret_conv_25_ref = 0;
37247 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37248 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
37250 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
37251 if (ret_conv_25_var.is_owned) {
37252 ret_conv_25_ref |= 1;
37254 ret_arr_ptr[z] = ret_conv_25_ref;
37256 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37257 FREE(ret_var.data);
37261 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) {
37262 LDKCommitmentUpdate this_ptr_conv;
37263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37264 this_ptr_conv.is_owned = false;
37265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37266 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
37267 val_constr.datalen = (*env)->GetArrayLength(env, val);
37268 if (val_constr.datalen > 0)
37269 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37271 val_constr.data = NULL;
37272 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37273 for (size_t z = 0; z < val_constr.datalen; z++) {
37274 int64_t val_conv_25 = val_vals[z];
37275 LDKUpdateFailMalformedHTLC val_conv_25_conv;
37276 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
37277 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
37278 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
37279 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
37280 val_constr.data[z] = val_conv_25_conv;
37282 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37283 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
37286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
37287 LDKCommitmentUpdate this_ptr_conv;
37288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37289 this_ptr_conv.is_owned = false;
37290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37291 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
37292 int64_t ret_ref = 0;
37293 if ((uintptr_t)ret_var.inner > 4096) {
37294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37297 ret_ref = (uintptr_t)ret_var.inner;
37298 if (ret_var.is_owned) {
37305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37306 LDKCommitmentUpdate this_ptr_conv;
37307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37308 this_ptr_conv.is_owned = false;
37309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37310 LDKUpdateFee val_conv;
37311 val_conv.inner = (void*)(val & (~1));
37312 val_conv.is_owned = (val & 1) || (val == 0);
37313 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37314 val_conv = UpdateFee_clone(&val_conv);
37315 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
37318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
37319 LDKCommitmentUpdate this_ptr_conv;
37320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37321 this_ptr_conv.is_owned = false;
37322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37323 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
37324 int64_t ret_ref = 0;
37325 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37326 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37328 ret_ref = (uintptr_t)ret_var.inner;
37329 if (ret_var.is_owned) {
37335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37336 LDKCommitmentUpdate this_ptr_conv;
37337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37338 this_ptr_conv.is_owned = false;
37339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37340 LDKCommitmentSigned val_conv;
37341 val_conv.inner = (void*)(val & (~1));
37342 val_conv.is_owned = (val & 1) || (val == 0);
37343 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37344 val_conv = CommitmentSigned_clone(&val_conv);
37345 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
37348 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) {
37349 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
37350 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
37351 if (update_add_htlcs_arg_constr.datalen > 0)
37352 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37354 update_add_htlcs_arg_constr.data = NULL;
37355 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
37356 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
37357 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
37358 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
37359 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
37360 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
37361 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
37362 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
37363 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
37365 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
37366 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
37367 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
37368 if (update_fulfill_htlcs_arg_constr.datalen > 0)
37369 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37371 update_fulfill_htlcs_arg_constr.data = NULL;
37372 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
37373 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
37374 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
37375 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
37376 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
37377 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
37378 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
37379 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
37380 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
37382 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
37383 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
37384 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
37385 if (update_fail_htlcs_arg_constr.datalen > 0)
37386 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37388 update_fail_htlcs_arg_constr.data = NULL;
37389 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
37390 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
37391 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
37392 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
37393 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
37394 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
37395 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
37396 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
37397 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
37399 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
37400 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
37401 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
37402 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
37403 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37405 update_fail_malformed_htlcs_arg_constr.data = NULL;
37406 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
37407 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
37408 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
37409 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
37410 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
37411 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);
37412 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
37413 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
37414 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
37416 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
37417 LDKUpdateFee update_fee_arg_conv;
37418 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
37419 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
37420 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
37421 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
37422 LDKCommitmentSigned commitment_signed_arg_conv;
37423 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
37424 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
37425 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
37426 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
37427 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);
37428 int64_t ret_ref = 0;
37429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37432 ret_ref = (uintptr_t)ret_var.inner;
37433 if (ret_var.is_owned) {
37439 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
37440 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
37441 int64_t ret_ref = 0;
37442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37445 ret_ref = (uintptr_t)ret_var.inner;
37446 if (ret_var.is_owned) {
37451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37452 LDKCommitmentUpdate arg_conv;
37453 arg_conv.inner = (void*)(arg & (~1));
37454 arg_conv.is_owned = false;
37455 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37456 int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
37460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37461 LDKCommitmentUpdate orig_conv;
37462 orig_conv.inner = (void*)(orig & (~1));
37463 orig_conv.is_owned = false;
37464 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37465 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
37466 int64_t ret_ref = 0;
37467 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37468 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37470 ret_ref = (uintptr_t)ret_var.inner;
37471 if (ret_var.is_owned) {
37477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37478 if ((this_ptr & 1) != 0) return;
37479 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37480 CHECK_ACCESS(this_ptr_ptr);
37481 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
37482 FREE((void*)this_ptr);
37483 ChannelMessageHandler_free(this_ptr_conv);
37486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37487 if ((this_ptr & 1) != 0) return;
37488 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37489 CHECK_ACCESS(this_ptr_ptr);
37490 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
37491 FREE((void*)this_ptr);
37492 RoutingMessageHandler_free(this_ptr_conv);
37495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
37496 LDKAcceptChannel obj_conv;
37497 obj_conv.inner = (void*)(obj & (~1));
37498 obj_conv.is_owned = false;
37499 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37500 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
37501 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37502 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37503 CVec_u8Z_free(ret_var);
37507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37508 LDKu8slice ser_ref;
37509 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37510 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37511 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
37512 *ret_conv = AcceptChannel_read(ser_ref);
37513 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37514 return (int64_t)ret_conv;
37517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
37518 LDKAnnouncementSignatures obj_conv;
37519 obj_conv.inner = (void*)(obj & (~1));
37520 obj_conv.is_owned = false;
37521 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37522 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
37523 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37524 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37525 CVec_u8Z_free(ret_var);
37529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37530 LDKu8slice ser_ref;
37531 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37532 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37533 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
37534 *ret_conv = AnnouncementSignatures_read(ser_ref);
37535 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37536 return (int64_t)ret_conv;
37539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
37540 LDKChannelReestablish obj_conv;
37541 obj_conv.inner = (void*)(obj & (~1));
37542 obj_conv.is_owned = false;
37543 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37544 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
37545 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37546 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37547 CVec_u8Z_free(ret_var);
37551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37552 LDKu8slice ser_ref;
37553 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37554 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37555 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
37556 *ret_conv = ChannelReestablish_read(ser_ref);
37557 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37558 return (int64_t)ret_conv;
37561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37562 LDKClosingSigned obj_conv;
37563 obj_conv.inner = (void*)(obj & (~1));
37564 obj_conv.is_owned = false;
37565 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37566 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
37567 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37568 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37569 CVec_u8Z_free(ret_var);
37573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37574 LDKu8slice ser_ref;
37575 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37576 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37577 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
37578 *ret_conv = ClosingSigned_read(ser_ref);
37579 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37580 return (int64_t)ret_conv;
37583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
37584 LDKClosingSignedFeeRange obj_conv;
37585 obj_conv.inner = (void*)(obj & (~1));
37586 obj_conv.is_owned = false;
37587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37588 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
37589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37591 CVec_u8Z_free(ret_var);
37595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37596 LDKu8slice ser_ref;
37597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37599 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
37600 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
37601 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37602 return (int64_t)ret_conv;
37605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37606 LDKCommitmentSigned obj_conv;
37607 obj_conv.inner = (void*)(obj & (~1));
37608 obj_conv.is_owned = false;
37609 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37610 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
37611 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37612 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37613 CVec_u8Z_free(ret_var);
37617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37618 LDKu8slice ser_ref;
37619 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37620 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37621 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
37622 *ret_conv = CommitmentSigned_read(ser_ref);
37623 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37624 return (int64_t)ret_conv;
37627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
37628 LDKFundingCreated obj_conv;
37629 obj_conv.inner = (void*)(obj & (~1));
37630 obj_conv.is_owned = false;
37631 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37632 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
37633 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37634 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37635 CVec_u8Z_free(ret_var);
37639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37640 LDKu8slice ser_ref;
37641 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37642 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37643 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
37644 *ret_conv = FundingCreated_read(ser_ref);
37645 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37646 return (int64_t)ret_conv;
37649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37650 LDKFundingSigned obj_conv;
37651 obj_conv.inner = (void*)(obj & (~1));
37652 obj_conv.is_owned = false;
37653 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37654 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
37655 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37656 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37657 CVec_u8Z_free(ret_var);
37661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37662 LDKu8slice ser_ref;
37663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37665 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
37666 *ret_conv = FundingSigned_read(ser_ref);
37667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37668 return (int64_t)ret_conv;
37671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
37672 LDKChannelReady obj_conv;
37673 obj_conv.inner = (void*)(obj & (~1));
37674 obj_conv.is_owned = false;
37675 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37676 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
37677 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37678 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37679 CVec_u8Z_free(ret_var);
37683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37684 LDKu8slice ser_ref;
37685 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37686 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37687 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
37688 *ret_conv = ChannelReady_read(ser_ref);
37689 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37690 return (int64_t)ret_conv;
37693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
37695 obj_conv.inner = (void*)(obj & (~1));
37696 obj_conv.is_owned = false;
37697 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37698 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
37699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37701 CVec_u8Z_free(ret_var);
37705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37706 LDKu8slice ser_ref;
37707 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37708 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37709 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
37710 *ret_conv = Init_read(ser_ref);
37711 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37712 return (int64_t)ret_conv;
37715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
37716 LDKOpenChannel obj_conv;
37717 obj_conv.inner = (void*)(obj & (~1));
37718 obj_conv.is_owned = false;
37719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37720 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
37721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37723 CVec_u8Z_free(ret_var);
37727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37728 LDKu8slice ser_ref;
37729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37731 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
37732 *ret_conv = OpenChannel_read(ser_ref);
37733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37734 return (int64_t)ret_conv;
37737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
37738 LDKRevokeAndACK obj_conv;
37739 obj_conv.inner = (void*)(obj & (~1));
37740 obj_conv.is_owned = false;
37741 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37742 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
37743 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37744 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37745 CVec_u8Z_free(ret_var);
37749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37750 LDKu8slice ser_ref;
37751 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37752 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37753 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
37754 *ret_conv = RevokeAndACK_read(ser_ref);
37755 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37756 return (int64_t)ret_conv;
37759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
37760 LDKShutdown obj_conv;
37761 obj_conv.inner = (void*)(obj & (~1));
37762 obj_conv.is_owned = false;
37763 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37764 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
37765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37767 CVec_u8Z_free(ret_var);
37771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37772 LDKu8slice ser_ref;
37773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37775 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
37776 *ret_conv = Shutdown_read(ser_ref);
37777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37778 return (int64_t)ret_conv;
37781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37782 LDKUpdateFailHTLC obj_conv;
37783 obj_conv.inner = (void*)(obj & (~1));
37784 obj_conv.is_owned = false;
37785 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37786 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
37787 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37788 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37789 CVec_u8Z_free(ret_var);
37793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37794 LDKu8slice ser_ref;
37795 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37796 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37797 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
37798 *ret_conv = UpdateFailHTLC_read(ser_ref);
37799 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37800 return (int64_t)ret_conv;
37803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37804 LDKUpdateFailMalformedHTLC obj_conv;
37805 obj_conv.inner = (void*)(obj & (~1));
37806 obj_conv.is_owned = false;
37807 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37808 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
37809 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37810 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37811 CVec_u8Z_free(ret_var);
37815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37816 LDKu8slice ser_ref;
37817 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37818 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37819 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
37820 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
37821 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37822 return (int64_t)ret_conv;
37825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
37826 LDKUpdateFee obj_conv;
37827 obj_conv.inner = (void*)(obj & (~1));
37828 obj_conv.is_owned = false;
37829 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37830 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
37831 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37832 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37833 CVec_u8Z_free(ret_var);
37837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37838 LDKu8slice ser_ref;
37839 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37840 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37841 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
37842 *ret_conv = UpdateFee_read(ser_ref);
37843 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37844 return (int64_t)ret_conv;
37847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37848 LDKUpdateFulfillHTLC obj_conv;
37849 obj_conv.inner = (void*)(obj & (~1));
37850 obj_conv.is_owned = false;
37851 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37852 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
37853 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37854 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37855 CVec_u8Z_free(ret_var);
37859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37860 LDKu8slice ser_ref;
37861 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37862 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37863 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
37864 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
37865 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37866 return (int64_t)ret_conv;
37869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37870 LDKUpdateAddHTLC obj_conv;
37871 obj_conv.inner = (void*)(obj & (~1));
37872 obj_conv.is_owned = false;
37873 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37874 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
37875 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37876 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37877 CVec_u8Z_free(ret_var);
37881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37882 LDKu8slice ser_ref;
37883 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37884 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37885 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
37886 *ret_conv = UpdateAddHTLC_read(ser_ref);
37887 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37888 return (int64_t)ret_conv;
37891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
37893 obj_conv.inner = (void*)(obj & (~1));
37894 obj_conv.is_owned = false;
37895 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37896 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
37897 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37898 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37899 CVec_u8Z_free(ret_var);
37903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37904 LDKu8slice ser_ref;
37905 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37906 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37907 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
37908 *ret_conv = Ping_read(ser_ref);
37909 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37910 return (int64_t)ret_conv;
37913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
37915 obj_conv.inner = (void*)(obj & (~1));
37916 obj_conv.is_owned = false;
37917 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37918 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
37919 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37920 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37921 CVec_u8Z_free(ret_var);
37925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37926 LDKu8slice ser_ref;
37927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37929 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
37930 *ret_conv = Pong_read(ser_ref);
37931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37932 return (int64_t)ret_conv;
37935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37936 LDKUnsignedChannelAnnouncement obj_conv;
37937 obj_conv.inner = (void*)(obj & (~1));
37938 obj_conv.is_owned = false;
37939 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37940 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
37941 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37942 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37943 CVec_u8Z_free(ret_var);
37947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37948 LDKu8slice ser_ref;
37949 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37950 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37951 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
37952 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
37953 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37954 return (int64_t)ret_conv;
37957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37958 LDKChannelAnnouncement obj_conv;
37959 obj_conv.inner = (void*)(obj & (~1));
37960 obj_conv.is_owned = false;
37961 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37962 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
37963 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37964 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37965 CVec_u8Z_free(ret_var);
37969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37970 LDKu8slice ser_ref;
37971 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37972 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37973 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
37974 *ret_conv = ChannelAnnouncement_read(ser_ref);
37975 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37976 return (int64_t)ret_conv;
37979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37980 LDKUnsignedChannelUpdate obj_conv;
37981 obj_conv.inner = (void*)(obj & (~1));
37982 obj_conv.is_owned = false;
37983 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37984 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
37985 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37986 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37987 CVec_u8Z_free(ret_var);
37991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37992 LDKu8slice ser_ref;
37993 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37994 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37995 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
37996 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
37997 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37998 return (int64_t)ret_conv;
38001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38002 LDKChannelUpdate obj_conv;
38003 obj_conv.inner = (void*)(obj & (~1));
38004 obj_conv.is_owned = false;
38005 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38006 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
38007 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38008 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38009 CVec_u8Z_free(ret_var);
38013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38014 LDKu8slice ser_ref;
38015 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38016 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38017 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
38018 *ret_conv = ChannelUpdate_read(ser_ref);
38019 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38020 return (int64_t)ret_conv;
38023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38024 LDKErrorMessage obj_conv;
38025 obj_conv.inner = (void*)(obj & (~1));
38026 obj_conv.is_owned = false;
38027 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38028 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
38029 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38030 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38031 CVec_u8Z_free(ret_var);
38035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38036 LDKu8slice ser_ref;
38037 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38038 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38039 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
38040 *ret_conv = ErrorMessage_read(ser_ref);
38041 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38042 return (int64_t)ret_conv;
38045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38046 LDKWarningMessage obj_conv;
38047 obj_conv.inner = (void*)(obj & (~1));
38048 obj_conv.is_owned = false;
38049 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38050 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
38051 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38052 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38053 CVec_u8Z_free(ret_var);
38057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38058 LDKu8slice ser_ref;
38059 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38060 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38061 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
38062 *ret_conv = WarningMessage_read(ser_ref);
38063 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38064 return (int64_t)ret_conv;
38067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38068 LDKUnsignedNodeAnnouncement obj_conv;
38069 obj_conv.inner = (void*)(obj & (~1));
38070 obj_conv.is_owned = false;
38071 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38072 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
38073 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38074 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38075 CVec_u8Z_free(ret_var);
38079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38080 LDKu8slice ser_ref;
38081 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38082 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38083 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
38084 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
38085 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38086 return (int64_t)ret_conv;
38089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38090 LDKNodeAnnouncement obj_conv;
38091 obj_conv.inner = (void*)(obj & (~1));
38092 obj_conv.is_owned = false;
38093 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38094 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
38095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38097 CVec_u8Z_free(ret_var);
38101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38102 LDKu8slice ser_ref;
38103 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38104 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38105 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
38106 *ret_conv = NodeAnnouncement_read(ser_ref);
38107 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38108 return (int64_t)ret_conv;
38111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38112 LDKu8slice ser_ref;
38113 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38114 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38115 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
38116 *ret_conv = QueryShortChannelIds_read(ser_ref);
38117 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38118 return (int64_t)ret_conv;
38121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
38122 LDKQueryShortChannelIds obj_conv;
38123 obj_conv.inner = (void*)(obj & (~1));
38124 obj_conv.is_owned = false;
38125 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38126 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
38127 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38128 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38129 CVec_u8Z_free(ret_var);
38133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
38134 LDKReplyShortChannelIdsEnd obj_conv;
38135 obj_conv.inner = (void*)(obj & (~1));
38136 obj_conv.is_owned = false;
38137 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38138 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
38139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38141 CVec_u8Z_free(ret_var);
38145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38146 LDKu8slice ser_ref;
38147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38149 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
38150 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
38151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38152 return (int64_t)ret_conv;
38155 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
38156 LDKQueryChannelRange this_arg_conv;
38157 this_arg_conv.inner = (void*)(this_arg & (~1));
38158 this_arg_conv.is_owned = false;
38159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38160 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
38164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38165 LDKQueryChannelRange obj_conv;
38166 obj_conv.inner = (void*)(obj & (~1));
38167 obj_conv.is_owned = false;
38168 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38169 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
38170 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38171 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38172 CVec_u8Z_free(ret_var);
38176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38177 LDKu8slice ser_ref;
38178 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38179 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38180 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
38181 *ret_conv = QueryChannelRange_read(ser_ref);
38182 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38183 return (int64_t)ret_conv;
38186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38187 LDKu8slice ser_ref;
38188 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38189 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38190 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
38191 *ret_conv = ReplyChannelRange_read(ser_ref);
38192 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38193 return (int64_t)ret_conv;
38196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38197 LDKReplyChannelRange obj_conv;
38198 obj_conv.inner = (void*)(obj & (~1));
38199 obj_conv.is_owned = false;
38200 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38201 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
38202 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38203 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38204 CVec_u8Z_free(ret_var);
38208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
38209 LDKGossipTimestampFilter obj_conv;
38210 obj_conv.inner = (void*)(obj & (~1));
38211 obj_conv.is_owned = false;
38212 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38213 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
38214 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38215 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38216 CVec_u8Z_free(ret_var);
38220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38221 LDKu8slice ser_ref;
38222 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38223 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38224 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
38225 *ret_conv = GossipTimestampFilter_read(ser_ref);
38226 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38227 return (int64_t)ret_conv;
38230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38231 if ((this_ptr & 1) != 0) return;
38232 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38233 CHECK_ACCESS(this_ptr_ptr);
38234 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
38235 FREE((void*)this_ptr);
38236 CustomMessageHandler_free(this_ptr_conv);
38239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38240 LDKIgnoringMessageHandler this_obj_conv;
38241 this_obj_conv.inner = (void*)(this_obj & (~1));
38242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38244 IgnoringMessageHandler_free(this_obj_conv);
38247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
38248 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
38249 int64_t ret_ref = 0;
38250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38253 ret_ref = (uintptr_t)ret_var.inner;
38254 if (ret_var.is_owned) {
38260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38261 LDKIgnoringMessageHandler this_arg_conv;
38262 this_arg_conv.inner = (void*)(this_arg & (~1));
38263 this_arg_conv.is_owned = false;
38264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38265 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38266 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38267 return (int64_t)ret_ret;
38270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38271 LDKIgnoringMessageHandler this_arg_conv;
38272 this_arg_conv.inner = (void*)(this_arg & (~1));
38273 this_arg_conv.is_owned = false;
38274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38275 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38276 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
38277 return (int64_t)ret_ret;
38280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
38281 LDKIgnoringMessageHandler this_arg_conv;
38282 this_arg_conv.inner = (void*)(this_arg & (~1));
38283 this_arg_conv.is_owned = false;
38284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38285 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
38286 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
38287 return (int64_t)ret_ret;
38290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38291 LDKIgnoringMessageHandler this_arg_conv;
38292 this_arg_conv.inner = (void*)(this_arg & (~1));
38293 this_arg_conv.is_owned = false;
38294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38295 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
38296 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
38297 return (int64_t)ret_ret;
38300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38301 LDKErroringMessageHandler this_obj_conv;
38302 this_obj_conv.inner = (void*)(this_obj & (~1));
38303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38305 ErroringMessageHandler_free(this_obj_conv);
38308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
38309 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
38310 int64_t ret_ref = 0;
38311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38314 ret_ref = (uintptr_t)ret_var.inner;
38315 if (ret_var.is_owned) {
38321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38322 LDKErroringMessageHandler this_arg_conv;
38323 this_arg_conv.inner = (void*)(this_arg & (~1));
38324 this_arg_conv.is_owned = false;
38325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38326 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38327 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38328 return (int64_t)ret_ret;
38331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38332 LDKErroringMessageHandler this_arg_conv;
38333 this_arg_conv.inner = (void*)(this_arg & (~1));
38334 this_arg_conv.is_owned = false;
38335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38336 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
38337 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
38338 return (int64_t)ret_ret;
38341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38342 LDKMessageHandler this_obj_conv;
38343 this_obj_conv.inner = (void*)(this_obj & (~1));
38344 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38346 MessageHandler_free(this_obj_conv);
38349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38350 LDKMessageHandler this_ptr_conv;
38351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38352 this_ptr_conv.is_owned = false;
38353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38354 // WARNING: This object doesn't live past this scope, needs clone!
38355 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
38359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38360 LDKMessageHandler this_ptr_conv;
38361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38362 this_ptr_conv.is_owned = false;
38363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38364 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38365 CHECK_ACCESS(val_ptr);
38366 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
38367 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
38368 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38369 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
38371 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
38374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38375 LDKMessageHandler this_ptr_conv;
38376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38377 this_ptr_conv.is_owned = false;
38378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38379 // WARNING: This object doesn't live past this scope, needs clone!
38380 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
38384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38385 LDKMessageHandler this_ptr_conv;
38386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38387 this_ptr_conv.is_owned = false;
38388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38389 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38390 CHECK_ACCESS(val_ptr);
38391 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
38392 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38393 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38394 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
38396 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
38399 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) {
38400 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
38401 CHECK_ACCESS(chan_handler_arg_ptr);
38402 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
38403 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
38404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38405 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
38407 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
38408 CHECK_ACCESS(route_handler_arg_ptr);
38409 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
38410 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38411 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38412 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
38414 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
38415 int64_t ret_ref = 0;
38416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38419 ret_ref = (uintptr_t)ret_var.inner;
38420 if (ret_var.is_owned) {
38426 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
38427 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38428 *ret_ret = SocketDescriptor_clone(arg);
38429 return (int64_t)ret_ret;
38431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38432 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
38433 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
38434 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
38435 int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
38439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38440 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
38441 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
38442 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
38443 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38444 *ret_ret = SocketDescriptor_clone(orig_conv);
38445 return (int64_t)ret_ret;
38448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38449 if ((this_ptr & 1) != 0) return;
38450 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38451 CHECK_ACCESS(this_ptr_ptr);
38452 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
38453 FREE((void*)this_ptr);
38454 SocketDescriptor_free(this_ptr_conv);
38457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38458 LDKPeerHandleError this_obj_conv;
38459 this_obj_conv.inner = (void*)(this_obj & (~1));
38460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38462 PeerHandleError_free(this_obj_conv);
38465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
38466 LDKPeerHandleError this_ptr_conv;
38467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38468 this_ptr_conv.is_owned = false;
38469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38470 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
38474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38475 LDKPeerHandleError this_ptr_conv;
38476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38477 this_ptr_conv.is_owned = false;
38478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38479 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
38482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
38483 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
38484 int64_t ret_ref = 0;
38485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38488 ret_ref = (uintptr_t)ret_var.inner;
38489 if (ret_var.is_owned) {
38495 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
38496 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
38497 int64_t ret_ref = 0;
38498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38501 ret_ref = (uintptr_t)ret_var.inner;
38502 if (ret_var.is_owned) {
38507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38508 LDKPeerHandleError arg_conv;
38509 arg_conv.inner = (void*)(arg & (~1));
38510 arg_conv.is_owned = false;
38511 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38512 int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
38516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38517 LDKPeerHandleError orig_conv;
38518 orig_conv.inner = (void*)(orig & (~1));
38519 orig_conv.is_owned = false;
38520 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38521 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
38522 int64_t ret_ref = 0;
38523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38526 ret_ref = (uintptr_t)ret_var.inner;
38527 if (ret_var.is_owned) {
38533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38534 LDKPeerManager this_obj_conv;
38535 this_obj_conv.inner = (void*)(this_obj & (~1));
38536 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38538 PeerManager_free(this_obj_conv);
38541 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) {
38542 LDKMessageHandler message_handler_conv;
38543 message_handler_conv.inner = (void*)(message_handler & (~1));
38544 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
38545 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
38546 // WARNING: we need a move here but no clone is available for LDKMessageHandler
38547 LDKSecretKey our_node_secret_ref;
38548 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
38549 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
38550 unsigned char ephemeral_random_data_arr[32];
38551 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
38552 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
38553 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
38554 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38555 CHECK_ACCESS(logger_ptr);
38556 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38557 if (logger_conv.free == LDKLogger_JCalls_free) {
38558 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38559 LDKLogger_JCalls_cloned(&logger_conv);
38561 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
38562 CHECK_ACCESS(custom_message_handler_ptr);
38563 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
38564 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
38565 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38566 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
38568 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
38569 int64_t ret_ref = 0;
38570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38573 ret_ref = (uintptr_t)ret_var.inner;
38574 if (ret_var.is_owned) {
38580 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
38581 LDKPeerManager this_arg_conv;
38582 this_arg_conv.inner = (void*)(this_arg & (~1));
38583 this_arg_conv.is_owned = false;
38584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38585 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
38586 jobjectArray ret_arr = NULL;
38587 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38589 for (size_t i = 0; i < ret_var.datalen; i++) {
38590 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
38591 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
38592 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38595 FREE(ret_var.data);
38599 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) {
38600 LDKPeerManager this_arg_conv;
38601 this_arg_conv.inner = (void*)(this_arg & (~1));
38602 this_arg_conv.is_owned = false;
38603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38604 LDKPublicKey their_node_id_ref;
38605 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
38606 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
38607 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38608 CHECK_ACCESS(descriptor_ptr);
38609 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
38610 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
38611 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38612 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
38614 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
38615 CHECK_ACCESS(remote_network_address_ptr);
38616 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
38617 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
38618 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
38619 return (int64_t)ret_conv;
38622 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) {
38623 LDKPeerManager this_arg_conv;
38624 this_arg_conv.inner = (void*)(this_arg & (~1));
38625 this_arg_conv.is_owned = false;
38626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38627 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38628 CHECK_ACCESS(descriptor_ptr);
38629 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
38630 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
38631 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38632 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
38634 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
38635 CHECK_ACCESS(remote_network_address_ptr);
38636 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
38637 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
38638 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
38639 return (int64_t)ret_conv;
38642 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) {
38643 LDKPeerManager this_arg_conv;
38644 this_arg_conv.inner = (void*)(this_arg & (~1));
38645 this_arg_conv.is_owned = false;
38646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38647 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38648 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
38649 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
38650 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
38651 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
38652 return (int64_t)ret_conv;
38655 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) {
38656 LDKPeerManager this_arg_conv;
38657 this_arg_conv.inner = (void*)(this_arg & (~1));
38658 this_arg_conv.is_owned = false;
38659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38660 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
38661 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
38662 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
38663 LDKu8slice data_ref;
38664 data_ref.datalen = (*env)->GetArrayLength(env, data);
38665 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
38666 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
38667 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
38668 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
38669 return (int64_t)ret_conv;
38672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
38673 LDKPeerManager this_arg_conv;
38674 this_arg_conv.inner = (void*)(this_arg & (~1));
38675 this_arg_conv.is_owned = false;
38676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38677 PeerManager_process_events(&this_arg_conv);
38680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
38681 LDKPeerManager this_arg_conv;
38682 this_arg_conv.inner = (void*)(this_arg & (~1));
38683 this_arg_conv.is_owned = false;
38684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38685 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38686 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
38687 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
38688 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
38691 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) {
38692 LDKPeerManager this_arg_conv;
38693 this_arg_conv.inner = (void*)(this_arg & (~1));
38694 this_arg_conv.is_owned = false;
38695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38696 LDKPublicKey node_id_ref;
38697 CHECK((*env)->GetArrayLength(env, node_id) == 33);
38698 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
38699 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
38702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
38703 LDKPeerManager this_arg_conv;
38704 this_arg_conv.inner = (void*)(this_arg & (~1));
38705 this_arg_conv.is_owned = false;
38706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38707 PeerManager_disconnect_all_peers(&this_arg_conv);
38710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
38711 LDKPeerManager this_arg_conv;
38712 this_arg_conv.inner = (void*)(this_arg & (~1));
38713 this_arg_conv.is_owned = false;
38714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38715 PeerManager_timer_tick_occurred(&this_arg_conv);
38718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
38719 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
38723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
38724 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
38728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
38729 unsigned char commitment_seed_arr[32];
38730 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
38731 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
38732 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
38733 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
38738 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) {
38739 LDKCVec_u8Z to_holder_script_ref;
38740 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
38741 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38742 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
38743 LDKCVec_u8Z to_counterparty_script_ref;
38744 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
38745 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38746 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
38747 LDKOutPoint funding_outpoint_conv;
38748 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38749 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38750 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38751 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38752 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);
38753 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38754 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38755 Transaction_free(ret_var);
38759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38760 LDKCounterpartyCommitmentSecrets this_obj_conv;
38761 this_obj_conv.inner = (void*)(this_obj & (~1));
38762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38764 CounterpartyCommitmentSecrets_free(this_obj_conv);
38767 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
38768 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
38769 int64_t ret_ref = 0;
38770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38773 ret_ref = (uintptr_t)ret_var.inner;
38774 if (ret_var.is_owned) {
38779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38780 LDKCounterpartyCommitmentSecrets arg_conv;
38781 arg_conv.inner = (void*)(arg & (~1));
38782 arg_conv.is_owned = false;
38783 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38784 int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
38788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38789 LDKCounterpartyCommitmentSecrets orig_conv;
38790 orig_conv.inner = (void*)(orig & (~1));
38791 orig_conv.is_owned = false;
38792 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38793 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
38794 int64_t ret_ref = 0;
38795 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38796 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38798 ret_ref = (uintptr_t)ret_var.inner;
38799 if (ret_var.is_owned) {
38805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
38806 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
38807 int64_t ret_ref = 0;
38808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38811 ret_ref = (uintptr_t)ret_var.inner;
38812 if (ret_var.is_owned) {
38818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
38819 LDKCounterpartyCommitmentSecrets this_arg_conv;
38820 this_arg_conv.inner = (void*)(this_arg & (~1));
38821 this_arg_conv.is_owned = false;
38822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38823 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
38827 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) {
38828 LDKCounterpartyCommitmentSecrets this_arg_conv;
38829 this_arg_conv.inner = (void*)(this_arg & (~1));
38830 this_arg_conv.is_owned = false;
38831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38832 LDKThirtyTwoBytes secret_ref;
38833 CHECK((*env)->GetArrayLength(env, secret) == 32);
38834 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
38835 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
38836 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
38837 return (int64_t)ret_conv;
38840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
38841 LDKCounterpartyCommitmentSecrets 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38846 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
38850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
38851 LDKCounterpartyCommitmentSecrets obj_conv;
38852 obj_conv.inner = (void*)(obj & (~1));
38853 obj_conv.is_owned = false;
38854 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38855 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
38856 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38857 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38858 CVec_u8Z_free(ret_var);
38862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38863 LDKu8slice ser_ref;
38864 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38865 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38866 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
38867 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
38868 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38869 return (int64_t)ret_conv;
38872 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) {
38873 LDKPublicKey per_commitment_point_ref;
38874 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38875 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38876 unsigned char base_secret_arr[32];
38877 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
38878 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
38879 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
38880 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38881 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
38882 return (int64_t)ret_conv;
38885 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) {
38886 LDKPublicKey per_commitment_point_ref;
38887 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38888 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38889 LDKPublicKey base_point_ref;
38890 CHECK((*env)->GetArrayLength(env, base_point) == 33);
38891 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
38892 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38893 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
38894 return (int64_t)ret_conv;
38897 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) {
38898 unsigned char per_commitment_secret_arr[32];
38899 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
38900 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
38901 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
38902 unsigned char countersignatory_revocation_base_secret_arr[32];
38903 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
38904 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
38905 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
38906 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38907 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
38908 return (int64_t)ret_conv;
38911 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) {
38912 LDKPublicKey per_commitment_point_ref;
38913 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38914 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38915 LDKPublicKey countersignatory_revocation_base_point_ref;
38916 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
38917 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
38918 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38919 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
38920 return (int64_t)ret_conv;
38923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38924 LDKTxCreationKeys this_obj_conv;
38925 this_obj_conv.inner = (void*)(this_obj & (~1));
38926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38928 TxCreationKeys_free(this_obj_conv);
38931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
38932 LDKTxCreationKeys this_ptr_conv;
38933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38934 this_ptr_conv.is_owned = false;
38935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38936 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38937 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
38941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38942 LDKTxCreationKeys this_ptr_conv;
38943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38944 this_ptr_conv.is_owned = false;
38945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38946 LDKPublicKey val_ref;
38947 CHECK((*env)->GetArrayLength(env, val) == 33);
38948 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38949 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
38952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38953 LDKTxCreationKeys this_ptr_conv;
38954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38955 this_ptr_conv.is_owned = false;
38956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38957 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38958 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
38962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38963 LDKTxCreationKeys this_ptr_conv;
38964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38965 this_ptr_conv.is_owned = false;
38966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38967 LDKPublicKey val_ref;
38968 CHECK((*env)->GetArrayLength(env, val) == 33);
38969 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38970 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38974 LDKTxCreationKeys this_ptr_conv;
38975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38976 this_ptr_conv.is_owned = false;
38977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38978 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38979 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
38983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38984 LDKTxCreationKeys this_ptr_conv;
38985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38986 this_ptr_conv.is_owned = false;
38987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38988 LDKPublicKey val_ref;
38989 CHECK((*env)->GetArrayLength(env, val) == 33);
38990 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38991 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38995 LDKTxCreationKeys this_ptr_conv;
38996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38997 this_ptr_conv.is_owned = false;
38998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38999 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
39004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39005 LDKTxCreationKeys this_ptr_conv;
39006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39007 this_ptr_conv.is_owned = false;
39008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39009 LDKPublicKey val_ref;
39010 CHECK((*env)->GetArrayLength(env, val) == 33);
39011 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39012 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
39015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39016 LDKTxCreationKeys this_ptr_conv;
39017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39018 this_ptr_conv.is_owned = false;
39019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39020 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
39025 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) {
39026 LDKTxCreationKeys this_ptr_conv;
39027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39028 this_ptr_conv.is_owned = false;
39029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39030 LDKPublicKey val_ref;
39031 CHECK((*env)->GetArrayLength(env, val) == 33);
39032 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39033 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
39036 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) {
39037 LDKPublicKey per_commitment_point_arg_ref;
39038 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
39039 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
39040 LDKPublicKey revocation_key_arg_ref;
39041 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
39042 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
39043 LDKPublicKey broadcaster_htlc_key_arg_ref;
39044 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
39045 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
39046 LDKPublicKey countersignatory_htlc_key_arg_ref;
39047 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
39048 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
39049 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
39050 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
39051 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
39052 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);
39053 int64_t ret_ref = 0;
39054 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39055 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39057 ret_ref = (uintptr_t)ret_var.inner;
39058 if (ret_var.is_owned) {
39064 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
39065 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
39066 int64_t ret_ref = 0;
39067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39070 ret_ref = (uintptr_t)ret_var.inner;
39071 if (ret_var.is_owned) {
39076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39077 LDKTxCreationKeys arg_conv;
39078 arg_conv.inner = (void*)(arg & (~1));
39079 arg_conv.is_owned = false;
39080 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39081 int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
39085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39086 LDKTxCreationKeys orig_conv;
39087 orig_conv.inner = (void*)(orig & (~1));
39088 orig_conv.is_owned = false;
39089 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39090 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
39091 int64_t ret_ref = 0;
39092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39095 ret_ref = (uintptr_t)ret_var.inner;
39096 if (ret_var.is_owned) {
39102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39103 LDKTxCreationKeys obj_conv;
39104 obj_conv.inner = (void*)(obj & (~1));
39105 obj_conv.is_owned = false;
39106 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39107 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
39108 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39109 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39110 CVec_u8Z_free(ret_var);
39114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39115 LDKu8slice ser_ref;
39116 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39117 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39118 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
39119 *ret_conv = TxCreationKeys_read(ser_ref);
39120 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39121 return (int64_t)ret_conv;
39124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39125 LDKChannelPublicKeys this_obj_conv;
39126 this_obj_conv.inner = (void*)(this_obj & (~1));
39127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39129 ChannelPublicKeys_free(this_obj_conv);
39132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39133 LDKChannelPublicKeys this_ptr_conv;
39134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39135 this_ptr_conv.is_owned = false;
39136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39137 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39138 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
39142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39143 LDKChannelPublicKeys this_ptr_conv;
39144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39145 this_ptr_conv.is_owned = false;
39146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39147 LDKPublicKey val_ref;
39148 CHECK((*env)->GetArrayLength(env, val) == 33);
39149 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39150 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
39153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39154 LDKChannelPublicKeys this_ptr_conv;
39155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39156 this_ptr_conv.is_owned = false;
39157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39158 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39159 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
39163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39164 LDKChannelPublicKeys this_ptr_conv;
39165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39166 this_ptr_conv.is_owned = false;
39167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39168 LDKPublicKey val_ref;
39169 CHECK((*env)->GetArrayLength(env, val) == 33);
39170 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39171 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
39174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
39175 LDKChannelPublicKeys this_ptr_conv;
39176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39177 this_ptr_conv.is_owned = false;
39178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39179 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
39184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39185 LDKChannelPublicKeys this_ptr_conv;
39186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39187 this_ptr_conv.is_owned = false;
39188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39189 LDKPublicKey val_ref;
39190 CHECK((*env)->GetArrayLength(env, val) == 33);
39191 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39192 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
39195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39196 LDKChannelPublicKeys this_ptr_conv;
39197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39198 this_ptr_conv.is_owned = false;
39199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39200 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
39205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39206 LDKChannelPublicKeys this_ptr_conv;
39207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39208 this_ptr_conv.is_owned = false;
39209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39210 LDKPublicKey val_ref;
39211 CHECK((*env)->GetArrayLength(env, val) == 33);
39212 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39213 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
39216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39217 LDKChannelPublicKeys this_ptr_conv;
39218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39219 this_ptr_conv.is_owned = false;
39220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39221 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39222 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
39226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39227 LDKChannelPublicKeys this_ptr_conv;
39228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39229 this_ptr_conv.is_owned = false;
39230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39231 LDKPublicKey val_ref;
39232 CHECK((*env)->GetArrayLength(env, val) == 33);
39233 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39234 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
39237 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) {
39238 LDKPublicKey funding_pubkey_arg_ref;
39239 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
39240 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
39241 LDKPublicKey revocation_basepoint_arg_ref;
39242 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
39243 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
39244 LDKPublicKey payment_point_arg_ref;
39245 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
39246 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
39247 LDKPublicKey delayed_payment_basepoint_arg_ref;
39248 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
39249 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
39250 LDKPublicKey htlc_basepoint_arg_ref;
39251 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
39252 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
39253 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);
39254 int64_t ret_ref = 0;
39255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39258 ret_ref = (uintptr_t)ret_var.inner;
39259 if (ret_var.is_owned) {
39265 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
39266 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
39267 int64_t ret_ref = 0;
39268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39271 ret_ref = (uintptr_t)ret_var.inner;
39272 if (ret_var.is_owned) {
39277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39278 LDKChannelPublicKeys arg_conv;
39279 arg_conv.inner = (void*)(arg & (~1));
39280 arg_conv.is_owned = false;
39281 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39282 int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
39286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39287 LDKChannelPublicKeys orig_conv;
39288 orig_conv.inner = (void*)(orig & (~1));
39289 orig_conv.is_owned = false;
39290 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39291 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
39292 int64_t ret_ref = 0;
39293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39296 ret_ref = (uintptr_t)ret_var.inner;
39297 if (ret_var.is_owned) {
39303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39304 LDKChannelPublicKeys obj_conv;
39305 obj_conv.inner = (void*)(obj & (~1));
39306 obj_conv.is_owned = false;
39307 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39308 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
39309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39311 CVec_u8Z_free(ret_var);
39315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39316 LDKu8slice ser_ref;
39317 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39318 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39319 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
39320 *ret_conv = ChannelPublicKeys_read(ser_ref);
39321 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39322 return (int64_t)ret_conv;
39325 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) {
39326 LDKPublicKey per_commitment_point_ref;
39327 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39328 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39329 LDKPublicKey broadcaster_delayed_payment_base_ref;
39330 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
39331 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
39332 LDKPublicKey broadcaster_htlc_base_ref;
39333 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
39334 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
39335 LDKPublicKey countersignatory_revocation_base_ref;
39336 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
39337 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
39338 LDKPublicKey countersignatory_htlc_base_ref;
39339 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
39340 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
39341 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39342 *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);
39343 return (int64_t)ret_conv;
39346 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) {
39347 LDKPublicKey per_commitment_point_ref;
39348 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39349 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39350 LDKChannelPublicKeys broadcaster_keys_conv;
39351 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
39352 broadcaster_keys_conv.is_owned = false;
39353 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39354 LDKChannelPublicKeys countersignatory_keys_conv;
39355 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
39356 countersignatory_keys_conv.is_owned = false;
39357 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39358 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39359 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
39360 return (int64_t)ret_conv;
39363 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) {
39364 LDKPublicKey revocation_key_ref;
39365 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
39366 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
39367 LDKPublicKey broadcaster_delayed_payment_key_ref;
39368 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
39369 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
39370 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
39371 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39372 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39373 CVec_u8Z_free(ret_var);
39377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39378 LDKHTLCOutputInCommitment this_obj_conv;
39379 this_obj_conv.inner = (void*)(this_obj & (~1));
39380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39382 HTLCOutputInCommitment_free(this_obj_conv);
39385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
39386 LDKHTLCOutputInCommitment this_ptr_conv;
39387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39388 this_ptr_conv.is_owned = false;
39389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39390 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
39394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39395 LDKHTLCOutputInCommitment this_ptr_conv;
39396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39397 this_ptr_conv.is_owned = false;
39398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39399 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
39402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39403 LDKHTLCOutputInCommitment this_ptr_conv;
39404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39405 this_ptr_conv.is_owned = false;
39406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39407 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
39411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39412 LDKHTLCOutputInCommitment this_ptr_conv;
39413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39414 this_ptr_conv.is_owned = false;
39415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39416 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
39419 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
39420 LDKHTLCOutputInCommitment this_ptr_conv;
39421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39422 this_ptr_conv.is_owned = false;
39423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39424 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
39428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39429 LDKHTLCOutputInCommitment this_ptr_conv;
39430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39431 this_ptr_conv.is_owned = false;
39432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39433 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
39436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39437 LDKHTLCOutputInCommitment this_ptr_conv;
39438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39439 this_ptr_conv.is_owned = false;
39440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39441 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39442 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
39446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39447 LDKHTLCOutputInCommitment this_ptr_conv;
39448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39449 this_ptr_conv.is_owned = false;
39450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39451 LDKThirtyTwoBytes val_ref;
39452 CHECK((*env)->GetArrayLength(env, val) == 32);
39453 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39454 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
39457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
39458 LDKHTLCOutputInCommitment this_ptr_conv;
39459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39460 this_ptr_conv.is_owned = false;
39461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39462 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39463 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
39464 int64_t ret_ref = (uintptr_t)ret_copy;
39468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39469 LDKHTLCOutputInCommitment this_ptr_conv;
39470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39471 this_ptr_conv.is_owned = false;
39472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39473 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39474 CHECK_ACCESS(val_ptr);
39475 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39476 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
39477 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
39480 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) {
39481 LDKThirtyTwoBytes payment_hash_arg_ref;
39482 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
39483 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
39484 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
39485 CHECK_ACCESS(transaction_output_index_arg_ptr);
39486 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
39487 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
39488 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
39489 int64_t ret_ref = 0;
39490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39493 ret_ref = (uintptr_t)ret_var.inner;
39494 if (ret_var.is_owned) {
39500 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
39501 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
39502 int64_t ret_ref = 0;
39503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39506 ret_ref = (uintptr_t)ret_var.inner;
39507 if (ret_var.is_owned) {
39512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39513 LDKHTLCOutputInCommitment arg_conv;
39514 arg_conv.inner = (void*)(arg & (~1));
39515 arg_conv.is_owned = false;
39516 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39517 int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
39521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39522 LDKHTLCOutputInCommitment orig_conv;
39523 orig_conv.inner = (void*)(orig & (~1));
39524 orig_conv.is_owned = false;
39525 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39526 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
39527 int64_t ret_ref = 0;
39528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39531 ret_ref = (uintptr_t)ret_var.inner;
39532 if (ret_var.is_owned) {
39538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
39539 LDKHTLCOutputInCommitment obj_conv;
39540 obj_conv.inner = (void*)(obj & (~1));
39541 obj_conv.is_owned = false;
39542 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39543 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
39544 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39545 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39546 CVec_u8Z_free(ret_var);
39550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39551 LDKu8slice ser_ref;
39552 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39553 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39554 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
39555 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
39556 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39557 return (int64_t)ret_conv;
39560 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) {
39561 LDKHTLCOutputInCommitment htlc_conv;
39562 htlc_conv.inner = (void*)(htlc & (~1));
39563 htlc_conv.is_owned = false;
39564 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
39565 LDKTxCreationKeys keys_conv;
39566 keys_conv.inner = (void*)(keys & (~1));
39567 keys_conv.is_owned = false;
39568 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39569 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
39570 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39571 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39572 CVec_u8Z_free(ret_var);
39576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
39577 LDKPublicKey broadcaster_ref;
39578 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
39579 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
39580 LDKPublicKey countersignatory_ref;
39581 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
39582 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
39583 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
39584 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39585 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39586 CVec_u8Z_free(ret_var);
39590 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) {
39591 unsigned char commitment_txid_arr[32];
39592 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
39593 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
39594 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
39595 LDKHTLCOutputInCommitment htlc_conv;
39596 htlc_conv.inner = (void*)(htlc & (~1));
39597 htlc_conv.is_owned = false;
39598 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
39599 LDKPublicKey broadcaster_delayed_payment_key_ref;
39600 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
39601 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
39602 LDKPublicKey revocation_key_ref;
39603 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
39604 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
39605 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);
39606 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39607 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39608 Transaction_free(ret_var);
39612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
39613 LDKPublicKey funding_pubkey_ref;
39614 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
39615 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
39616 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
39617 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39618 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39619 CVec_u8Z_free(ret_var);
39623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39624 LDKChannelTransactionParameters this_obj_conv;
39625 this_obj_conv.inner = (void*)(this_obj & (~1));
39626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39628 ChannelTransactionParameters_free(this_obj_conv);
39631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
39632 LDKChannelTransactionParameters this_ptr_conv;
39633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39634 this_ptr_conv.is_owned = false;
39635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39636 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
39637 int64_t ret_ref = 0;
39638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39641 ret_ref = (uintptr_t)ret_var.inner;
39642 if (ret_var.is_owned) {
39648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39649 LDKChannelTransactionParameters this_ptr_conv;
39650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39651 this_ptr_conv.is_owned = false;
39652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39653 LDKChannelPublicKeys val_conv;
39654 val_conv.inner = (void*)(val & (~1));
39655 val_conv.is_owned = (val & 1) || (val == 0);
39656 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39657 val_conv = ChannelPublicKeys_clone(&val_conv);
39658 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
39661 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39662 LDKChannelTransactionParameters this_ptr_conv;
39663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39664 this_ptr_conv.is_owned = false;
39665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39666 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
39670 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) {
39671 LDKChannelTransactionParameters this_ptr_conv;
39672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39673 this_ptr_conv.is_owned = false;
39674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39675 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
39678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
39679 LDKChannelTransactionParameters this_ptr_conv;
39680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39681 this_ptr_conv.is_owned = false;
39682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39683 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
39687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39688 LDKChannelTransactionParameters this_ptr_conv;
39689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39690 this_ptr_conv.is_owned = false;
39691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39692 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
39695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
39696 LDKChannelTransactionParameters this_ptr_conv;
39697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39698 this_ptr_conv.is_owned = false;
39699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39700 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
39701 int64_t ret_ref = 0;
39702 if ((uintptr_t)ret_var.inner > 4096) {
39703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39706 ret_ref = (uintptr_t)ret_var.inner;
39707 if (ret_var.is_owned) {
39714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39715 LDKChannelTransactionParameters this_ptr_conv;
39716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39717 this_ptr_conv.is_owned = false;
39718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39719 LDKCounterpartyChannelTransactionParameters val_conv;
39720 val_conv.inner = (void*)(val & (~1));
39721 val_conv.is_owned = (val & 1) || (val == 0);
39722 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39723 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
39724 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
39727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39728 LDKChannelTransactionParameters this_ptr_conv;
39729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39730 this_ptr_conv.is_owned = false;
39731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39732 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
39733 int64_t ret_ref = 0;
39734 if ((uintptr_t)ret_var.inner > 4096) {
39735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39738 ret_ref = (uintptr_t)ret_var.inner;
39739 if (ret_var.is_owned) {
39746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39747 LDKChannelTransactionParameters this_ptr_conv;
39748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39749 this_ptr_conv.is_owned = false;
39750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39751 LDKOutPoint val_conv;
39752 val_conv.inner = (void*)(val & (~1));
39753 val_conv.is_owned = (val & 1) || (val == 0);
39754 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39755 val_conv = OutPoint_clone(&val_conv);
39756 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
39759 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
39760 LDKChannelTransactionParameters this_ptr_conv;
39761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39762 this_ptr_conv.is_owned = false;
39763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39764 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
39768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
39769 LDKChannelTransactionParameters this_ptr_conv;
39770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39771 this_ptr_conv.is_owned = false;
39772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39773 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
39774 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
39777 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) {
39778 LDKChannelPublicKeys holder_pubkeys_arg_conv;
39779 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
39780 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
39781 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
39782 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
39783 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
39784 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
39785 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
39786 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
39787 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
39788 LDKOutPoint funding_outpoint_arg_conv;
39789 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
39790 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
39791 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
39792 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
39793 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
39794 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);
39795 int64_t ret_ref = 0;
39796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39799 ret_ref = (uintptr_t)ret_var.inner;
39800 if (ret_var.is_owned) {
39806 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
39807 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
39808 int64_t ret_ref = 0;
39809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39812 ret_ref = (uintptr_t)ret_var.inner;
39813 if (ret_var.is_owned) {
39818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39819 LDKChannelTransactionParameters arg_conv;
39820 arg_conv.inner = (void*)(arg & (~1));
39821 arg_conv.is_owned = false;
39822 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39823 int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
39827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39828 LDKChannelTransactionParameters orig_conv;
39829 orig_conv.inner = (void*)(orig & (~1));
39830 orig_conv.is_owned = false;
39831 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39832 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
39833 int64_t ret_ref = 0;
39834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39837 ret_ref = (uintptr_t)ret_var.inner;
39838 if (ret_var.is_owned) {
39844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39845 LDKCounterpartyChannelTransactionParameters this_obj_conv;
39846 this_obj_conv.inner = (void*)(this_obj & (~1));
39847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39849 CounterpartyChannelTransactionParameters_free(this_obj_conv);
39852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
39853 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39855 this_ptr_conv.is_owned = false;
39856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39857 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39858 int64_t ret_ref = 0;
39859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39862 ret_ref = (uintptr_t)ret_var.inner;
39863 if (ret_var.is_owned) {
39869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39870 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39872 this_ptr_conv.is_owned = false;
39873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39874 LDKChannelPublicKeys val_conv;
39875 val_conv.inner = (void*)(val & (~1));
39876 val_conv.is_owned = (val & 1) || (val == 0);
39877 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39878 val_conv = ChannelPublicKeys_clone(&val_conv);
39879 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39882 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39883 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39885 this_ptr_conv.is_owned = false;
39886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39887 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39892 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39894 this_ptr_conv.is_owned = false;
39895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39896 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39899 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) {
39900 LDKChannelPublicKeys pubkeys_arg_conv;
39901 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
39902 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
39903 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39904 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39905 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39906 int64_t ret_ref = 0;
39907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39910 ret_ref = (uintptr_t)ret_var.inner;
39911 if (ret_var.is_owned) {
39917 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39918 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39919 int64_t ret_ref = 0;
39920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39923 ret_ref = (uintptr_t)ret_var.inner;
39924 if (ret_var.is_owned) {
39929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39930 LDKCounterpartyChannelTransactionParameters arg_conv;
39931 arg_conv.inner = (void*)(arg & (~1));
39932 arg_conv.is_owned = false;
39933 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39934 int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39939 LDKCounterpartyChannelTransactionParameters orig_conv;
39940 orig_conv.inner = (void*)(orig & (~1));
39941 orig_conv.is_owned = false;
39942 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39943 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39944 int64_t ret_ref = 0;
39945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39948 ret_ref = (uintptr_t)ret_var.inner;
39949 if (ret_var.is_owned) {
39955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
39956 LDKChannelTransactionParameters this_arg_conv;
39957 this_arg_conv.inner = (void*)(this_arg & (~1));
39958 this_arg_conv.is_owned = false;
39959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39960 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39965 LDKChannelTransactionParameters this_arg_conv;
39966 this_arg_conv.inner = (void*)(this_arg & (~1));
39967 this_arg_conv.is_owned = false;
39968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39969 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
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_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39982 LDKChannelTransactionParameters this_arg_conv;
39983 this_arg_conv.inner = (void*)(this_arg & (~1));
39984 this_arg_conv.is_owned = false;
39985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39986 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39987 int64_t ret_ref = 0;
39988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39991 ret_ref = (uintptr_t)ret_var.inner;
39992 if (ret_var.is_owned) {
39998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
39999 LDKCounterpartyChannelTransactionParameters obj_conv;
40000 obj_conv.inner = (void*)(obj & (~1));
40001 obj_conv.is_owned = false;
40002 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40003 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
40004 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40005 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40006 CVec_u8Z_free(ret_var);
40010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40011 LDKu8slice ser_ref;
40012 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40013 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40014 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
40015 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
40016 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40017 return (int64_t)ret_conv;
40020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
40021 LDKChannelTransactionParameters obj_conv;
40022 obj_conv.inner = (void*)(obj & (~1));
40023 obj_conv.is_owned = false;
40024 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40025 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
40026 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40027 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40028 CVec_u8Z_free(ret_var);
40032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40033 LDKu8slice ser_ref;
40034 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40035 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40036 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
40037 *ret_conv = ChannelTransactionParameters_read(ser_ref);
40038 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40039 return (int64_t)ret_conv;
40042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40043 LDKDirectedChannelTransactionParameters this_obj_conv;
40044 this_obj_conv.inner = (void*)(this_obj & (~1));
40045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40047 DirectedChannelTransactionParameters_free(this_obj_conv);
40050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40051 LDKDirectedChannelTransactionParameters this_arg_conv;
40052 this_arg_conv.inner = (void*)(this_arg & (~1));
40053 this_arg_conv.is_owned = false;
40054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40055 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
40056 int64_t ret_ref = 0;
40057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40060 ret_ref = (uintptr_t)ret_var.inner;
40061 if (ret_var.is_owned) {
40067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40068 LDKDirectedChannelTransactionParameters this_arg_conv;
40069 this_arg_conv.inner = (void*)(this_arg & (~1));
40070 this_arg_conv.is_owned = false;
40071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40072 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
40073 int64_t ret_ref = 0;
40074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40077 ret_ref = (uintptr_t)ret_var.inner;
40078 if (ret_var.is_owned) {
40084 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
40085 LDKDirectedChannelTransactionParameters this_arg_conv;
40086 this_arg_conv.inner = (void*)(this_arg & (~1));
40087 this_arg_conv.is_owned = false;
40088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40089 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
40093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
40094 LDKDirectedChannelTransactionParameters this_arg_conv;
40095 this_arg_conv.inner = (void*)(this_arg & (~1));
40096 this_arg_conv.is_owned = false;
40097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40098 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
40102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
40103 LDKDirectedChannelTransactionParameters this_arg_conv;
40104 this_arg_conv.inner = (void*)(this_arg & (~1));
40105 this_arg_conv.is_owned = false;
40106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40107 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
40108 int64_t ret_ref = 0;
40109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40112 ret_ref = (uintptr_t)ret_var.inner;
40113 if (ret_var.is_owned) {
40119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40120 LDKDirectedChannelTransactionParameters this_arg_conv;
40121 this_arg_conv.inner = (void*)(this_arg & (~1));
40122 this_arg_conv.is_owned = false;
40123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40124 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
40128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40129 LDKHolderCommitmentTransaction this_obj_conv;
40130 this_obj_conv.inner = (void*)(this_obj & (~1));
40131 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40133 HolderCommitmentTransaction_free(this_obj_conv);
40136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
40137 LDKHolderCommitmentTransaction this_ptr_conv;
40138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40139 this_ptr_conv.is_owned = false;
40140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40141 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40142 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
40146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40147 LDKHolderCommitmentTransaction this_ptr_conv;
40148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40149 this_ptr_conv.is_owned = false;
40150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40151 LDKSignature val_ref;
40152 CHECK((*env)->GetArrayLength(env, val) == 64);
40153 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
40154 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
40157 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40158 LDKHolderCommitmentTransaction this_ptr_conv;
40159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40160 this_ptr_conv.is_owned = false;
40161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40162 LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
40163 jobjectArray ret_arr = NULL;
40164 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
40166 for (size_t i = 0; i < ret_var.datalen; i++) {
40167 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
40168 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
40169 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
40172 FREE(ret_var.data);
40176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
40177 LDKHolderCommitmentTransaction this_ptr_conv;
40178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40179 this_ptr_conv.is_owned = false;
40180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40181 LDKCVec_SignatureZ val_constr;
40182 val_constr.datalen = (*env)->GetArrayLength(env, val);
40183 if (val_constr.datalen > 0)
40184 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40186 val_constr.data = NULL;
40187 for (size_t i = 0; i < val_constr.datalen; i++) {
40188 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
40189 LDKSignature val_conv_8_ref;
40190 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
40191 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
40192 val_constr.data[i] = val_conv_8_ref;
40194 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
40197 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
40198 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
40199 int64_t ret_ref = 0;
40200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40203 ret_ref = (uintptr_t)ret_var.inner;
40204 if (ret_var.is_owned) {
40209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40210 LDKHolderCommitmentTransaction arg_conv;
40211 arg_conv.inner = (void*)(arg & (~1));
40212 arg_conv.is_owned = false;
40213 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40214 int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
40218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40219 LDKHolderCommitmentTransaction orig_conv;
40220 orig_conv.inner = (void*)(orig & (~1));
40221 orig_conv.is_owned = false;
40222 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40223 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
40224 int64_t ret_ref = 0;
40225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40228 ret_ref = (uintptr_t)ret_var.inner;
40229 if (ret_var.is_owned) {
40235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40236 LDKHolderCommitmentTransaction obj_conv;
40237 obj_conv.inner = (void*)(obj & (~1));
40238 obj_conv.is_owned = false;
40239 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40240 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
40241 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40242 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40243 CVec_u8Z_free(ret_var);
40247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40248 LDKu8slice ser_ref;
40249 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40250 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40251 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
40252 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
40253 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40254 return (int64_t)ret_conv;
40257 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) {
40258 LDKCommitmentTransaction commitment_tx_conv;
40259 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
40260 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
40261 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
40262 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
40263 LDKSignature counterparty_sig_ref;
40264 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
40265 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
40266 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
40267 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
40268 if (counterparty_htlc_sigs_constr.datalen > 0)
40269 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40271 counterparty_htlc_sigs_constr.data = NULL;
40272 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
40273 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
40274 LDKSignature counterparty_htlc_sigs_conv_8_ref;
40275 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
40276 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
40277 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
40279 LDKPublicKey holder_funding_key_ref;
40280 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
40281 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
40282 LDKPublicKey counterparty_funding_key_ref;
40283 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
40284 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
40285 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
40286 int64_t ret_ref = 0;
40287 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40288 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40290 ret_ref = (uintptr_t)ret_var.inner;
40291 if (ret_var.is_owned) {
40297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40298 LDKBuiltCommitmentTransaction this_obj_conv;
40299 this_obj_conv.inner = (void*)(this_obj & (~1));
40300 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40302 BuiltCommitmentTransaction_free(this_obj_conv);
40305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
40306 LDKBuiltCommitmentTransaction this_ptr_conv;
40307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40308 this_ptr_conv.is_owned = false;
40309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40310 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
40311 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40312 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40313 Transaction_free(ret_var);
40317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40318 LDKBuiltCommitmentTransaction this_ptr_conv;
40319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40320 this_ptr_conv.is_owned = false;
40321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40322 LDKTransaction val_ref;
40323 val_ref.datalen = (*env)->GetArrayLength(env, val);
40324 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
40325 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
40326 val_ref.data_is_owned = true;
40327 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
40330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
40331 LDKBuiltCommitmentTransaction this_ptr_conv;
40332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40333 this_ptr_conv.is_owned = false;
40334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40335 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40336 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
40340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40341 LDKBuiltCommitmentTransaction this_ptr_conv;
40342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40343 this_ptr_conv.is_owned = false;
40344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40345 LDKThirtyTwoBytes val_ref;
40346 CHECK((*env)->GetArrayLength(env, val) == 32);
40347 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40348 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
40351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
40352 LDKTransaction transaction_arg_ref;
40353 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
40354 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
40355 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
40356 transaction_arg_ref.data_is_owned = true;
40357 LDKThirtyTwoBytes txid_arg_ref;
40358 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
40359 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
40360 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
40361 int64_t ret_ref = 0;
40362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40365 ret_ref = (uintptr_t)ret_var.inner;
40366 if (ret_var.is_owned) {
40372 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
40373 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
40374 int64_t ret_ref = 0;
40375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40378 ret_ref = (uintptr_t)ret_var.inner;
40379 if (ret_var.is_owned) {
40384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40385 LDKBuiltCommitmentTransaction arg_conv;
40386 arg_conv.inner = (void*)(arg & (~1));
40387 arg_conv.is_owned = false;
40388 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40389 int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
40393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40394 LDKBuiltCommitmentTransaction orig_conv;
40395 orig_conv.inner = (void*)(orig & (~1));
40396 orig_conv.is_owned = false;
40397 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40398 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
40399 int64_t ret_ref = 0;
40400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40403 ret_ref = (uintptr_t)ret_var.inner;
40404 if (ret_var.is_owned) {
40410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40411 LDKBuiltCommitmentTransaction obj_conv;
40412 obj_conv.inner = (void*)(obj & (~1));
40413 obj_conv.is_owned = false;
40414 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40415 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
40416 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40417 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40418 CVec_u8Z_free(ret_var);
40422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40423 LDKu8slice ser_ref;
40424 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40425 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40426 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
40427 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
40428 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40429 return (int64_t)ret_conv;
40432 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) {
40433 LDKBuiltCommitmentTransaction this_arg_conv;
40434 this_arg_conv.inner = (void*)(this_arg & (~1));
40435 this_arg_conv.is_owned = false;
40436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40437 LDKu8slice funding_redeemscript_ref;
40438 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40439 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40440 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40441 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
40442 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40446 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) {
40447 LDKBuiltCommitmentTransaction this_arg_conv;
40448 this_arg_conv.inner = (void*)(this_arg & (~1));
40449 this_arg_conv.is_owned = false;
40450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40451 unsigned char funding_key_arr[32];
40452 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
40453 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
40454 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
40455 LDKu8slice funding_redeemscript_ref;
40456 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40457 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40458 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40459 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
40460 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40465 LDKClosingTransaction this_obj_conv;
40466 this_obj_conv.inner = (void*)(this_obj & (~1));
40467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40469 ClosingTransaction_free(this_obj_conv);
40472 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
40473 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
40474 int64_t ret_ref = 0;
40475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40478 ret_ref = (uintptr_t)ret_var.inner;
40479 if (ret_var.is_owned) {
40484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40485 LDKClosingTransaction arg_conv;
40486 arg_conv.inner = (void*)(arg & (~1));
40487 arg_conv.is_owned = false;
40488 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40489 int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
40493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40494 LDKClosingTransaction orig_conv;
40495 orig_conv.inner = (void*)(orig & (~1));
40496 orig_conv.is_owned = false;
40497 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40498 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
40499 int64_t ret_ref = 0;
40500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40503 ret_ref = (uintptr_t)ret_var.inner;
40504 if (ret_var.is_owned) {
40510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
40511 LDKClosingTransaction o_conv;
40512 o_conv.inner = (void*)(o & (~1));
40513 o_conv.is_owned = false;
40514 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40515 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
40519 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) {
40520 LDKCVec_u8Z to_holder_script_ref;
40521 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
40522 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
40523 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
40524 LDKCVec_u8Z to_counterparty_script_ref;
40525 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
40526 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
40527 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
40528 LDKOutPoint funding_outpoint_conv;
40529 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
40530 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
40531 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40532 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40533 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
40534 int64_t ret_ref = 0;
40535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40538 ret_ref = (uintptr_t)ret_var.inner;
40539 if (ret_var.is_owned) {
40545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
40546 LDKClosingTransaction this_arg_conv;
40547 this_arg_conv.inner = (void*)(this_arg & (~1));
40548 this_arg_conv.is_owned = false;
40549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40550 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
40551 int64_t ret_ref = 0;
40552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40555 ret_ref = (uintptr_t)ret_var.inner;
40556 if (ret_var.is_owned) {
40562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
40563 LDKClosingTransaction this_arg_conv;
40564 this_arg_conv.inner = (void*)(this_arg & (~1));
40565 this_arg_conv.is_owned = false;
40566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40567 LDKOutPoint funding_outpoint_conv;
40568 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
40569 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
40570 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40571 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40572 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
40573 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
40574 return (int64_t)ret_conv;
40577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40578 LDKClosingTransaction this_arg_conv;
40579 this_arg_conv.inner = (void*)(this_arg & (~1));
40580 this_arg_conv.is_owned = false;
40581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40582 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
40586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40587 LDKClosingTransaction this_arg_conv;
40588 this_arg_conv.inner = (void*)(this_arg & (~1));
40589 this_arg_conv.is_owned = false;
40590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40591 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
40595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40596 LDKClosingTransaction this_arg_conv;
40597 this_arg_conv.inner = (void*)(this_arg & (~1));
40598 this_arg_conv.is_owned = false;
40599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40600 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
40601 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40602 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40607 LDKClosingTransaction this_arg_conv;
40608 this_arg_conv.inner = (void*)(this_arg & (~1));
40609 this_arg_conv.is_owned = false;
40610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40611 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
40612 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40613 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40618 LDKTrustedClosingTransaction this_obj_conv;
40619 this_obj_conv.inner = (void*)(this_obj & (~1));
40620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40622 TrustedClosingTransaction_free(this_obj_conv);
40625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
40626 LDKTrustedClosingTransaction 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 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
40631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40633 Transaction_free(ret_var);
40637 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) {
40638 LDKTrustedClosingTransaction this_arg_conv;
40639 this_arg_conv.inner = (void*)(this_arg & (~1));
40640 this_arg_conv.is_owned = false;
40641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40642 LDKu8slice funding_redeemscript_ref;
40643 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40644 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40645 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40646 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
40647 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40651 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) {
40652 LDKTrustedClosingTransaction this_arg_conv;
40653 this_arg_conv.inner = (void*)(this_arg & (~1));
40654 this_arg_conv.is_owned = false;
40655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40656 unsigned char funding_key_arr[32];
40657 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
40658 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
40659 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
40660 LDKu8slice funding_redeemscript_ref;
40661 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40662 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40663 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40664 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
40665 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40670 LDKCommitmentTransaction this_obj_conv;
40671 this_obj_conv.inner = (void*)(this_obj & (~1));
40672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40674 CommitmentTransaction_free(this_obj_conv);
40677 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
40678 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
40679 int64_t ret_ref = 0;
40680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40683 ret_ref = (uintptr_t)ret_var.inner;
40684 if (ret_var.is_owned) {
40689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40690 LDKCommitmentTransaction arg_conv;
40691 arg_conv.inner = (void*)(arg & (~1));
40692 arg_conv.is_owned = false;
40693 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40694 int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
40698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40699 LDKCommitmentTransaction orig_conv;
40700 orig_conv.inner = (void*)(orig & (~1));
40701 orig_conv.is_owned = false;
40702 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40703 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
40704 int64_t ret_ref = 0;
40705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40708 ret_ref = (uintptr_t)ret_var.inner;
40709 if (ret_var.is_owned) {
40715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40716 LDKCommitmentTransaction obj_conv;
40717 obj_conv.inner = (void*)(obj & (~1));
40718 obj_conv.is_owned = false;
40719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40720 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
40721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40723 CVec_u8Z_free(ret_var);
40727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40728 LDKu8slice ser_ref;
40729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40731 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
40732 *ret_conv = CommitmentTransaction_read(ser_ref);
40733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40734 return (int64_t)ret_conv;
40737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
40738 LDKCommitmentTransaction this_arg_conv;
40739 this_arg_conv.inner = (void*)(this_arg & (~1));
40740 this_arg_conv.is_owned = false;
40741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40742 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
40746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40747 LDKCommitmentTransaction this_arg_conv;
40748 this_arg_conv.inner = (void*)(this_arg & (~1));
40749 this_arg_conv.is_owned = false;
40750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40751 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
40755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40756 LDKCommitmentTransaction this_arg_conv;
40757 this_arg_conv.inner = (void*)(this_arg & (~1));
40758 this_arg_conv.is_owned = false;
40759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40760 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
40764 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
40765 LDKCommitmentTransaction this_arg_conv;
40766 this_arg_conv.inner = (void*)(this_arg & (~1));
40767 this_arg_conv.is_owned = false;
40768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40769 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
40773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
40774 LDKCommitmentTransaction this_arg_conv;
40775 this_arg_conv.inner = (void*)(this_arg & (~1));
40776 this_arg_conv.is_owned = false;
40777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40778 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
40779 int64_t ret_ref = 0;
40780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40783 ret_ref = (uintptr_t)ret_var.inner;
40784 if (ret_var.is_owned) {
40790 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) {
40791 LDKCommitmentTransaction this_arg_conv;
40792 this_arg_conv.inner = (void*)(this_arg & (~1));
40793 this_arg_conv.is_owned = false;
40794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40795 LDKDirectedChannelTransactionParameters channel_parameters_conv;
40796 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
40797 channel_parameters_conv.is_owned = false;
40798 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40799 LDKChannelPublicKeys broadcaster_keys_conv;
40800 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
40801 broadcaster_keys_conv.is_owned = false;
40802 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
40803 LDKChannelPublicKeys countersignatory_keys_conv;
40804 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
40805 countersignatory_keys_conv.is_owned = false;
40806 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
40807 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
40808 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
40809 return (int64_t)ret_conv;
40812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40813 LDKTrustedCommitmentTransaction this_obj_conv;
40814 this_obj_conv.inner = (void*)(this_obj & (~1));
40815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40817 TrustedCommitmentTransaction_free(this_obj_conv);
40820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
40821 LDKTrustedCommitmentTransaction this_arg_conv;
40822 this_arg_conv.inner = (void*)(this_arg & (~1));
40823 this_arg_conv.is_owned = false;
40824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40825 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40826 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
40830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
40831 LDKTrustedCommitmentTransaction this_arg_conv;
40832 this_arg_conv.inner = (void*)(this_arg & (~1));
40833 this_arg_conv.is_owned = false;
40834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40835 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
40836 int64_t ret_ref = 0;
40837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40840 ret_ref = (uintptr_t)ret_var.inner;
40841 if (ret_var.is_owned) {
40847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
40848 LDKTrustedCommitmentTransaction this_arg_conv;
40849 this_arg_conv.inner = (void*)(this_arg & (~1));
40850 this_arg_conv.is_owned = false;
40851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40852 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40853 int64_t ret_ref = 0;
40854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40857 ret_ref = (uintptr_t)ret_var.inner;
40858 if (ret_var.is_owned) {
40864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40865 LDKTrustedCommitmentTransaction this_arg_conv;
40866 this_arg_conv.inner = (void*)(this_arg & (~1));
40867 this_arg_conv.is_owned = false;
40868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40869 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40873 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) {
40874 LDKTrustedCommitmentTransaction this_arg_conv;
40875 this_arg_conv.inner = (void*)(this_arg & (~1));
40876 this_arg_conv.is_owned = false;
40877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40878 unsigned char htlc_base_key_arr[32];
40879 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
40880 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
40881 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40882 LDKDirectedChannelTransactionParameters channel_parameters_conv;
40883 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
40884 channel_parameters_conv.is_owned = false;
40885 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40886 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40887 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
40888 return (int64_t)ret_conv;
40891 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) {
40892 LDKPublicKey broadcaster_payment_basepoint_ref;
40893 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
40894 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
40895 LDKPublicKey countersignatory_payment_basepoint_ref;
40896 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
40897 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
40898 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40903 LDKInitFeatures a_conv;
40904 a_conv.inner = (void*)(a & (~1));
40905 a_conv.is_owned = false;
40906 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40907 LDKInitFeatures b_conv;
40908 b_conv.inner = (void*)(b & (~1));
40909 b_conv.is_owned = false;
40910 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40911 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40916 LDKNodeFeatures a_conv;
40917 a_conv.inner = (void*)(a & (~1));
40918 a_conv.is_owned = false;
40919 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40920 LDKNodeFeatures b_conv;
40921 b_conv.inner = (void*)(b & (~1));
40922 b_conv.is_owned = false;
40923 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40924 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40929 LDKChannelFeatures a_conv;
40930 a_conv.inner = (void*)(a & (~1));
40931 a_conv.is_owned = false;
40932 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40933 LDKChannelFeatures b_conv;
40934 b_conv.inner = (void*)(b & (~1));
40935 b_conv.is_owned = false;
40936 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40937 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40942 LDKInvoiceFeatures a_conv;
40943 a_conv.inner = (void*)(a & (~1));
40944 a_conv.is_owned = false;
40945 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40946 LDKInvoiceFeatures b_conv;
40947 b_conv.inner = (void*)(b & (~1));
40948 b_conv.is_owned = false;
40949 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40950 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40955 LDKChannelTypeFeatures a_conv;
40956 a_conv.inner = (void*)(a & (~1));
40957 a_conv.is_owned = false;
40958 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40959 LDKChannelTypeFeatures b_conv;
40960 b_conv.inner = (void*)(b & (~1));
40961 b_conv.is_owned = false;
40962 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40963 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40967 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40968 LDKInitFeatures ret_var = InitFeatures_clone(arg);
40969 int64_t ret_ref = 0;
40970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40973 ret_ref = (uintptr_t)ret_var.inner;
40974 if (ret_var.is_owned) {
40979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40980 LDKInitFeatures arg_conv;
40981 arg_conv.inner = (void*)(arg & (~1));
40982 arg_conv.is_owned = false;
40983 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40984 int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40989 LDKInitFeatures orig_conv;
40990 orig_conv.inner = (void*)(orig & (~1));
40991 orig_conv.is_owned = false;
40992 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40993 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40994 int64_t ret_ref = 0;
40995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40998 ret_ref = (uintptr_t)ret_var.inner;
40999 if (ret_var.is_owned) {
41005 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
41006 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
41007 int64_t ret_ref = 0;
41008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41011 ret_ref = (uintptr_t)ret_var.inner;
41012 if (ret_var.is_owned) {
41017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41018 LDKNodeFeatures arg_conv;
41019 arg_conv.inner = (void*)(arg & (~1));
41020 arg_conv.is_owned = false;
41021 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41022 int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
41026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41027 LDKNodeFeatures orig_conv;
41028 orig_conv.inner = (void*)(orig & (~1));
41029 orig_conv.is_owned = false;
41030 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41031 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
41032 int64_t ret_ref = 0;
41033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41036 ret_ref = (uintptr_t)ret_var.inner;
41037 if (ret_var.is_owned) {
41043 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
41044 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
41045 int64_t ret_ref = 0;
41046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41049 ret_ref = (uintptr_t)ret_var.inner;
41050 if (ret_var.is_owned) {
41055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41056 LDKChannelFeatures arg_conv;
41057 arg_conv.inner = (void*)(arg & (~1));
41058 arg_conv.is_owned = false;
41059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41060 int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
41064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41065 LDKChannelFeatures orig_conv;
41066 orig_conv.inner = (void*)(orig & (~1));
41067 orig_conv.is_owned = false;
41068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41069 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
41070 int64_t ret_ref = 0;
41071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41074 ret_ref = (uintptr_t)ret_var.inner;
41075 if (ret_var.is_owned) {
41081 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
41082 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
41083 int64_t ret_ref = 0;
41084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41087 ret_ref = (uintptr_t)ret_var.inner;
41088 if (ret_var.is_owned) {
41093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41094 LDKInvoiceFeatures arg_conv;
41095 arg_conv.inner = (void*)(arg & (~1));
41096 arg_conv.is_owned = false;
41097 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41098 int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
41102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41103 LDKInvoiceFeatures orig_conv;
41104 orig_conv.inner = (void*)(orig & (~1));
41105 orig_conv.is_owned = false;
41106 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41107 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
41108 int64_t ret_ref = 0;
41109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41112 ret_ref = (uintptr_t)ret_var.inner;
41113 if (ret_var.is_owned) {
41119 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
41120 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
41121 int64_t ret_ref = 0;
41122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41125 ret_ref = (uintptr_t)ret_var.inner;
41126 if (ret_var.is_owned) {
41131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41132 LDKChannelTypeFeatures arg_conv;
41133 arg_conv.inner = (void*)(arg & (~1));
41134 arg_conv.is_owned = false;
41135 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41136 int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
41140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41141 LDKChannelTypeFeatures orig_conv;
41142 orig_conv.inner = (void*)(orig & (~1));
41143 orig_conv.is_owned = false;
41144 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41145 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
41146 int64_t ret_ref = 0;
41147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41150 ret_ref = (uintptr_t)ret_var.inner;
41151 if (ret_var.is_owned) {
41157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41158 LDKInitFeatures this_obj_conv;
41159 this_obj_conv.inner = (void*)(this_obj & (~1));
41160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41162 InitFeatures_free(this_obj_conv);
41165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41166 LDKNodeFeatures this_obj_conv;
41167 this_obj_conv.inner = (void*)(this_obj & (~1));
41168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41170 NodeFeatures_free(this_obj_conv);
41173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41174 LDKChannelFeatures this_obj_conv;
41175 this_obj_conv.inner = (void*)(this_obj & (~1));
41176 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41178 ChannelFeatures_free(this_obj_conv);
41181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41182 LDKInvoiceFeatures this_obj_conv;
41183 this_obj_conv.inner = (void*)(this_obj & (~1));
41184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41186 InvoiceFeatures_free(this_obj_conv);
41189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41190 LDKChannelTypeFeatures this_obj_conv;
41191 this_obj_conv.inner = (void*)(this_obj & (~1));
41192 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41194 ChannelTypeFeatures_free(this_obj_conv);
41197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
41198 LDKInitFeatures ret_var = InitFeatures_empty();
41199 int64_t ret_ref = 0;
41200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41203 ret_ref = (uintptr_t)ret_var.inner;
41204 if (ret_var.is_owned) {
41210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
41211 LDKInitFeatures ret_var = InitFeatures_known();
41212 int64_t ret_ref = 0;
41213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41216 ret_ref = (uintptr_t)ret_var.inner;
41217 if (ret_var.is_owned) {
41223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41224 LDKInitFeatures this_arg_conv;
41225 this_arg_conv.inner = (void*)(this_arg & (~1));
41226 this_arg_conv.is_owned = false;
41227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41228 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
41232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
41233 LDKNodeFeatures ret_var = NodeFeatures_empty();
41234 int64_t ret_ref = 0;
41235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41238 ret_ref = (uintptr_t)ret_var.inner;
41239 if (ret_var.is_owned) {
41245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
41246 LDKNodeFeatures ret_var = NodeFeatures_known();
41247 int64_t ret_ref = 0;
41248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41251 ret_ref = (uintptr_t)ret_var.inner;
41252 if (ret_var.is_owned) {
41258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41259 LDKNodeFeatures this_arg_conv;
41260 this_arg_conv.inner = (void*)(this_arg & (~1));
41261 this_arg_conv.is_owned = false;
41262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41263 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
41267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
41268 LDKChannelFeatures ret_var = ChannelFeatures_empty();
41269 int64_t ret_ref = 0;
41270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41273 ret_ref = (uintptr_t)ret_var.inner;
41274 if (ret_var.is_owned) {
41280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
41281 LDKChannelFeatures ret_var = ChannelFeatures_known();
41282 int64_t ret_ref = 0;
41283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41286 ret_ref = (uintptr_t)ret_var.inner;
41287 if (ret_var.is_owned) {
41293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41294 LDKChannelFeatures this_arg_conv;
41295 this_arg_conv.inner = (void*)(this_arg & (~1));
41296 this_arg_conv.is_owned = false;
41297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41298 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
41302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
41303 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
41304 int64_t ret_ref = 0;
41305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41308 ret_ref = (uintptr_t)ret_var.inner;
41309 if (ret_var.is_owned) {
41315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
41316 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
41317 int64_t ret_ref = 0;
41318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41321 ret_ref = (uintptr_t)ret_var.inner;
41322 if (ret_var.is_owned) {
41328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41329 LDKInvoiceFeatures this_arg_conv;
41330 this_arg_conv.inner = (void*)(this_arg & (~1));
41331 this_arg_conv.is_owned = false;
41332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41333 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
41337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
41338 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
41339 int64_t ret_ref = 0;
41340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41343 ret_ref = (uintptr_t)ret_var.inner;
41344 if (ret_var.is_owned) {
41350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
41351 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
41352 int64_t ret_ref = 0;
41353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41356 ret_ref = (uintptr_t)ret_var.inner;
41357 if (ret_var.is_owned) {
41363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41364 LDKChannelTypeFeatures this_arg_conv;
41365 this_arg_conv.inner = (void*)(this_arg & (~1));
41366 this_arg_conv.is_owned = false;
41367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41368 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
41372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41373 LDKInitFeatures obj_conv;
41374 obj_conv.inner = (void*)(obj & (~1));
41375 obj_conv.is_owned = false;
41376 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41377 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
41378 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41379 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41380 CVec_u8Z_free(ret_var);
41384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41385 LDKu8slice ser_ref;
41386 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41387 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41388 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
41389 *ret_conv = InitFeatures_read(ser_ref);
41390 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41391 return (int64_t)ret_conv;
41394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41395 LDKChannelFeatures obj_conv;
41396 obj_conv.inner = (void*)(obj & (~1));
41397 obj_conv.is_owned = false;
41398 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41399 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
41400 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41401 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41402 CVec_u8Z_free(ret_var);
41406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41407 LDKu8slice ser_ref;
41408 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41409 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41410 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
41411 *ret_conv = ChannelFeatures_read(ser_ref);
41412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41413 return (int64_t)ret_conv;
41416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41417 LDKNodeFeatures obj_conv;
41418 obj_conv.inner = (void*)(obj & (~1));
41419 obj_conv.is_owned = false;
41420 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41421 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
41422 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41423 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41424 CVec_u8Z_free(ret_var);
41428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41429 LDKu8slice ser_ref;
41430 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41431 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41432 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
41433 *ret_conv = NodeFeatures_read(ser_ref);
41434 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41435 return (int64_t)ret_conv;
41438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41439 LDKInvoiceFeatures obj_conv;
41440 obj_conv.inner = (void*)(obj & (~1));
41441 obj_conv.is_owned = false;
41442 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41443 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
41444 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41445 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41446 CVec_u8Z_free(ret_var);
41450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41451 LDKu8slice ser_ref;
41452 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41453 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41454 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
41455 *ret_conv = InvoiceFeatures_read(ser_ref);
41456 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41457 return (int64_t)ret_conv;
41460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41461 LDKChannelTypeFeatures obj_conv;
41462 obj_conv.inner = (void*)(obj & (~1));
41463 obj_conv.is_owned = false;
41464 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41465 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
41466 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41467 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41468 CVec_u8Z_free(ret_var);
41472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41473 LDKu8slice ser_ref;
41474 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41475 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41476 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
41477 *ret_conv = ChannelTypeFeatures_read(ser_ref);
41478 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41479 return (int64_t)ret_conv;
41482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41483 LDKInitFeatures this_arg_conv;
41484 this_arg_conv.inner = (void*)(this_arg & (~1));
41485 this_arg_conv.is_owned = false;
41486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41487 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
41490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41491 LDKInitFeatures this_arg_conv;
41492 this_arg_conv.inner = (void*)(this_arg & (~1));
41493 this_arg_conv.is_owned = false;
41494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41495 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
41498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41499 LDKInitFeatures this_arg_conv;
41500 this_arg_conv.inner = (void*)(this_arg & (~1));
41501 this_arg_conv.is_owned = false;
41502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41503 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
41507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41508 LDKNodeFeatures this_arg_conv;
41509 this_arg_conv.inner = (void*)(this_arg & (~1));
41510 this_arg_conv.is_owned = false;
41511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41512 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
41515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41516 LDKNodeFeatures this_arg_conv;
41517 this_arg_conv.inner = (void*)(this_arg & (~1));
41518 this_arg_conv.is_owned = false;
41519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41520 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
41523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41524 LDKNodeFeatures this_arg_conv;
41525 this_arg_conv.inner = (void*)(this_arg & (~1));
41526 this_arg_conv.is_owned = false;
41527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41528 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
41532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41533 LDKInitFeatures this_arg_conv;
41534 this_arg_conv.inner = (void*)(this_arg & (~1));
41535 this_arg_conv.is_owned = false;
41536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41537 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
41541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41542 LDKNodeFeatures this_arg_conv;
41543 this_arg_conv.inner = (void*)(this_arg & (~1));
41544 this_arg_conv.is_owned = false;
41545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41546 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
41550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41551 LDKInitFeatures this_arg_conv;
41552 this_arg_conv.inner = (void*)(this_arg & (~1));
41553 this_arg_conv.is_owned = false;
41554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41555 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
41558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41559 LDKInitFeatures this_arg_conv;
41560 this_arg_conv.inner = (void*)(this_arg & (~1));
41561 this_arg_conv.is_owned = false;
41562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41563 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
41566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
41567 LDKInitFeatures this_arg_conv;
41568 this_arg_conv.inner = (void*)(this_arg & (~1));
41569 this_arg_conv.is_owned = false;
41570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41571 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
41575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41576 LDKInitFeatures this_arg_conv;
41577 this_arg_conv.inner = (void*)(this_arg & (~1));
41578 this_arg_conv.is_owned = false;
41579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41580 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41584 LDKInitFeatures this_arg_conv;
41585 this_arg_conv.inner = (void*)(this_arg & (~1));
41586 this_arg_conv.is_owned = false;
41587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41588 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41592 LDKInitFeatures this_arg_conv;
41593 this_arg_conv.inner = (void*)(this_arg & (~1));
41594 this_arg_conv.is_owned = false;
41595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41596 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41601 LDKNodeFeatures this_arg_conv;
41602 this_arg_conv.inner = (void*)(this_arg & (~1));
41603 this_arg_conv.is_owned = false;
41604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41605 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41609 LDKNodeFeatures this_arg_conv;
41610 this_arg_conv.inner = (void*)(this_arg & (~1));
41611 this_arg_conv.is_owned = false;
41612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41613 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41617 LDKNodeFeatures this_arg_conv;
41618 this_arg_conv.inner = (void*)(this_arg & (~1));
41619 this_arg_conv.is_owned = false;
41620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41621 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41626 LDKInitFeatures this_arg_conv;
41627 this_arg_conv.inner = (void*)(this_arg & (~1));
41628 this_arg_conv.is_owned = false;
41629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41630 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41635 LDKNodeFeatures this_arg_conv;
41636 this_arg_conv.inner = (void*)(this_arg & (~1));
41637 this_arg_conv.is_owned = false;
41638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41639 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41644 LDKInitFeatures this_arg_conv;
41645 this_arg_conv.inner = (void*)(this_arg & (~1));
41646 this_arg_conv.is_owned = false;
41647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41648 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41652 LDKInitFeatures this_arg_conv;
41653 this_arg_conv.inner = (void*)(this_arg & (~1));
41654 this_arg_conv.is_owned = false;
41655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41656 InitFeatures_set_gossip_queries_required(&this_arg_conv);
41659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41660 LDKInitFeatures this_arg_conv;
41661 this_arg_conv.inner = (void*)(this_arg & (~1));
41662 this_arg_conv.is_owned = false;
41663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41664 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41669 LDKNodeFeatures this_arg_conv;
41670 this_arg_conv.inner = (void*)(this_arg & (~1));
41671 this_arg_conv.is_owned = false;
41672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41673 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41677 LDKNodeFeatures this_arg_conv;
41678 this_arg_conv.inner = (void*)(this_arg & (~1));
41679 this_arg_conv.is_owned = false;
41680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41681 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41685 LDKNodeFeatures this_arg_conv;
41686 this_arg_conv.inner = (void*)(this_arg & (~1));
41687 this_arg_conv.is_owned = false;
41688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41689 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41694 LDKInitFeatures this_arg_conv;
41695 this_arg_conv.inner = (void*)(this_arg & (~1));
41696 this_arg_conv.is_owned = false;
41697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41698 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41703 LDKNodeFeatures this_arg_conv;
41704 this_arg_conv.inner = (void*)(this_arg & (~1));
41705 this_arg_conv.is_owned = false;
41706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41707 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41712 LDKInitFeatures this_arg_conv;
41713 this_arg_conv.inner = (void*)(this_arg & (~1));
41714 this_arg_conv.is_owned = false;
41715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41716 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41720 LDKInitFeatures this_arg_conv;
41721 this_arg_conv.inner = (void*)(this_arg & (~1));
41722 this_arg_conv.is_owned = false;
41723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41724 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41728 LDKInitFeatures this_arg_conv;
41729 this_arg_conv.inner = (void*)(this_arg & (~1));
41730 this_arg_conv.is_owned = false;
41731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41732 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41737 LDKNodeFeatures this_arg_conv;
41738 this_arg_conv.inner = (void*)(this_arg & (~1));
41739 this_arg_conv.is_owned = false;
41740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41741 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41745 LDKNodeFeatures this_arg_conv;
41746 this_arg_conv.inner = (void*)(this_arg & (~1));
41747 this_arg_conv.is_owned = false;
41748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41749 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41753 LDKNodeFeatures this_arg_conv;
41754 this_arg_conv.inner = (void*)(this_arg & (~1));
41755 this_arg_conv.is_owned = false;
41756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41757 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41762 LDKInvoiceFeatures this_arg_conv;
41763 this_arg_conv.inner = (void*)(this_arg & (~1));
41764 this_arg_conv.is_owned = false;
41765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41766 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41770 LDKInvoiceFeatures this_arg_conv;
41771 this_arg_conv.inner = (void*)(this_arg & (~1));
41772 this_arg_conv.is_owned = false;
41773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41774 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41778 LDKInvoiceFeatures this_arg_conv;
41779 this_arg_conv.inner = (void*)(this_arg & (~1));
41780 this_arg_conv.is_owned = false;
41781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41782 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41787 LDKInitFeatures this_arg_conv;
41788 this_arg_conv.inner = (void*)(this_arg & (~1));
41789 this_arg_conv.is_owned = false;
41790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41791 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41796 LDKNodeFeatures this_arg_conv;
41797 this_arg_conv.inner = (void*)(this_arg & (~1));
41798 this_arg_conv.is_owned = false;
41799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41800 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41805 LDKInvoiceFeatures this_arg_conv;
41806 this_arg_conv.inner = (void*)(this_arg & (~1));
41807 this_arg_conv.is_owned = false;
41808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41809 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41814 LDKInitFeatures this_arg_conv;
41815 this_arg_conv.inner = (void*)(this_arg & (~1));
41816 this_arg_conv.is_owned = false;
41817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41818 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41822 LDKInitFeatures this_arg_conv;
41823 this_arg_conv.inner = (void*)(this_arg & (~1));
41824 this_arg_conv.is_owned = false;
41825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41826 InitFeatures_set_static_remote_key_required(&this_arg_conv);
41829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41830 LDKInitFeatures this_arg_conv;
41831 this_arg_conv.inner = (void*)(this_arg & (~1));
41832 this_arg_conv.is_owned = false;
41833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41834 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41839 LDKNodeFeatures this_arg_conv;
41840 this_arg_conv.inner = (void*)(this_arg & (~1));
41841 this_arg_conv.is_owned = false;
41842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41843 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41847 LDKNodeFeatures this_arg_conv;
41848 this_arg_conv.inner = (void*)(this_arg & (~1));
41849 this_arg_conv.is_owned = false;
41850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41851 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41855 LDKNodeFeatures this_arg_conv;
41856 this_arg_conv.inner = (void*)(this_arg & (~1));
41857 this_arg_conv.is_owned = false;
41858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41859 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41864 LDKChannelTypeFeatures this_arg_conv;
41865 this_arg_conv.inner = (void*)(this_arg & (~1));
41866 this_arg_conv.is_owned = false;
41867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41868 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41872 LDKChannelTypeFeatures this_arg_conv;
41873 this_arg_conv.inner = (void*)(this_arg & (~1));
41874 this_arg_conv.is_owned = false;
41875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41876 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41880 LDKChannelTypeFeatures this_arg_conv;
41881 this_arg_conv.inner = (void*)(this_arg & (~1));
41882 this_arg_conv.is_owned = false;
41883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41884 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41889 LDKInitFeatures this_arg_conv;
41890 this_arg_conv.inner = (void*)(this_arg & (~1));
41891 this_arg_conv.is_owned = false;
41892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41893 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41898 LDKNodeFeatures this_arg_conv;
41899 this_arg_conv.inner = (void*)(this_arg & (~1));
41900 this_arg_conv.is_owned = false;
41901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41902 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41907 LDKChannelTypeFeatures this_arg_conv;
41908 this_arg_conv.inner = (void*)(this_arg & (~1));
41909 this_arg_conv.is_owned = false;
41910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41911 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41916 LDKInitFeatures this_arg_conv;
41917 this_arg_conv.inner = (void*)(this_arg & (~1));
41918 this_arg_conv.is_owned = false;
41919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41920 InitFeatures_set_payment_secret_optional(&this_arg_conv);
41923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41924 LDKInitFeatures this_arg_conv;
41925 this_arg_conv.inner = (void*)(this_arg & (~1));
41926 this_arg_conv.is_owned = false;
41927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41928 InitFeatures_set_payment_secret_required(&this_arg_conv);
41931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41932 LDKInitFeatures this_arg_conv;
41933 this_arg_conv.inner = (void*)(this_arg & (~1));
41934 this_arg_conv.is_owned = false;
41935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41936 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41941 LDKNodeFeatures this_arg_conv;
41942 this_arg_conv.inner = (void*)(this_arg & (~1));
41943 this_arg_conv.is_owned = false;
41944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41945 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41949 LDKNodeFeatures this_arg_conv;
41950 this_arg_conv.inner = (void*)(this_arg & (~1));
41951 this_arg_conv.is_owned = false;
41952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41953 NodeFeatures_set_payment_secret_required(&this_arg_conv);
41956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41957 LDKNodeFeatures this_arg_conv;
41958 this_arg_conv.inner = (void*)(this_arg & (~1));
41959 this_arg_conv.is_owned = false;
41960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41961 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41966 LDKInvoiceFeatures this_arg_conv;
41967 this_arg_conv.inner = (void*)(this_arg & (~1));
41968 this_arg_conv.is_owned = false;
41969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41970 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41974 LDKInvoiceFeatures this_arg_conv;
41975 this_arg_conv.inner = (void*)(this_arg & (~1));
41976 this_arg_conv.is_owned = false;
41977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41978 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41982 LDKInvoiceFeatures this_arg_conv;
41983 this_arg_conv.inner = (void*)(this_arg & (~1));
41984 this_arg_conv.is_owned = false;
41985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41986 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41991 LDKInitFeatures this_arg_conv;
41992 this_arg_conv.inner = (void*)(this_arg & (~1));
41993 this_arg_conv.is_owned = false;
41994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41995 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42000 LDKNodeFeatures this_arg_conv;
42001 this_arg_conv.inner = (void*)(this_arg & (~1));
42002 this_arg_conv.is_owned = false;
42003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42004 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
42008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42009 LDKInvoiceFeatures this_arg_conv;
42010 this_arg_conv.inner = (void*)(this_arg & (~1));
42011 this_arg_conv.is_owned = false;
42012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42013 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
42017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42018 LDKInitFeatures this_arg_conv;
42019 this_arg_conv.inner = (void*)(this_arg & (~1));
42020 this_arg_conv.is_owned = false;
42021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42022 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
42025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42026 LDKInitFeatures this_arg_conv;
42027 this_arg_conv.inner = (void*)(this_arg & (~1));
42028 this_arg_conv.is_owned = false;
42029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42030 InitFeatures_set_basic_mpp_required(&this_arg_conv);
42033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42034 LDKInitFeatures this_arg_conv;
42035 this_arg_conv.inner = (void*)(this_arg & (~1));
42036 this_arg_conv.is_owned = false;
42037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42038 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
42042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42043 LDKNodeFeatures this_arg_conv;
42044 this_arg_conv.inner = (void*)(this_arg & (~1));
42045 this_arg_conv.is_owned = false;
42046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42047 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
42050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42051 LDKNodeFeatures this_arg_conv;
42052 this_arg_conv.inner = (void*)(this_arg & (~1));
42053 this_arg_conv.is_owned = false;
42054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42055 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
42058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42059 LDKNodeFeatures this_arg_conv;
42060 this_arg_conv.inner = (void*)(this_arg & (~1));
42061 this_arg_conv.is_owned = false;
42062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42063 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
42067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42068 LDKInvoiceFeatures this_arg_conv;
42069 this_arg_conv.inner = (void*)(this_arg & (~1));
42070 this_arg_conv.is_owned = false;
42071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42072 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
42075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42076 LDKInvoiceFeatures this_arg_conv;
42077 this_arg_conv.inner = (void*)(this_arg & (~1));
42078 this_arg_conv.is_owned = false;
42079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42080 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
42083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42084 LDKInvoiceFeatures this_arg_conv;
42085 this_arg_conv.inner = (void*)(this_arg & (~1));
42086 this_arg_conv.is_owned = false;
42087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42088 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
42092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42093 LDKInitFeatures this_arg_conv;
42094 this_arg_conv.inner = (void*)(this_arg & (~1));
42095 this_arg_conv.is_owned = false;
42096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42097 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
42101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42102 LDKNodeFeatures this_arg_conv;
42103 this_arg_conv.inner = (void*)(this_arg & (~1));
42104 this_arg_conv.is_owned = false;
42105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42106 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
42110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42111 LDKInvoiceFeatures this_arg_conv;
42112 this_arg_conv.inner = (void*)(this_arg & (~1));
42113 this_arg_conv.is_owned = false;
42114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42115 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
42119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42120 LDKInitFeatures this_arg_conv;
42121 this_arg_conv.inner = (void*)(this_arg & (~1));
42122 this_arg_conv.is_owned = false;
42123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42124 InitFeatures_set_wumbo_optional(&this_arg_conv);
42127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42128 LDKInitFeatures this_arg_conv;
42129 this_arg_conv.inner = (void*)(this_arg & (~1));
42130 this_arg_conv.is_owned = false;
42131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42132 InitFeatures_set_wumbo_required(&this_arg_conv);
42135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42136 LDKInitFeatures this_arg_conv;
42137 this_arg_conv.inner = (void*)(this_arg & (~1));
42138 this_arg_conv.is_owned = false;
42139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42140 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
42144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42145 LDKNodeFeatures this_arg_conv;
42146 this_arg_conv.inner = (void*)(this_arg & (~1));
42147 this_arg_conv.is_owned = false;
42148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42149 NodeFeatures_set_wumbo_optional(&this_arg_conv);
42152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42153 LDKNodeFeatures this_arg_conv;
42154 this_arg_conv.inner = (void*)(this_arg & (~1));
42155 this_arg_conv.is_owned = false;
42156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42157 NodeFeatures_set_wumbo_required(&this_arg_conv);
42160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42161 LDKNodeFeatures this_arg_conv;
42162 this_arg_conv.inner = (void*)(this_arg & (~1));
42163 this_arg_conv.is_owned = false;
42164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42165 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
42169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42170 LDKInitFeatures this_arg_conv;
42171 this_arg_conv.inner = (void*)(this_arg & (~1));
42172 this_arg_conv.is_owned = false;
42173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42174 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
42178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42179 LDKNodeFeatures this_arg_conv;
42180 this_arg_conv.inner = (void*)(this_arg & (~1));
42181 this_arg_conv.is_owned = false;
42182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42183 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
42187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42188 LDKInitFeatures this_arg_conv;
42189 this_arg_conv.inner = (void*)(this_arg & (~1));
42190 this_arg_conv.is_owned = false;
42191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42192 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42196 LDKInitFeatures this_arg_conv;
42197 this_arg_conv.inner = (void*)(this_arg & (~1));
42198 this_arg_conv.is_owned = false;
42199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42200 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42204 LDKInitFeatures this_arg_conv;
42205 this_arg_conv.inner = (void*)(this_arg & (~1));
42206 this_arg_conv.is_owned = false;
42207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42208 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42213 LDKNodeFeatures this_arg_conv;
42214 this_arg_conv.inner = (void*)(this_arg & (~1));
42215 this_arg_conv.is_owned = false;
42216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42217 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42221 LDKNodeFeatures this_arg_conv;
42222 this_arg_conv.inner = (void*)(this_arg & (~1));
42223 this_arg_conv.is_owned = false;
42224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42225 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42229 LDKNodeFeatures this_arg_conv;
42230 this_arg_conv.inner = (void*)(this_arg & (~1));
42231 this_arg_conv.is_owned = false;
42232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42233 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42238 LDKInitFeatures this_arg_conv;
42239 this_arg_conv.inner = (void*)(this_arg & (~1));
42240 this_arg_conv.is_owned = false;
42241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42242 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42247 LDKNodeFeatures this_arg_conv;
42248 this_arg_conv.inner = (void*)(this_arg & (~1));
42249 this_arg_conv.is_owned = false;
42250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42251 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42256 LDKInitFeatures this_arg_conv;
42257 this_arg_conv.inner = (void*)(this_arg & (~1));
42258 this_arg_conv.is_owned = false;
42259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42260 InitFeatures_set_channel_type_optional(&this_arg_conv);
42263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42264 LDKInitFeatures this_arg_conv;
42265 this_arg_conv.inner = (void*)(this_arg & (~1));
42266 this_arg_conv.is_owned = false;
42267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42268 InitFeatures_set_channel_type_required(&this_arg_conv);
42271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42272 LDKInitFeatures this_arg_conv;
42273 this_arg_conv.inner = (void*)(this_arg & (~1));
42274 this_arg_conv.is_owned = false;
42275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42276 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
42280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42281 LDKNodeFeatures this_arg_conv;
42282 this_arg_conv.inner = (void*)(this_arg & (~1));
42283 this_arg_conv.is_owned = false;
42284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42285 NodeFeatures_set_channel_type_optional(&this_arg_conv);
42288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42289 LDKNodeFeatures this_arg_conv;
42290 this_arg_conv.inner = (void*)(this_arg & (~1));
42291 this_arg_conv.is_owned = false;
42292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42293 NodeFeatures_set_channel_type_required(&this_arg_conv);
42296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42297 LDKNodeFeatures this_arg_conv;
42298 this_arg_conv.inner = (void*)(this_arg & (~1));
42299 this_arg_conv.is_owned = false;
42300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42301 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
42305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42306 LDKInitFeatures this_arg_conv;
42307 this_arg_conv.inner = (void*)(this_arg & (~1));
42308 this_arg_conv.is_owned = false;
42309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42310 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
42314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42315 LDKNodeFeatures this_arg_conv;
42316 this_arg_conv.inner = (void*)(this_arg & (~1));
42317 this_arg_conv.is_owned = false;
42318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42319 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
42323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42324 LDKInitFeatures this_arg_conv;
42325 this_arg_conv.inner = (void*)(this_arg & (~1));
42326 this_arg_conv.is_owned = false;
42327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42328 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42332 LDKInitFeatures this_arg_conv;
42333 this_arg_conv.inner = (void*)(this_arg & (~1));
42334 this_arg_conv.is_owned = false;
42335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42336 InitFeatures_set_scid_privacy_required(&this_arg_conv);
42339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42340 LDKInitFeatures this_arg_conv;
42341 this_arg_conv.inner = (void*)(this_arg & (~1));
42342 this_arg_conv.is_owned = false;
42343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42344 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42349 LDKNodeFeatures this_arg_conv;
42350 this_arg_conv.inner = (void*)(this_arg & (~1));
42351 this_arg_conv.is_owned = false;
42352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42353 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42357 LDKNodeFeatures this_arg_conv;
42358 this_arg_conv.inner = (void*)(this_arg & (~1));
42359 this_arg_conv.is_owned = false;
42360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42361 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42365 LDKNodeFeatures this_arg_conv;
42366 this_arg_conv.inner = (void*)(this_arg & (~1));
42367 this_arg_conv.is_owned = false;
42368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42369 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42374 LDKChannelTypeFeatures this_arg_conv;
42375 this_arg_conv.inner = (void*)(this_arg & (~1));
42376 this_arg_conv.is_owned = false;
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42378 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42382 LDKChannelTypeFeatures this_arg_conv;
42383 this_arg_conv.inner = (void*)(this_arg & (~1));
42384 this_arg_conv.is_owned = false;
42385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42386 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42390 LDKChannelTypeFeatures this_arg_conv;
42391 this_arg_conv.inner = (void*)(this_arg & (~1));
42392 this_arg_conv.is_owned = false;
42393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42394 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42399 LDKInitFeatures this_arg_conv;
42400 this_arg_conv.inner = (void*)(this_arg & (~1));
42401 this_arg_conv.is_owned = false;
42402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42403 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42408 LDKNodeFeatures this_arg_conv;
42409 this_arg_conv.inner = (void*)(this_arg & (~1));
42410 this_arg_conv.is_owned = false;
42411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42412 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42417 LDKChannelTypeFeatures this_arg_conv;
42418 this_arg_conv.inner = (void*)(this_arg & (~1));
42419 this_arg_conv.is_owned = false;
42420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42421 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42426 LDKInitFeatures this_arg_conv;
42427 this_arg_conv.inner = (void*)(this_arg & (~1));
42428 this_arg_conv.is_owned = false;
42429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42430 InitFeatures_set_zero_conf_optional(&this_arg_conv);
42433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42434 LDKInitFeatures this_arg_conv;
42435 this_arg_conv.inner = (void*)(this_arg & (~1));
42436 this_arg_conv.is_owned = false;
42437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42438 InitFeatures_set_zero_conf_required(&this_arg_conv);
42441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42442 LDKInitFeatures this_arg_conv;
42443 this_arg_conv.inner = (void*)(this_arg & (~1));
42444 this_arg_conv.is_owned = false;
42445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42446 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42451 LDKNodeFeatures this_arg_conv;
42452 this_arg_conv.inner = (void*)(this_arg & (~1));
42453 this_arg_conv.is_owned = false;
42454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42455 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42459 LDKNodeFeatures this_arg_conv;
42460 this_arg_conv.inner = (void*)(this_arg & (~1));
42461 this_arg_conv.is_owned = false;
42462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42463 NodeFeatures_set_zero_conf_required(&this_arg_conv);
42466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42467 LDKNodeFeatures this_arg_conv;
42468 this_arg_conv.inner = (void*)(this_arg & (~1));
42469 this_arg_conv.is_owned = false;
42470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42471 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42476 LDKChannelTypeFeatures this_arg_conv;
42477 this_arg_conv.inner = (void*)(this_arg & (~1));
42478 this_arg_conv.is_owned = false;
42479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42480 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42484 LDKChannelTypeFeatures this_arg_conv;
42485 this_arg_conv.inner = (void*)(this_arg & (~1));
42486 this_arg_conv.is_owned = false;
42487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42488 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42492 LDKChannelTypeFeatures this_arg_conv;
42493 this_arg_conv.inner = (void*)(this_arg & (~1));
42494 this_arg_conv.is_owned = false;
42495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42496 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42501 LDKInitFeatures this_arg_conv;
42502 this_arg_conv.inner = (void*)(this_arg & (~1));
42503 this_arg_conv.is_owned = false;
42504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42505 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42510 LDKNodeFeatures this_arg_conv;
42511 this_arg_conv.inner = (void*)(this_arg & (~1));
42512 this_arg_conv.is_owned = false;
42513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42514 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42519 LDKChannelTypeFeatures this_arg_conv;
42520 this_arg_conv.inner = (void*)(this_arg & (~1));
42521 this_arg_conv.is_owned = false;
42522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42523 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42528 LDKNodeFeatures this_arg_conv;
42529 this_arg_conv.inner = (void*)(this_arg & (~1));
42530 this_arg_conv.is_owned = false;
42531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42532 NodeFeatures_set_keysend_optional(&this_arg_conv);
42535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42536 LDKNodeFeatures this_arg_conv;
42537 this_arg_conv.inner = (void*)(this_arg & (~1));
42538 this_arg_conv.is_owned = false;
42539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42540 NodeFeatures_set_keysend_required(&this_arg_conv);
42543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
42544 LDKNodeFeatures this_arg_conv;
42545 this_arg_conv.inner = (void*)(this_arg & (~1));
42546 this_arg_conv.is_owned = false;
42547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42548 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
42553 LDKNodeFeatures this_arg_conv;
42554 this_arg_conv.inner = (void*)(this_arg & (~1));
42555 this_arg_conv.is_owned = false;
42556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42557 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42562 LDKShutdownScript this_obj_conv;
42563 this_obj_conv.inner = (void*)(this_obj & (~1));
42564 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42566 ShutdownScript_free(this_obj_conv);
42569 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42570 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42571 int64_t ret_ref = 0;
42572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42575 ret_ref = (uintptr_t)ret_var.inner;
42576 if (ret_var.is_owned) {
42581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42582 LDKShutdownScript arg_conv;
42583 arg_conv.inner = (void*)(arg & (~1));
42584 arg_conv.is_owned = false;
42585 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42586 int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42591 LDKShutdownScript orig_conv;
42592 orig_conv.inner = (void*)(orig & (~1));
42593 orig_conv.is_owned = false;
42594 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42595 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42596 int64_t ret_ref = 0;
42597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42600 ret_ref = (uintptr_t)ret_var.inner;
42601 if (ret_var.is_owned) {
42607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42608 LDKInvalidShutdownScript this_obj_conv;
42609 this_obj_conv.inner = (void*)(this_obj & (~1));
42610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42612 InvalidShutdownScript_free(this_obj_conv);
42615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
42616 LDKInvalidShutdownScript this_ptr_conv;
42617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42618 this_ptr_conv.is_owned = false;
42619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42620 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42621 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42622 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42627 LDKInvalidShutdownScript this_ptr_conv;
42628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42629 this_ptr_conv.is_owned = false;
42630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42631 LDKCVec_u8Z val_ref;
42632 val_ref.datalen = (*env)->GetArrayLength(env, val);
42633 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42634 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
42635 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
42639 LDKCVec_u8Z script_arg_ref;
42640 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
42641 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42642 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
42643 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42644 int64_t ret_ref = 0;
42645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42648 ret_ref = (uintptr_t)ret_var.inner;
42649 if (ret_var.is_owned) {
42655 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42656 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42657 int64_t ret_ref = 0;
42658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42661 ret_ref = (uintptr_t)ret_var.inner;
42662 if (ret_var.is_owned) {
42667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42668 LDKInvalidShutdownScript arg_conv;
42669 arg_conv.inner = (void*)(arg & (~1));
42670 arg_conv.is_owned = false;
42671 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42672 int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42677 LDKInvalidShutdownScript orig_conv;
42678 orig_conv.inner = (void*)(orig & (~1));
42679 orig_conv.is_owned = false;
42680 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42681 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
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) {
42693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
42694 LDKShutdownScript obj_conv;
42695 obj_conv.inner = (void*)(obj & (~1));
42696 obj_conv.is_owned = false;
42697 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42698 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42701 CVec_u8Z_free(ret_var);
42705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42706 LDKu8slice ser_ref;
42707 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42708 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42709 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42710 *ret_conv = ShutdownScript_read(ser_ref);
42711 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42712 return (int64_t)ret_conv;
42715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
42716 unsigned char pubkey_hash_arr[20];
42717 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
42718 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
42719 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42720 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42721 int64_t ret_ref = 0;
42722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42725 ret_ref = (uintptr_t)ret_var.inner;
42726 if (ret_var.is_owned) {
42732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
42733 unsigned char script_hash_arr[32];
42734 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
42735 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
42736 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
42737 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42738 int64_t ret_ref = 0;
42739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42742 ret_ref = (uintptr_t)ret_var.inner;
42743 if (ret_var.is_owned) {
42749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
42751 LDKu8slice program_ref;
42752 program_ref.datalen = (*env)->GetArrayLength(env, program);
42753 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
42754 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42755 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42756 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
42757 return (int64_t)ret_conv;
42760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
42761 LDKShutdownScript this_arg_conv;
42762 this_arg_conv.inner = (void*)(this_arg & (~1));
42763 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42765 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42766 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42767 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42768 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42769 CVec_u8Z_free(ret_var);
42773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
42774 LDKShutdownScript this_arg_conv;
42775 this_arg_conv.inner = (void*)(this_arg & (~1));
42776 this_arg_conv.is_owned = false;
42777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42778 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
42783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
42784 LDKShutdownScript this_arg_conv;
42785 this_arg_conv.inner = (void*)(this_arg & (~1));
42786 this_arg_conv.is_owned = false;
42787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42788 LDKInitFeatures features_conv;
42789 features_conv.inner = (void*)(features & (~1));
42790 features_conv.is_owned = false;
42791 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42792 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42797 if ((this_ptr & 1) != 0) return;
42798 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42799 CHECK_ACCESS(this_ptr_ptr);
42800 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42801 FREE((void*)this_ptr);
42802 CustomMessageReader_free(this_ptr_conv);
42805 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42806 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42807 *ret_ret = Type_clone(arg);
42808 return (int64_t)ret_ret;
42810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42811 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
42812 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
42813 LDKType* arg_conv = (LDKType*)arg_ptr;
42814 int64_t ret_conv = Type_clone_ptr(arg_conv);
42818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42819 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
42820 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
42821 LDKType* orig_conv = (LDKType*)orig_ptr;
42822 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42823 *ret_ret = Type_clone(orig_conv);
42824 return (int64_t)ret_ret;
42827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42828 if ((this_ptr & 1) != 0) return;
42829 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42830 CHECK_ACCESS(this_ptr_ptr);
42831 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42832 FREE((void*)this_ptr);
42833 Type_free(this_ptr_conv);
42836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42837 LDKNodeId this_obj_conv;
42838 this_obj_conv.inner = (void*)(this_obj & (~1));
42839 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42841 NodeId_free(this_obj_conv);
42844 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
42845 LDKNodeId ret_var = NodeId_clone(arg);
42846 int64_t ret_ref = 0;
42847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42850 ret_ref = (uintptr_t)ret_var.inner;
42851 if (ret_var.is_owned) {
42856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42857 LDKNodeId arg_conv;
42858 arg_conv.inner = (void*)(arg & (~1));
42859 arg_conv.is_owned = false;
42860 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42861 int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
42865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42866 LDKNodeId orig_conv;
42867 orig_conv.inner = (void*)(orig & (~1));
42868 orig_conv.is_owned = false;
42869 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42870 LDKNodeId ret_var = NodeId_clone(&orig_conv);
42871 int64_t ret_ref = 0;
42872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42875 ret_ref = (uintptr_t)ret_var.inner;
42876 if (ret_var.is_owned) {
42882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
42883 LDKPublicKey pubkey_ref;
42884 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
42885 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
42886 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
42887 int64_t ret_ref = 0;
42888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42891 ret_ref = (uintptr_t)ret_var.inner;
42892 if (ret_var.is_owned) {
42898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
42899 LDKNodeId this_arg_conv;
42900 this_arg_conv.inner = (void*)(this_arg & (~1));
42901 this_arg_conv.is_owned = false;
42902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42903 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
42904 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42905 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
42911 o_conv.inner = (void*)(o & (~1));
42912 o_conv.is_owned = false;
42913 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42914 int64_t ret_conv = NodeId_hash(&o_conv);
42918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
42919 LDKNodeId obj_conv;
42920 obj_conv.inner = (void*)(obj & (~1));
42921 obj_conv.is_owned = false;
42922 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42923 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
42924 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42925 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42926 CVec_u8Z_free(ret_var);
42930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42931 LDKu8slice ser_ref;
42932 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42933 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42934 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
42935 *ret_conv = NodeId_read(ser_ref);
42936 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42937 return (int64_t)ret_conv;
42940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42941 LDKNetworkGraph this_obj_conv;
42942 this_obj_conv.inner = (void*)(this_obj & (~1));
42943 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42945 NetworkGraph_free(this_obj_conv);
42948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42949 LDKReadOnlyNetworkGraph this_obj_conv;
42950 this_obj_conv.inner = (void*)(this_obj & (~1));
42951 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42953 ReadOnlyNetworkGraph_free(this_obj_conv);
42956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42957 if ((this_ptr & 1) != 0) return;
42958 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42959 CHECK_ACCESS(this_ptr_ptr);
42960 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
42961 FREE((void*)this_ptr);
42962 NetworkUpdate_free(this_ptr_conv);
42965 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
42966 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42967 *ret_copy = NetworkUpdate_clone(arg);
42968 int64_t ret_ref = (uintptr_t)ret_copy;
42971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42972 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
42973 int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
42977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42978 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
42979 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42980 *ret_copy = NetworkUpdate_clone(orig_conv);
42981 int64_t ret_ref = (uintptr_t)ret_copy;
42985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
42986 LDKChannelUpdate msg_conv;
42987 msg_conv.inner = (void*)(msg & (~1));
42988 msg_conv.is_owned = (msg & 1) || (msg == 0);
42989 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42990 msg_conv = ChannelUpdate_clone(&msg_conv);
42991 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42992 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
42993 int64_t ret_ref = (uintptr_t)ret_copy;
42997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
42998 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42999 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
43000 int64_t ret_ref = (uintptr_t)ret_copy;
43004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
43005 LDKPublicKey node_id_ref;
43006 CHECK((*env)->GetArrayLength(env, node_id) == 33);
43007 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
43008 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43009 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
43010 int64_t ret_ref = (uintptr_t)ret_copy;
43014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
43015 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
43016 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
43017 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43018 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43019 CVec_u8Z_free(ret_var);
43023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43024 LDKu8slice ser_ref;
43025 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43026 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43027 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
43028 *ret_conv = NetworkUpdate_read(ser_ref);
43029 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43030 return (int64_t)ret_conv;
43033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43034 LDKP2PGossipSync this_obj_conv;
43035 this_obj_conv.inner = (void*)(this_obj & (~1));
43036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43038 P2PGossipSync_free(this_obj_conv);
43041 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) {
43042 LDKNetworkGraph network_graph_conv;
43043 network_graph_conv.inner = (void*)(network_graph & (~1));
43044 network_graph_conv.is_owned = false;
43045 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43046 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43047 CHECK_ACCESS(chain_access_ptr);
43048 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43049 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43050 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43051 // Manually implement clone for Java trait instances
43052 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43053 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43054 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43057 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43058 CHECK_ACCESS(logger_ptr);
43059 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43060 if (logger_conv.free == LDKLogger_JCalls_free) {
43061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43062 LDKLogger_JCalls_cloned(&logger_conv);
43064 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
43065 int64_t ret_ref = 0;
43066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43069 ret_ref = (uintptr_t)ret_var.inner;
43070 if (ret_var.is_owned) {
43076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
43077 LDKP2PGossipSync this_arg_conv;
43078 this_arg_conv.inner = (void*)(this_arg & (~1));
43079 this_arg_conv.is_owned = false;
43080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43081 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43082 CHECK_ACCESS(chain_access_ptr);
43083 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43084 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43085 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43086 // Manually implement clone for Java trait instances
43087 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43088 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43089 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43092 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
43095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43096 LDKNetworkGraph this_arg_conv;
43097 this_arg_conv.inner = (void*)(this_arg & (~1));
43098 this_arg_conv.is_owned = false;
43099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43100 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43101 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
43102 return (int64_t)ret_ret;
43105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43106 LDKP2PGossipSync this_arg_conv;
43107 this_arg_conv.inner = (void*)(this_arg & (~1));
43108 this_arg_conv.is_owned = false;
43109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43110 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43111 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
43112 return (int64_t)ret_ret;
43115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
43116 LDKP2PGossipSync this_arg_conv;
43117 this_arg_conv.inner = (void*)(this_arg & (~1));
43118 this_arg_conv.is_owned = false;
43119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43120 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43121 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
43122 return (int64_t)ret_ret;
43125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43126 LDKChannelUpdateInfo this_obj_conv;
43127 this_obj_conv.inner = (void*)(this_obj & (~1));
43128 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43130 ChannelUpdateInfo_free(this_obj_conv);
43133 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
43134 LDKChannelUpdateInfo this_ptr_conv;
43135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43136 this_ptr_conv.is_owned = false;
43137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43138 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
43142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43143 LDKChannelUpdateInfo this_ptr_conv;
43144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43145 this_ptr_conv.is_owned = false;
43146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43147 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
43150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
43151 LDKChannelUpdateInfo this_ptr_conv;
43152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43153 this_ptr_conv.is_owned = false;
43154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43155 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
43159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43160 LDKChannelUpdateInfo this_ptr_conv;
43161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43162 this_ptr_conv.is_owned = false;
43163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43164 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
43167 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43168 LDKChannelUpdateInfo this_ptr_conv;
43169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43170 this_ptr_conv.is_owned = false;
43171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43172 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
43176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43177 LDKChannelUpdateInfo this_ptr_conv;
43178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43179 this_ptr_conv.is_owned = false;
43180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43181 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
43184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43185 LDKChannelUpdateInfo this_ptr_conv;
43186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43187 this_ptr_conv.is_owned = false;
43188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43189 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
43193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43194 LDKChannelUpdateInfo this_ptr_conv;
43195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43196 this_ptr_conv.is_owned = false;
43197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43202 LDKChannelUpdateInfo this_ptr_conv;
43203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43204 this_ptr_conv.is_owned = false;
43205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43206 int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
43210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43211 LDKChannelUpdateInfo this_ptr_conv;
43212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43213 this_ptr_conv.is_owned = false;
43214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43215 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
43219 LDKChannelUpdateInfo this_ptr_conv;
43220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43221 this_ptr_conv.is_owned = false;
43222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43223 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
43224 int64_t ret_ref = 0;
43225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43228 ret_ref = (uintptr_t)ret_var.inner;
43229 if (ret_var.is_owned) {
43235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43236 LDKChannelUpdateInfo this_ptr_conv;
43237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43238 this_ptr_conv.is_owned = false;
43239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43240 LDKRoutingFees val_conv;
43241 val_conv.inner = (void*)(val & (~1));
43242 val_conv.is_owned = (val & 1) || (val == 0);
43243 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43244 val_conv = RoutingFees_clone(&val_conv);
43245 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
43248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43249 LDKChannelUpdateInfo this_ptr_conv;
43250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43251 this_ptr_conv.is_owned = false;
43252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43253 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
43254 int64_t ret_ref = 0;
43255 if ((uintptr_t)ret_var.inner > 4096) {
43256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43259 ret_ref = (uintptr_t)ret_var.inner;
43260 if (ret_var.is_owned) {
43267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43268 LDKChannelUpdateInfo this_ptr_conv;
43269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43270 this_ptr_conv.is_owned = false;
43271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43272 LDKChannelUpdate val_conv;
43273 val_conv.inner = (void*)(val & (~1));
43274 val_conv.is_owned = (val & 1) || (val == 0);
43275 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43276 val_conv = ChannelUpdate_clone(&val_conv);
43277 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
43280 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) {
43281 LDKRoutingFees fees_arg_conv;
43282 fees_arg_conv.inner = (void*)(fees_arg & (~1));
43283 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
43284 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43285 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43286 LDKChannelUpdate last_update_message_arg_conv;
43287 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
43288 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
43289 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
43290 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
43291 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
43292 int64_t ret_ref = 0;
43293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43296 ret_ref = (uintptr_t)ret_var.inner;
43297 if (ret_var.is_owned) {
43303 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
43304 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
43305 int64_t ret_ref = 0;
43306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43309 ret_ref = (uintptr_t)ret_var.inner;
43310 if (ret_var.is_owned) {
43315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43316 LDKChannelUpdateInfo arg_conv;
43317 arg_conv.inner = (void*)(arg & (~1));
43318 arg_conv.is_owned = false;
43319 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43320 int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
43324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43325 LDKChannelUpdateInfo orig_conv;
43326 orig_conv.inner = (void*)(orig & (~1));
43327 orig_conv.is_owned = false;
43328 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43329 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
43330 int64_t ret_ref = 0;
43331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43334 ret_ref = (uintptr_t)ret_var.inner;
43335 if (ret_var.is_owned) {
43341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43342 LDKChannelUpdateInfo obj_conv;
43343 obj_conv.inner = (void*)(obj & (~1));
43344 obj_conv.is_owned = false;
43345 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43346 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
43347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43349 CVec_u8Z_free(ret_var);
43353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43354 LDKu8slice ser_ref;
43355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43357 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
43358 *ret_conv = ChannelUpdateInfo_read(ser_ref);
43359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43360 return (int64_t)ret_conv;
43363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43364 LDKChannelInfo this_obj_conv;
43365 this_obj_conv.inner = (void*)(this_obj & (~1));
43366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43368 ChannelInfo_free(this_obj_conv);
43371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43372 LDKChannelInfo this_ptr_conv;
43373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43374 this_ptr_conv.is_owned = false;
43375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43376 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
43377 int64_t ret_ref = 0;
43378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43381 ret_ref = (uintptr_t)ret_var.inner;
43382 if (ret_var.is_owned) {
43388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43389 LDKChannelInfo this_ptr_conv;
43390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43391 this_ptr_conv.is_owned = false;
43392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43393 LDKChannelFeatures val_conv;
43394 val_conv.inner = (void*)(val & (~1));
43395 val_conv.is_owned = (val & 1) || (val == 0);
43396 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43397 val_conv = ChannelFeatures_clone(&val_conv);
43398 ChannelInfo_set_features(&this_ptr_conv, val_conv);
43401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43402 LDKChannelInfo this_ptr_conv;
43403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43404 this_ptr_conv.is_owned = false;
43405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43406 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
43407 int64_t ret_ref = 0;
43408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43411 ret_ref = (uintptr_t)ret_var.inner;
43412 if (ret_var.is_owned) {
43418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43419 LDKChannelInfo this_ptr_conv;
43420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43421 this_ptr_conv.is_owned = false;
43422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43423 LDKNodeId val_conv;
43424 val_conv.inner = (void*)(val & (~1));
43425 val_conv.is_owned = (val & 1) || (val == 0);
43426 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43427 val_conv = NodeId_clone(&val_conv);
43428 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
43431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43432 LDKChannelInfo this_ptr_conv;
43433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43434 this_ptr_conv.is_owned = false;
43435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43436 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
43437 int64_t ret_ref = 0;
43438 if ((uintptr_t)ret_var.inner > 4096) {
43439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43442 ret_ref = (uintptr_t)ret_var.inner;
43443 if (ret_var.is_owned) {
43450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43451 LDKChannelInfo this_ptr_conv;
43452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43453 this_ptr_conv.is_owned = false;
43454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43455 LDKChannelUpdateInfo val_conv;
43456 val_conv.inner = (void*)(val & (~1));
43457 val_conv.is_owned = (val & 1) || (val == 0);
43458 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43459 val_conv = ChannelUpdateInfo_clone(&val_conv);
43460 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
43463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43464 LDKChannelInfo this_ptr_conv;
43465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43466 this_ptr_conv.is_owned = false;
43467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43468 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
43469 int64_t ret_ref = 0;
43470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43473 ret_ref = (uintptr_t)ret_var.inner;
43474 if (ret_var.is_owned) {
43480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43481 LDKChannelInfo this_ptr_conv;
43482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43483 this_ptr_conv.is_owned = false;
43484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43485 LDKNodeId val_conv;
43486 val_conv.inner = (void*)(val & (~1));
43487 val_conv.is_owned = (val & 1) || (val == 0);
43488 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43489 val_conv = NodeId_clone(&val_conv);
43490 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
43493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43494 LDKChannelInfo this_ptr_conv;
43495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43496 this_ptr_conv.is_owned = false;
43497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43498 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
43499 int64_t ret_ref = 0;
43500 if ((uintptr_t)ret_var.inner > 4096) {
43501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43504 ret_ref = (uintptr_t)ret_var.inner;
43505 if (ret_var.is_owned) {
43512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43513 LDKChannelInfo this_ptr_conv;
43514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43515 this_ptr_conv.is_owned = false;
43516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43517 LDKChannelUpdateInfo val_conv;
43518 val_conv.inner = (void*)(val & (~1));
43519 val_conv.is_owned = (val & 1) || (val == 0);
43520 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43521 val_conv = ChannelUpdateInfo_clone(&val_conv);
43522 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
43525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
43526 LDKChannelInfo 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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43531 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
43532 int64_t ret_ref = (uintptr_t)ret_copy;
43536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43537 LDKChannelInfo this_ptr_conv;
43538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43539 this_ptr_conv.is_owned = false;
43540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43541 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
43542 CHECK_ACCESS(val_ptr);
43543 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43544 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
43545 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
43548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43549 LDKChannelInfo this_ptr_conv;
43550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43551 this_ptr_conv.is_owned = false;
43552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43553 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
43554 int64_t ret_ref = 0;
43555 if ((uintptr_t)ret_var.inner > 4096) {
43556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43559 ret_ref = (uintptr_t)ret_var.inner;
43560 if (ret_var.is_owned) {
43567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43568 LDKChannelInfo this_ptr_conv;
43569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43570 this_ptr_conv.is_owned = false;
43571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43572 LDKChannelAnnouncement val_conv;
43573 val_conv.inner = (void*)(val & (~1));
43574 val_conv.is_owned = (val & 1) || (val == 0);
43575 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43576 val_conv = ChannelAnnouncement_clone(&val_conv);
43577 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
43580 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
43581 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
43582 int64_t ret_ref = 0;
43583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43586 ret_ref = (uintptr_t)ret_var.inner;
43587 if (ret_var.is_owned) {
43592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43593 LDKChannelInfo arg_conv;
43594 arg_conv.inner = (void*)(arg & (~1));
43595 arg_conv.is_owned = false;
43596 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43597 int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
43601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43602 LDKChannelInfo orig_conv;
43603 orig_conv.inner = (void*)(orig & (~1));
43604 orig_conv.is_owned = false;
43605 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43606 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
43607 int64_t ret_ref = 0;
43608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43611 ret_ref = (uintptr_t)ret_var.inner;
43612 if (ret_var.is_owned) {
43618 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) {
43619 LDKChannelInfo this_arg_conv;
43620 this_arg_conv.inner = (void*)(this_arg & (~1));
43621 this_arg_conv.is_owned = false;
43622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43623 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
43624 int64_t ret_ref = 0;
43625 if ((uintptr_t)ret_var.inner > 4096) {
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) {
43637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43638 LDKChannelInfo obj_conv;
43639 obj_conv.inner = (void*)(obj & (~1));
43640 obj_conv.is_owned = false;
43641 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43642 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
43643 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43644 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43645 CVec_u8Z_free(ret_var);
43649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43650 LDKu8slice ser_ref;
43651 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43652 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43653 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
43654 *ret_conv = ChannelInfo_read(ser_ref);
43655 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43656 return (int64_t)ret_conv;
43659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43660 LDKDirectedChannelInfo this_obj_conv;
43661 this_obj_conv.inner = (void*)(this_obj & (~1));
43662 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43664 DirectedChannelInfo_free(this_obj_conv);
43667 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
43668 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
43669 int64_t ret_ref = 0;
43670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43673 ret_ref = (uintptr_t)ret_var.inner;
43674 if (ret_var.is_owned) {
43679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43680 LDKDirectedChannelInfo arg_conv;
43681 arg_conv.inner = (void*)(arg & (~1));
43682 arg_conv.is_owned = false;
43683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43684 int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
43688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43689 LDKDirectedChannelInfo orig_conv;
43690 orig_conv.inner = (void*)(orig & (~1));
43691 orig_conv.is_owned = false;
43692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43693 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
43694 int64_t ret_ref = 0;
43695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43698 ret_ref = (uintptr_t)ret_var.inner;
43699 if (ret_var.is_owned) {
43705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
43706 LDKDirectedChannelInfo this_arg_conv;
43707 this_arg_conv.inner = (void*)(this_arg & (~1));
43708 this_arg_conv.is_owned = false;
43709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43710 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
43711 int64_t ret_ref = 0;
43712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43715 ret_ref = (uintptr_t)ret_var.inner;
43716 if (ret_var.is_owned) {
43722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
43723 LDKDirectedChannelInfo this_arg_conv;
43724 this_arg_conv.inner = (void*)(this_arg & (~1));
43725 this_arg_conv.is_owned = false;
43726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43727 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
43728 int64_t ret_ref = 0;
43729 if ((uintptr_t)ret_var.inner > 4096) {
43730 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43731 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43733 ret_ref = (uintptr_t)ret_var.inner;
43734 if (ret_var.is_owned) {
43741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
43742 LDKDirectedChannelInfo this_arg_conv;
43743 this_arg_conv.inner = (void*)(this_arg & (~1));
43744 this_arg_conv.is_owned = false;
43745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43746 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
43750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
43751 LDKDirectedChannelInfo this_arg_conv;
43752 this_arg_conv.inner = (void*)(this_arg & (~1));
43753 this_arg_conv.is_owned = false;
43754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43755 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43756 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
43757 int64_t ret_ref = (uintptr_t)ret_copy;
43761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43762 if ((this_ptr & 1) != 0) return;
43763 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43764 CHECK_ACCESS(this_ptr_ptr);
43765 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
43766 FREE((void*)this_ptr);
43767 EffectiveCapacity_free(this_ptr_conv);
43770 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
43771 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43772 *ret_copy = EffectiveCapacity_clone(arg);
43773 int64_t ret_ref = (uintptr_t)ret_copy;
43776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43777 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
43778 int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
43782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43783 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
43784 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43785 *ret_copy = EffectiveCapacity_clone(orig_conv);
43786 int64_t ret_ref = (uintptr_t)ret_copy;
43790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
43791 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43792 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
43793 int64_t ret_ref = (uintptr_t)ret_copy;
43797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
43798 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43799 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
43800 int64_t ret_ref = (uintptr_t)ret_copy;
43804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
43805 void* htlc_maximum_msat_ptr = (void*)(((uintptr_t)htlc_maximum_msat) & ~1);
43806 CHECK_ACCESS(htlc_maximum_msat_ptr);
43807 LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
43808 htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat) & ~1));
43809 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43810 *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
43811 int64_t ret_ref = (uintptr_t)ret_copy;
43815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
43816 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43817 *ret_copy = EffectiveCapacity_infinite();
43818 int64_t ret_ref = (uintptr_t)ret_copy;
43822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
43823 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43824 *ret_copy = EffectiveCapacity_unknown();
43825 int64_t ret_ref = (uintptr_t)ret_copy;
43829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
43830 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
43831 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
43835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43836 LDKRoutingFees this_obj_conv;
43837 this_obj_conv.inner = (void*)(this_obj & (~1));
43838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43840 RoutingFees_free(this_obj_conv);
43843 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43844 LDKRoutingFees this_ptr_conv;
43845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43846 this_ptr_conv.is_owned = false;
43847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43848 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
43852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43853 LDKRoutingFees this_ptr_conv;
43854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43855 this_ptr_conv.is_owned = false;
43856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43857 RoutingFees_set_base_msat(&this_ptr_conv, val);
43860 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43861 LDKRoutingFees this_ptr_conv;
43862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43863 this_ptr_conv.is_owned = false;
43864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43865 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
43869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43870 LDKRoutingFees this_ptr_conv;
43871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43872 this_ptr_conv.is_owned = false;
43873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43874 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
43877 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) {
43878 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
43879 int64_t ret_ref = 0;
43880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43883 ret_ref = (uintptr_t)ret_var.inner;
43884 if (ret_var.is_owned) {
43890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43891 LDKRoutingFees a_conv;
43892 a_conv.inner = (void*)(a & (~1));
43893 a_conv.is_owned = false;
43894 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43895 LDKRoutingFees b_conv;
43896 b_conv.inner = (void*)(b & (~1));
43897 b_conv.is_owned = false;
43898 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43899 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
43903 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
43904 LDKRoutingFees ret_var = RoutingFees_clone(arg);
43905 int64_t ret_ref = 0;
43906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43909 ret_ref = (uintptr_t)ret_var.inner;
43910 if (ret_var.is_owned) {
43915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43916 LDKRoutingFees arg_conv;
43917 arg_conv.inner = (void*)(arg & (~1));
43918 arg_conv.is_owned = false;
43919 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43920 int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
43924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43925 LDKRoutingFees orig_conv;
43926 orig_conv.inner = (void*)(orig & (~1));
43927 orig_conv.is_owned = false;
43928 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43929 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
43930 int64_t ret_ref = 0;
43931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43934 ret_ref = (uintptr_t)ret_var.inner;
43935 if (ret_var.is_owned) {
43941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
43942 LDKRoutingFees o_conv;
43943 o_conv.inner = (void*)(o & (~1));
43944 o_conv.is_owned = false;
43945 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43946 int64_t ret_conv = RoutingFees_hash(&o_conv);
43950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
43951 LDKRoutingFees obj_conv;
43952 obj_conv.inner = (void*)(obj & (~1));
43953 obj_conv.is_owned = false;
43954 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43955 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
43956 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43957 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43958 CVec_u8Z_free(ret_var);
43962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43963 LDKu8slice ser_ref;
43964 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43965 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43966 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
43967 *ret_conv = RoutingFees_read(ser_ref);
43968 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43969 return (int64_t)ret_conv;
43972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43973 LDKNodeAnnouncementInfo this_obj_conv;
43974 this_obj_conv.inner = (void*)(this_obj & (~1));
43975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43977 NodeAnnouncementInfo_free(this_obj_conv);
43980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43981 LDKNodeAnnouncementInfo this_ptr_conv;
43982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43983 this_ptr_conv.is_owned = false;
43984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43985 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
43986 int64_t ret_ref = 0;
43987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43990 ret_ref = (uintptr_t)ret_var.inner;
43991 if (ret_var.is_owned) {
43997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43998 LDKNodeAnnouncementInfo this_ptr_conv;
43999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44000 this_ptr_conv.is_owned = false;
44001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44002 LDKNodeFeatures val_conv;
44003 val_conv.inner = (void*)(val & (~1));
44004 val_conv.is_owned = (val & 1) || (val == 0);
44005 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44006 val_conv = NodeFeatures_clone(&val_conv);
44007 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
44010 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
44011 LDKNodeAnnouncementInfo this_ptr_conv;
44012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44013 this_ptr_conv.is_owned = false;
44014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44015 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
44019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44020 LDKNodeAnnouncementInfo this_ptr_conv;
44021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44022 this_ptr_conv.is_owned = false;
44023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44024 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
44027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
44028 LDKNodeAnnouncementInfo this_ptr_conv;
44029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44030 this_ptr_conv.is_owned = false;
44031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44032 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
44033 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
44037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44038 LDKNodeAnnouncementInfo this_ptr_conv;
44039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44040 this_ptr_conv.is_owned = false;
44041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44042 LDKThreeBytes val_ref;
44043 CHECK((*env)->GetArrayLength(env, val) == 3);
44044 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
44045 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
44048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
44049 LDKNodeAnnouncementInfo this_ptr_conv;
44050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44051 this_ptr_conv.is_owned = false;
44052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44053 LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
44054 int64_t ret_ref = 0;
44055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44058 ret_ref = (uintptr_t)ret_var.inner;
44059 if (ret_var.is_owned) {
44065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44066 LDKNodeAnnouncementInfo this_ptr_conv;
44067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44068 this_ptr_conv.is_owned = false;
44069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44070 LDKNodeAlias val_conv;
44071 val_conv.inner = (void*)(val & (~1));
44072 val_conv.is_owned = (val & 1) || (val == 0);
44073 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44074 val_conv = NodeAlias_clone(&val_conv);
44075 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
44078 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
44079 LDKNodeAnnouncementInfo this_ptr_conv;
44080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44081 this_ptr_conv.is_owned = false;
44082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44083 LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
44084 int64_tArray ret_arr = NULL;
44085 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44086 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44087 for (size_t m = 0; m < ret_var.datalen; m++) {
44088 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
44089 *ret_conv_12_copy = ret_var.data[m];
44090 int64_t ret_conv_12_ref = (uintptr_t)ret_conv_12_copy;
44091 ret_arr_ptr[m] = ret_conv_12_ref;
44093 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44094 FREE(ret_var.data);
44098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44099 LDKNodeAnnouncementInfo this_ptr_conv;
44100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44101 this_ptr_conv.is_owned = false;
44102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44103 LDKCVec_NetAddressZ val_constr;
44104 val_constr.datalen = (*env)->GetArrayLength(env, val);
44105 if (val_constr.datalen > 0)
44106 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44108 val_constr.data = NULL;
44109 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44110 for (size_t m = 0; m < val_constr.datalen; m++) {
44111 int64_t val_conv_12 = val_vals[m];
44112 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
44113 CHECK_ACCESS(val_conv_12_ptr);
44114 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
44115 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
44116 val_constr.data[m] = val_conv_12_conv;
44118 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44119 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
44122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
44123 LDKNodeAnnouncementInfo this_ptr_conv;
44124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44125 this_ptr_conv.is_owned = false;
44126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44127 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
44128 int64_t ret_ref = 0;
44129 if ((uintptr_t)ret_var.inner > 4096) {
44130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44133 ret_ref = (uintptr_t)ret_var.inner;
44134 if (ret_var.is_owned) {
44141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44142 LDKNodeAnnouncementInfo this_ptr_conv;
44143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44144 this_ptr_conv.is_owned = false;
44145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44146 LDKNodeAnnouncement val_conv;
44147 val_conv.inner = (void*)(val & (~1));
44148 val_conv.is_owned = (val & 1) || (val == 0);
44149 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44150 val_conv = NodeAnnouncement_clone(&val_conv);
44151 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
44154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
44155 LDKNodeFeatures features_arg_conv;
44156 features_arg_conv.inner = (void*)(features_arg & (~1));
44157 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
44158 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44159 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
44160 LDKThreeBytes rgb_arg_ref;
44161 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
44162 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
44163 LDKNodeAlias alias_arg_conv;
44164 alias_arg_conv.inner = (void*)(alias_arg & (~1));
44165 alias_arg_conv.is_owned = (alias_arg & 1) || (alias_arg == 0);
44166 CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
44167 alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
44168 LDKCVec_NetAddressZ addresses_arg_constr;
44169 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
44170 if (addresses_arg_constr.datalen > 0)
44171 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44173 addresses_arg_constr.data = NULL;
44174 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
44175 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
44176 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
44177 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
44178 CHECK_ACCESS(addresses_arg_conv_12_ptr);
44179 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
44180 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
44182 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
44183 LDKNodeAnnouncement announcement_message_arg_conv;
44184 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
44185 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
44186 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
44187 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
44188 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
44189 int64_t ret_ref = 0;
44190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44193 ret_ref = (uintptr_t)ret_var.inner;
44194 if (ret_var.is_owned) {
44200 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
44201 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
44202 int64_t ret_ref = 0;
44203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44206 ret_ref = (uintptr_t)ret_var.inner;
44207 if (ret_var.is_owned) {
44212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44213 LDKNodeAnnouncementInfo arg_conv;
44214 arg_conv.inner = (void*)(arg & (~1));
44215 arg_conv.is_owned = false;
44216 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44217 int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
44221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44222 LDKNodeAnnouncementInfo orig_conv;
44223 orig_conv.inner = (void*)(orig & (~1));
44224 orig_conv.is_owned = false;
44225 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44226 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
44227 int64_t ret_ref = 0;
44228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44231 ret_ref = (uintptr_t)ret_var.inner;
44232 if (ret_var.is_owned) {
44238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44239 LDKNodeAnnouncementInfo obj_conv;
44240 obj_conv.inner = (void*)(obj & (~1));
44241 obj_conv.is_owned = false;
44242 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44243 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
44244 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44245 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44246 CVec_u8Z_free(ret_var);
44250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44251 LDKu8slice ser_ref;
44252 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44253 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44254 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
44255 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
44256 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44257 return (int64_t)ret_conv;
44260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44261 LDKNodeAlias this_obj_conv;
44262 this_obj_conv.inner = (void*)(this_obj & (~1));
44263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44265 NodeAlias_free(this_obj_conv);
44268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44269 LDKNodeAlias this_ptr_conv;
44270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44271 this_ptr_conv.is_owned = false;
44272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44273 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44274 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
44278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44279 LDKNodeAlias this_ptr_conv;
44280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44281 this_ptr_conv.is_owned = false;
44282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44283 LDKThirtyTwoBytes val_ref;
44284 CHECK((*env)->GetArrayLength(env, val) == 32);
44285 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44286 NodeAlias_set_a(&this_ptr_conv, val_ref);
44289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
44290 LDKThirtyTwoBytes a_arg_ref;
44291 CHECK((*env)->GetArrayLength(env, a_arg) == 32);
44292 (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
44293 LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
44294 int64_t ret_ref = 0;
44295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44298 ret_ref = (uintptr_t)ret_var.inner;
44299 if (ret_var.is_owned) {
44305 static inline uintptr_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
44306 LDKNodeAlias ret_var = NodeAlias_clone(arg);
44307 int64_t ret_ref = 0;
44308 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44309 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44311 ret_ref = (uintptr_t)ret_var.inner;
44312 if (ret_var.is_owned) {
44317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44318 LDKNodeAlias arg_conv;
44319 arg_conv.inner = (void*)(arg & (~1));
44320 arg_conv.is_owned = false;
44321 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44322 int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
44326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44327 LDKNodeAlias orig_conv;
44328 orig_conv.inner = (void*)(orig & (~1));
44329 orig_conv.is_owned = false;
44330 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44331 LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
44332 int64_t ret_ref = 0;
44333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44336 ret_ref = (uintptr_t)ret_var.inner;
44337 if (ret_var.is_owned) {
44343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
44344 LDKNodeAlias obj_conv;
44345 obj_conv.inner = (void*)(obj & (~1));
44346 obj_conv.is_owned = false;
44347 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44348 LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
44349 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44350 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44351 CVec_u8Z_free(ret_var);
44355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44356 LDKu8slice ser_ref;
44357 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44358 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44359 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
44360 *ret_conv = NodeAlias_read(ser_ref);
44361 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44362 return (int64_t)ret_conv;
44365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44366 LDKNodeInfo this_obj_conv;
44367 this_obj_conv.inner = (void*)(this_obj & (~1));
44368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44370 NodeInfo_free(this_obj_conv);
44373 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44374 LDKNodeInfo this_ptr_conv;
44375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44376 this_ptr_conv.is_owned = false;
44377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44378 LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
44379 int64_tArray ret_arr = NULL;
44380 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44381 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44382 for (size_t g = 0; g < ret_var.datalen; g++) {
44383 int64_t ret_conv_6_conv = ret_var.data[g];
44384 ret_arr_ptr[g] = ret_conv_6_conv;
44386 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44387 FREE(ret_var.data);
44391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44392 LDKNodeInfo this_ptr_conv;
44393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44394 this_ptr_conv.is_owned = false;
44395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44396 LDKCVec_u64Z val_constr;
44397 val_constr.datalen = (*env)->GetArrayLength(env, val);
44398 if (val_constr.datalen > 0)
44399 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44401 val_constr.data = NULL;
44402 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44403 for (size_t g = 0; g < val_constr.datalen; g++) {
44404 int64_t val_conv_6 = val_vals[g];
44405 val_constr.data[g] = val_conv_6;
44407 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44408 NodeInfo_set_channels(&this_ptr_conv, val_constr);
44411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44412 LDKNodeInfo this_ptr_conv;
44413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44414 this_ptr_conv.is_owned = false;
44415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44416 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
44417 int64_t ret_ref = 0;
44418 if ((uintptr_t)ret_var.inner > 4096) {
44419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44422 ret_ref = (uintptr_t)ret_var.inner;
44423 if (ret_var.is_owned) {
44430 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) {
44431 LDKNodeInfo this_ptr_conv;
44432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44433 this_ptr_conv.is_owned = false;
44434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44435 LDKRoutingFees val_conv;
44436 val_conv.inner = (void*)(val & (~1));
44437 val_conv.is_owned = (val & 1) || (val == 0);
44438 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44439 val_conv = RoutingFees_clone(&val_conv);
44440 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
44443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
44444 LDKNodeInfo this_ptr_conv;
44445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44446 this_ptr_conv.is_owned = false;
44447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44448 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
44449 int64_t ret_ref = 0;
44450 if ((uintptr_t)ret_var.inner > 4096) {
44451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44454 ret_ref = (uintptr_t)ret_var.inner;
44455 if (ret_var.is_owned) {
44462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44463 LDKNodeInfo this_ptr_conv;
44464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44465 this_ptr_conv.is_owned = false;
44466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44467 LDKNodeAnnouncementInfo val_conv;
44468 val_conv.inner = (void*)(val & (~1));
44469 val_conv.is_owned = (val & 1) || (val == 0);
44470 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44471 val_conv = NodeAnnouncementInfo_clone(&val_conv);
44472 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
44475 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) {
44476 LDKCVec_u64Z channels_arg_constr;
44477 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
44478 if (channels_arg_constr.datalen > 0)
44479 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44481 channels_arg_constr.data = NULL;
44482 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
44483 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
44484 int64_t channels_arg_conv_6 = channels_arg_vals[g];
44485 channels_arg_constr.data[g] = channels_arg_conv_6;
44487 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
44488 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
44489 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
44490 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
44491 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
44492 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
44493 LDKNodeAnnouncementInfo announcement_info_arg_conv;
44494 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
44495 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
44496 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
44497 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
44498 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
44499 int64_t ret_ref = 0;
44500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44503 ret_ref = (uintptr_t)ret_var.inner;
44504 if (ret_var.is_owned) {
44510 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
44511 LDKNodeInfo ret_var = NodeInfo_clone(arg);
44512 int64_t ret_ref = 0;
44513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44516 ret_ref = (uintptr_t)ret_var.inner;
44517 if (ret_var.is_owned) {
44522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44523 LDKNodeInfo arg_conv;
44524 arg_conv.inner = (void*)(arg & (~1));
44525 arg_conv.is_owned = false;
44526 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44527 int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
44531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44532 LDKNodeInfo orig_conv;
44533 orig_conv.inner = (void*)(orig & (~1));
44534 orig_conv.is_owned = false;
44535 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44536 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
44537 int64_t ret_ref = 0;
44538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44541 ret_ref = (uintptr_t)ret_var.inner;
44542 if (ret_var.is_owned) {
44548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44549 LDKNodeInfo obj_conv;
44550 obj_conv.inner = (void*)(obj & (~1));
44551 obj_conv.is_owned = false;
44552 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44553 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
44554 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44555 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44556 CVec_u8Z_free(ret_var);
44560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44561 LDKu8slice ser_ref;
44562 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44563 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44564 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
44565 *ret_conv = NodeInfo_read(ser_ref);
44566 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44567 return (int64_t)ret_conv;
44570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
44571 LDKNetworkGraph obj_conv;
44572 obj_conv.inner = (void*)(obj & (~1));
44573 obj_conv.is_owned = false;
44574 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44575 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
44576 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44577 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44578 CVec_u8Z_free(ret_var);
44582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
44583 LDKu8slice ser_ref;
44584 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44585 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44586 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
44587 CHECK_ACCESS(arg_ptr);
44588 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
44589 if (arg_conv.free == LDKLogger_JCalls_free) {
44590 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44591 LDKLogger_JCalls_cloned(&arg_conv);
44593 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
44594 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
44595 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44596 return (int64_t)ret_conv;
44599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
44600 LDKThirtyTwoBytes genesis_hash_ref;
44601 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
44602 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
44603 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44604 CHECK_ACCESS(logger_ptr);
44605 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44606 if (logger_conv.free == LDKLogger_JCalls_free) {
44607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44608 LDKLogger_JCalls_cloned(&logger_conv);
44610 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
44611 int64_t ret_ref = 0;
44612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44615 ret_ref = (uintptr_t)ret_var.inner;
44616 if (ret_var.is_owned) {
44622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
44623 LDKNetworkGraph this_arg_conv;
44624 this_arg_conv.inner = (void*)(this_arg & (~1));
44625 this_arg_conv.is_owned = false;
44626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44627 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
44628 int64_t ret_ref = 0;
44629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44632 ret_ref = (uintptr_t)ret_var.inner;
44633 if (ret_var.is_owned) {
44639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44640 LDKNetworkGraph this_arg_conv;
44641 this_arg_conv.inner = (void*)(this_arg & (~1));
44642 this_arg_conv.is_owned = false;
44643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44644 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44645 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
44646 int64_t ret_ref = (uintptr_t)ret_copy;
44650 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) {
44651 LDKNetworkGraph this_arg_conv;
44652 this_arg_conv.inner = (void*)(this_arg & (~1));
44653 this_arg_conv.is_owned = false;
44654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44655 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
44658 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) {
44659 LDKNetworkGraph this_arg_conv;
44660 this_arg_conv.inner = (void*)(this_arg & (~1));
44661 this_arg_conv.is_owned = false;
44662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44663 LDKNodeAnnouncement msg_conv;
44664 msg_conv.inner = (void*)(msg & (~1));
44665 msg_conv.is_owned = false;
44666 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44667 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44668 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
44669 return (int64_t)ret_conv;
44672 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) {
44673 LDKNetworkGraph this_arg_conv;
44674 this_arg_conv.inner = (void*)(this_arg & (~1));
44675 this_arg_conv.is_owned = false;
44676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44677 LDKUnsignedNodeAnnouncement msg_conv;
44678 msg_conv.inner = (void*)(msg & (~1));
44679 msg_conv.is_owned = false;
44680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44681 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44682 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
44683 return (int64_t)ret_conv;
44686 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) {
44687 LDKNetworkGraph this_arg_conv;
44688 this_arg_conv.inner = (void*)(this_arg & (~1));
44689 this_arg_conv.is_owned = false;
44690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44691 LDKChannelAnnouncement msg_conv;
44692 msg_conv.inner = (void*)(msg & (~1));
44693 msg_conv.is_owned = false;
44694 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44695 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
44696 CHECK_ACCESS(chain_access_ptr);
44697 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
44698 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
44699 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
44700 // Manually implement clone for Java trait instances
44701 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
44702 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44703 LDKAccess_JCalls_cloned(&chain_access_conv.some);
44706 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44707 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
44708 return (int64_t)ret_conv;
44711 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) {
44712 LDKNetworkGraph this_arg_conv;
44713 this_arg_conv.inner = (void*)(this_arg & (~1));
44714 this_arg_conv.is_owned = false;
44715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44716 LDKUnsignedChannelAnnouncement msg_conv;
44717 msg_conv.inner = (void*)(msg & (~1));
44718 msg_conv.is_owned = false;
44719 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44720 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
44721 CHECK_ACCESS(chain_access_ptr);
44722 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
44723 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
44724 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
44725 // Manually implement clone for Java trait instances
44726 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
44727 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44728 LDKAccess_JCalls_cloned(&chain_access_conv.some);
44731 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44732 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
44733 return (int64_t)ret_conv;
44736 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) {
44737 LDKNetworkGraph this_arg_conv;
44738 this_arg_conv.inner = (void*)(this_arg & (~1));
44739 this_arg_conv.is_owned = false;
44740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44741 LDKChannelFeatures features_conv;
44742 features_conv.inner = (void*)(features & (~1));
44743 features_conv.is_owned = (features & 1) || (features == 0);
44744 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
44745 features_conv = ChannelFeatures_clone(&features_conv);
44746 LDKPublicKey node_id_1_ref;
44747 CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
44748 (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
44749 LDKPublicKey node_id_2_ref;
44750 CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
44751 (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
44752 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44753 *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);
44754 return (int64_t)ret_conv;
44757 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) {
44758 LDKNetworkGraph this_arg_conv;
44759 this_arg_conv.inner = (void*)(this_arg & (~1));
44760 this_arg_conv.is_owned = false;
44761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44762 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
44765 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) {
44766 LDKNetworkGraph this_arg_conv;
44767 this_arg_conv.inner = (void*)(this_arg & (~1));
44768 this_arg_conv.is_owned = false;
44769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44770 LDKPublicKey _node_id_ref;
44771 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
44772 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
44773 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
44776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
44777 LDKNetworkGraph this_arg_conv;
44778 this_arg_conv.inner = (void*)(this_arg & (~1));
44779 this_arg_conv.is_owned = false;
44780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44781 NetworkGraph_remove_stale_channels(&this_arg_conv);
44784 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) {
44785 LDKNetworkGraph this_arg_conv;
44786 this_arg_conv.inner = (void*)(this_arg & (~1));
44787 this_arg_conv.is_owned = false;
44788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44789 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
44792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
44793 LDKNetworkGraph this_arg_conv;
44794 this_arg_conv.inner = (void*)(this_arg & (~1));
44795 this_arg_conv.is_owned = false;
44796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44797 LDKChannelUpdate msg_conv;
44798 msg_conv.inner = (void*)(msg & (~1));
44799 msg_conv.is_owned = false;
44800 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44801 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44802 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
44803 return (int64_t)ret_conv;
44806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
44807 LDKNetworkGraph this_arg_conv;
44808 this_arg_conv.inner = (void*)(this_arg & (~1));
44809 this_arg_conv.is_owned = false;
44810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44811 LDKUnsignedChannelUpdate msg_conv;
44812 msg_conv.inner = (void*)(msg & (~1));
44813 msg_conv.is_owned = false;
44814 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44815 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44816 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
44817 return (int64_t)ret_conv;
44820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
44821 LDKReadOnlyNetworkGraph this_arg_conv;
44822 this_arg_conv.inner = (void*)(this_arg & (~1));
44823 this_arg_conv.is_owned = false;
44824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44825 LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
44826 int64_t ret_ref = 0;
44827 if ((uintptr_t)ret_var.inner > 4096) {
44828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44831 ret_ref = (uintptr_t)ret_var.inner;
44832 if (ret_var.is_owned) {
44839 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
44840 LDKReadOnlyNetworkGraph this_arg_conv;
44841 this_arg_conv.inner = (void*)(this_arg & (~1));
44842 this_arg_conv.is_owned = false;
44843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44844 LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
44845 int64_tArray ret_arr = NULL;
44846 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44847 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44848 for (size_t g = 0; g < ret_var.datalen; g++) {
44849 int64_t ret_conv_6_conv = ret_var.data[g];
44850 ret_arr_ptr[g] = ret_conv_6_conv;
44852 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44853 FREE(ret_var.data);
44857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
44858 LDKReadOnlyNetworkGraph this_arg_conv;
44859 this_arg_conv.inner = (void*)(this_arg & (~1));
44860 this_arg_conv.is_owned = false;
44861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44862 LDKNodeId node_id_conv;
44863 node_id_conv.inner = (void*)(node_id & (~1));
44864 node_id_conv.is_owned = false;
44865 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44866 LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
44867 int64_t ret_ref = 0;
44868 if ((uintptr_t)ret_var.inner > 4096) {
44869 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44870 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44872 ret_ref = (uintptr_t)ret_var.inner;
44873 if (ret_var.is_owned) {
44880 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
44881 LDKReadOnlyNetworkGraph this_arg_conv;
44882 this_arg_conv.inner = (void*)(this_arg & (~1));
44883 this_arg_conv.is_owned = false;
44884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44885 LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
44886 int64_tArray ret_arr = NULL;
44887 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44888 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44889 for (size_t i = 0; i < ret_var.datalen; i++) {
44890 LDKNodeId ret_conv_8_var = ret_var.data[i];
44891 int64_t ret_conv_8_ref = 0;
44892 CHECK((((uintptr_t)ret_conv_8_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44893 CHECK((((uintptr_t)&ret_conv_8_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
44895 ret_conv_8_ref = (uintptr_t)ret_conv_8_var.inner;
44896 if (ret_conv_8_var.is_owned) {
44897 ret_conv_8_ref |= 1;
44899 ret_arr_ptr[i] = ret_conv_8_ref;
44901 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44902 FREE(ret_var.data);
44906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
44907 LDKReadOnlyNetworkGraph this_arg_conv;
44908 this_arg_conv.inner = (void*)(this_arg & (~1));
44909 this_arg_conv.is_owned = false;
44910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44911 LDKPublicKey pubkey_ref;
44912 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
44913 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
44914 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
44915 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
44916 int64_t ret_ref = (uintptr_t)ret_copy;
44920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44921 LDKRouteHop this_obj_conv;
44922 this_obj_conv.inner = (void*)(this_obj & (~1));
44923 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44925 RouteHop_free(this_obj_conv);
44928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44929 LDKRouteHop this_ptr_conv;
44930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44931 this_ptr_conv.is_owned = false;
44932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44933 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44934 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
44938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44939 LDKRouteHop this_ptr_conv;
44940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44941 this_ptr_conv.is_owned = false;
44942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44943 LDKPublicKey val_ref;
44944 CHECK((*env)->GetArrayLength(env, val) == 33);
44945 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44946 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
44949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44950 LDKRouteHop this_ptr_conv;
44951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44952 this_ptr_conv.is_owned = false;
44953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44954 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
44955 int64_t ret_ref = 0;
44956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44959 ret_ref = (uintptr_t)ret_var.inner;
44960 if (ret_var.is_owned) {
44966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44967 LDKRouteHop this_ptr_conv;
44968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44969 this_ptr_conv.is_owned = false;
44970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44971 LDKNodeFeatures val_conv;
44972 val_conv.inner = (void*)(val & (~1));
44973 val_conv.is_owned = (val & 1) || (val == 0);
44974 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44975 val_conv = NodeFeatures_clone(&val_conv);
44976 RouteHop_set_node_features(&this_ptr_conv, val_conv);
44979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44980 LDKRouteHop this_ptr_conv;
44981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44982 this_ptr_conv.is_owned = false;
44983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44984 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
44988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44989 LDKRouteHop this_ptr_conv;
44990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44991 this_ptr_conv.is_owned = false;
44992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44993 RouteHop_set_short_channel_id(&this_ptr_conv, val);
44996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44997 LDKRouteHop this_ptr_conv;
44998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44999 this_ptr_conv.is_owned = false;
45000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45001 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
45002 int64_t ret_ref = 0;
45003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45006 ret_ref = (uintptr_t)ret_var.inner;
45007 if (ret_var.is_owned) {
45013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45014 LDKRouteHop this_ptr_conv;
45015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45016 this_ptr_conv.is_owned = false;
45017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45018 LDKChannelFeatures val_conv;
45019 val_conv.inner = (void*)(val & (~1));
45020 val_conv.is_owned = (val & 1) || (val == 0);
45021 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45022 val_conv = ChannelFeatures_clone(&val_conv);
45023 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
45026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45027 LDKRouteHop this_ptr_conv;
45028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45029 this_ptr_conv.is_owned = false;
45030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45031 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
45035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45036 LDKRouteHop this_ptr_conv;
45037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45038 this_ptr_conv.is_owned = false;
45039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45040 RouteHop_set_fee_msat(&this_ptr_conv, val);
45043 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45044 LDKRouteHop 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 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
45052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45053 LDKRouteHop this_ptr_conv;
45054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45055 this_ptr_conv.is_owned = false;
45056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45057 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45060 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) {
45061 LDKPublicKey pubkey_arg_ref;
45062 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
45063 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
45064 LDKNodeFeatures node_features_arg_conv;
45065 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
45066 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
45067 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
45068 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
45069 LDKChannelFeatures channel_features_arg_conv;
45070 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
45071 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
45072 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
45073 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
45074 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);
45075 int64_t ret_ref = 0;
45076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45079 ret_ref = (uintptr_t)ret_var.inner;
45080 if (ret_var.is_owned) {
45086 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
45087 LDKRouteHop ret_var = RouteHop_clone(arg);
45088 int64_t ret_ref = 0;
45089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45092 ret_ref = (uintptr_t)ret_var.inner;
45093 if (ret_var.is_owned) {
45098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45099 LDKRouteHop arg_conv;
45100 arg_conv.inner = (void*)(arg & (~1));
45101 arg_conv.is_owned = false;
45102 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45103 int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
45107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45108 LDKRouteHop orig_conv;
45109 orig_conv.inner = (void*)(orig & (~1));
45110 orig_conv.is_owned = false;
45111 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45112 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
45113 int64_t ret_ref = 0;
45114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45117 ret_ref = (uintptr_t)ret_var.inner;
45118 if (ret_var.is_owned) {
45124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
45125 LDKRouteHop o_conv;
45126 o_conv.inner = (void*)(o & (~1));
45127 o_conv.is_owned = false;
45128 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45129 int64_t ret_conv = RouteHop_hash(&o_conv);
45133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45134 LDKRouteHop a_conv;
45135 a_conv.inner = (void*)(a & (~1));
45136 a_conv.is_owned = false;
45137 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45138 LDKRouteHop b_conv;
45139 b_conv.inner = (void*)(b & (~1));
45140 b_conv.is_owned = false;
45141 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45142 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
45146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
45147 LDKRouteHop obj_conv;
45148 obj_conv.inner = (void*)(obj & (~1));
45149 obj_conv.is_owned = false;
45150 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45151 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
45152 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45153 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45154 CVec_u8Z_free(ret_var);
45158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45159 LDKu8slice ser_ref;
45160 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45161 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45162 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
45163 *ret_conv = RouteHop_read(ser_ref);
45164 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45165 return (int64_t)ret_conv;
45168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45169 LDKRoute this_obj_conv;
45170 this_obj_conv.inner = (void*)(this_obj & (~1));
45171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45173 Route_free(this_obj_conv);
45176 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
45177 LDKRoute this_ptr_conv;
45178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45179 this_ptr_conv.is_owned = false;
45180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45181 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
45182 jobjectArray ret_arr = NULL;
45183 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
45185 for (size_t m = 0; m < ret_var.datalen; m++) {
45186 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
45187 int64_tArray ret_conv_12_arr = NULL;
45188 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
45189 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
45190 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
45191 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
45192 int64_t ret_conv_12_conv_10_ref = 0;
45193 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45194 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
45196 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
45197 if (ret_conv_12_conv_10_var.is_owned) {
45198 ret_conv_12_conv_10_ref |= 1;
45200 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
45202 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
45203 FREE(ret_conv_12_var.data);
45204 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
45207 FREE(ret_var.data);
45211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45212 LDKRoute this_ptr_conv;
45213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45214 this_ptr_conv.is_owned = false;
45215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45216 LDKCVec_CVec_RouteHopZZ val_constr;
45217 val_constr.datalen = (*env)->GetArrayLength(env, val);
45218 if (val_constr.datalen > 0)
45219 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45221 val_constr.data = NULL;
45222 for (size_t m = 0; m < val_constr.datalen; m++) {
45223 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
45224 LDKCVec_RouteHopZ val_conv_12_constr;
45225 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
45226 if (val_conv_12_constr.datalen > 0)
45227 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45229 val_conv_12_constr.data = NULL;
45230 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
45231 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
45232 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
45233 LDKRouteHop val_conv_12_conv_10_conv;
45234 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
45235 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
45236 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
45237 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
45238 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
45240 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
45241 val_constr.data[m] = val_conv_12_constr;
45243 Route_set_paths(&this_ptr_conv, val_constr);
45246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45247 LDKRoute this_ptr_conv;
45248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45249 this_ptr_conv.is_owned = false;
45250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45251 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
45252 int64_t ret_ref = 0;
45253 if ((uintptr_t)ret_var.inner > 4096) {
45254 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45255 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45257 ret_ref = (uintptr_t)ret_var.inner;
45258 if (ret_var.is_owned) {
45265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45266 LDKRoute this_ptr_conv;
45267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45268 this_ptr_conv.is_owned = false;
45269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45270 LDKPaymentParameters val_conv;
45271 val_conv.inner = (void*)(val & (~1));
45272 val_conv.is_owned = (val & 1) || (val == 0);
45273 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45274 val_conv = PaymentParameters_clone(&val_conv);
45275 Route_set_payment_params(&this_ptr_conv, val_conv);
45278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
45279 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
45280 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
45281 if (paths_arg_constr.datalen > 0)
45282 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45284 paths_arg_constr.data = NULL;
45285 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
45286 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
45287 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
45288 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
45289 if (paths_arg_conv_12_constr.datalen > 0)
45290 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45292 paths_arg_conv_12_constr.data = NULL;
45293 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
45294 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
45295 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
45296 LDKRouteHop paths_arg_conv_12_conv_10_conv;
45297 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
45298 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
45299 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
45300 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
45301 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
45303 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
45304 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
45306 LDKPaymentParameters payment_params_arg_conv;
45307 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
45308 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
45309 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45310 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45311 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
45312 int64_t ret_ref = 0;
45313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45316 ret_ref = (uintptr_t)ret_var.inner;
45317 if (ret_var.is_owned) {
45323 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
45324 LDKRoute ret_var = Route_clone(arg);
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) {
45335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45337 arg_conv.inner = (void*)(arg & (~1));
45338 arg_conv.is_owned = false;
45339 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45340 int64_t ret_conv = Route_clone_ptr(&arg_conv);
45344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45345 LDKRoute orig_conv;
45346 orig_conv.inner = (void*)(orig & (~1));
45347 orig_conv.is_owned = false;
45348 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45349 LDKRoute ret_var = Route_clone(&orig_conv);
45350 int64_t ret_ref = 0;
45351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45354 ret_ref = (uintptr_t)ret_var.inner;
45355 if (ret_var.is_owned) {
45361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
45363 o_conv.inner = (void*)(o & (~1));
45364 o_conv.is_owned = false;
45365 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45366 int64_t ret_conv = Route_hash(&o_conv);
45370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45372 a_conv.inner = (void*)(a & (~1));
45373 a_conv.is_owned = false;
45374 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45376 b_conv.inner = (void*)(b & (~1));
45377 b_conv.is_owned = false;
45378 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45379 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
45383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
45384 LDKRoute this_arg_conv;
45385 this_arg_conv.inner = (void*)(this_arg & (~1));
45386 this_arg_conv.is_owned = false;
45387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45388 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
45392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
45393 LDKRoute this_arg_conv;
45394 this_arg_conv.inner = (void*)(this_arg & (~1));
45395 this_arg_conv.is_owned = false;
45396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45397 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
45401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
45403 obj_conv.inner = (void*)(obj & (~1));
45404 obj_conv.is_owned = false;
45405 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45406 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
45407 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45408 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45409 CVec_u8Z_free(ret_var);
45413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45414 LDKu8slice ser_ref;
45415 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45416 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45417 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
45418 *ret_conv = Route_read(ser_ref);
45419 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45420 return (int64_t)ret_conv;
45423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45424 LDKRouteParameters this_obj_conv;
45425 this_obj_conv.inner = (void*)(this_obj & (~1));
45426 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45428 RouteParameters_free(this_obj_conv);
45431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45432 LDKRouteParameters this_ptr_conv;
45433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45434 this_ptr_conv.is_owned = false;
45435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45436 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
45437 int64_t ret_ref = 0;
45438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45441 ret_ref = (uintptr_t)ret_var.inner;
45442 if (ret_var.is_owned) {
45448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45449 LDKRouteParameters this_ptr_conv;
45450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45451 this_ptr_conv.is_owned = false;
45452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45453 LDKPaymentParameters val_conv;
45454 val_conv.inner = (void*)(val & (~1));
45455 val_conv.is_owned = (val & 1) || (val == 0);
45456 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45457 val_conv = PaymentParameters_clone(&val_conv);
45458 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
45461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45462 LDKRouteParameters this_ptr_conv;
45463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45464 this_ptr_conv.is_owned = false;
45465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45466 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
45470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45471 LDKRouteParameters this_ptr_conv;
45472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45473 this_ptr_conv.is_owned = false;
45474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45475 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
45478 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45479 LDKRouteParameters this_ptr_conv;
45480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45481 this_ptr_conv.is_owned = false;
45482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45483 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
45487 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) {
45488 LDKRouteParameters this_ptr_conv;
45489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45490 this_ptr_conv.is_owned = false;
45491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45492 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
45495 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) {
45496 LDKPaymentParameters payment_params_arg_conv;
45497 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
45498 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
45499 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45500 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45501 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
45502 int64_t ret_ref = 0;
45503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45506 ret_ref = (uintptr_t)ret_var.inner;
45507 if (ret_var.is_owned) {
45513 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
45514 LDKRouteParameters ret_var = RouteParameters_clone(arg);
45515 int64_t ret_ref = 0;
45516 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45517 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45518 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45519 ret_ref = (uintptr_t)ret_var.inner;
45520 if (ret_var.is_owned) {
45525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45526 LDKRouteParameters arg_conv;
45527 arg_conv.inner = (void*)(arg & (~1));
45528 arg_conv.is_owned = false;
45529 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45530 int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
45534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45535 LDKRouteParameters orig_conv;
45536 orig_conv.inner = (void*)(orig & (~1));
45537 orig_conv.is_owned = false;
45538 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45539 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
45540 int64_t ret_ref = 0;
45541 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45542 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45544 ret_ref = (uintptr_t)ret_var.inner;
45545 if (ret_var.is_owned) {
45551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
45552 LDKRouteParameters obj_conv;
45553 obj_conv.inner = (void*)(obj & (~1));
45554 obj_conv.is_owned = false;
45555 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45556 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
45557 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45558 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45559 CVec_u8Z_free(ret_var);
45563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45564 LDKu8slice ser_ref;
45565 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45566 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45567 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
45568 *ret_conv = RouteParameters_read(ser_ref);
45569 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45570 return (int64_t)ret_conv;
45573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45574 LDKPaymentParameters this_obj_conv;
45575 this_obj_conv.inner = (void*)(this_obj & (~1));
45576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45578 PaymentParameters_free(this_obj_conv);
45581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45582 LDKPaymentParameters this_ptr_conv;
45583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45584 this_ptr_conv.is_owned = false;
45585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45586 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45587 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
45591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45592 LDKPaymentParameters this_ptr_conv;
45593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45594 this_ptr_conv.is_owned = false;
45595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45596 LDKPublicKey val_ref;
45597 CHECK((*env)->GetArrayLength(env, val) == 33);
45598 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45599 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
45602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45603 LDKPaymentParameters this_ptr_conv;
45604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45605 this_ptr_conv.is_owned = false;
45606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45607 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
45608 int64_t ret_ref = 0;
45609 if ((uintptr_t)ret_var.inner > 4096) {
45610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45613 ret_ref = (uintptr_t)ret_var.inner;
45614 if (ret_var.is_owned) {
45621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45622 LDKPaymentParameters this_ptr_conv;
45623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45624 this_ptr_conv.is_owned = false;
45625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45626 LDKInvoiceFeatures val_conv;
45627 val_conv.inner = (void*)(val & (~1));
45628 val_conv.is_owned = (val & 1) || (val == 0);
45629 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45630 val_conv = InvoiceFeatures_clone(&val_conv);
45631 PaymentParameters_set_features(&this_ptr_conv, val_conv);
45634 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
45635 LDKPaymentParameters this_ptr_conv;
45636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45637 this_ptr_conv.is_owned = false;
45638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45639 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
45640 int64_tArray ret_arr = NULL;
45641 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45642 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45643 for (size_t l = 0; l < ret_var.datalen; l++) {
45644 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45645 int64_t ret_conv_11_ref = 0;
45646 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45647 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45649 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
45650 if (ret_conv_11_var.is_owned) {
45651 ret_conv_11_ref |= 1;
45653 ret_arr_ptr[l] = ret_conv_11_ref;
45655 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45656 FREE(ret_var.data);
45660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45661 LDKPaymentParameters this_ptr_conv;
45662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45663 this_ptr_conv.is_owned = false;
45664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45665 LDKCVec_RouteHintZ val_constr;
45666 val_constr.datalen = (*env)->GetArrayLength(env, val);
45667 if (val_constr.datalen > 0)
45668 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45670 val_constr.data = NULL;
45671 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45672 for (size_t l = 0; l < val_constr.datalen; l++) {
45673 int64_t val_conv_11 = val_vals[l];
45674 LDKRouteHint val_conv_11_conv;
45675 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
45676 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
45677 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
45678 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
45679 val_constr.data[l] = val_conv_11_conv;
45681 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45682 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
45685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
45686 LDKPaymentParameters this_ptr_conv;
45687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45688 this_ptr_conv.is_owned = false;
45689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45690 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45691 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
45692 int64_t ret_ref = (uintptr_t)ret_copy;
45696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45697 LDKPaymentParameters this_ptr_conv;
45698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45699 this_ptr_conv.is_owned = false;
45700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45701 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45702 CHECK_ACCESS(val_ptr);
45703 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45704 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
45705 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
45708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45709 LDKPaymentParameters this_ptr_conv;
45710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45711 this_ptr_conv.is_owned = false;
45712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45713 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
45717 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) {
45718 LDKPaymentParameters this_ptr_conv;
45719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45720 this_ptr_conv.is_owned = false;
45721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45722 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
45725 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
45726 LDKPaymentParameters this_ptr_conv;
45727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45728 this_ptr_conv.is_owned = false;
45729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45730 int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
45734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
45735 LDKPaymentParameters this_ptr_conv;
45736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45737 this_ptr_conv.is_owned = false;
45738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45739 PaymentParameters_set_max_path_count(&this_ptr_conv, val);
45742 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) {
45743 LDKPaymentParameters this_ptr_conv;
45744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45745 this_ptr_conv.is_owned = false;
45746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45747 int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
45751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
45752 LDKPaymentParameters this_ptr_conv;
45753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45754 this_ptr_conv.is_owned = false;
45755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45756 PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
45759 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
45760 LDKPaymentParameters this_ptr_conv;
45761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45762 this_ptr_conv.is_owned = false;
45763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45764 LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
45765 int64_tArray ret_arr = NULL;
45766 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45767 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45768 for (size_t g = 0; g < ret_var.datalen; g++) {
45769 int64_t ret_conv_6_conv = ret_var.data[g];
45770 ret_arr_ptr[g] = ret_conv_6_conv;
45772 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45773 FREE(ret_var.data);
45777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45778 LDKPaymentParameters this_ptr_conv;
45779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45780 this_ptr_conv.is_owned = false;
45781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45782 LDKCVec_u64Z val_constr;
45783 val_constr.datalen = (*env)->GetArrayLength(env, val);
45784 if (val_constr.datalen > 0)
45785 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45787 val_constr.data = NULL;
45788 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45789 for (size_t g = 0; g < val_constr.datalen; g++) {
45790 int64_t val_conv_6 = val_vals[g];
45791 val_constr.data[g] = val_conv_6;
45793 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45794 PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
45797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
45798 LDKPublicKey payee_pubkey_arg_ref;
45799 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
45800 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
45801 LDKInvoiceFeatures features_arg_conv;
45802 features_arg_conv.inner = (void*)(features_arg & (~1));
45803 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
45804 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45805 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
45806 LDKCVec_RouteHintZ route_hints_arg_constr;
45807 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
45808 if (route_hints_arg_constr.datalen > 0)
45809 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45811 route_hints_arg_constr.data = NULL;
45812 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
45813 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
45814 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
45815 LDKRouteHint route_hints_arg_conv_11_conv;
45816 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
45817 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
45818 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
45819 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
45820 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
45822 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
45823 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
45824 CHECK_ACCESS(expiry_time_arg_ptr);
45825 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
45826 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
45827 LDKCVec_u64Z previously_failed_channels_arg_constr;
45828 previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
45829 if (previously_failed_channels_arg_constr.datalen > 0)
45830 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45832 previously_failed_channels_arg_constr.data = NULL;
45833 int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
45834 for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
45835 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
45836 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
45838 (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
45839 LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
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) {
45851 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
45852 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
45853 int64_t ret_ref = 0;
45854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45857 ret_ref = (uintptr_t)ret_var.inner;
45858 if (ret_var.is_owned) {
45863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45864 LDKPaymentParameters arg_conv;
45865 arg_conv.inner = (void*)(arg & (~1));
45866 arg_conv.is_owned = false;
45867 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45868 int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
45872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45873 LDKPaymentParameters orig_conv;
45874 orig_conv.inner = (void*)(orig & (~1));
45875 orig_conv.is_owned = false;
45876 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45877 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
45878 int64_t ret_ref = 0;
45879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45882 ret_ref = (uintptr_t)ret_var.inner;
45883 if (ret_var.is_owned) {
45889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
45890 LDKPaymentParameters o_conv;
45891 o_conv.inner = (void*)(o & (~1));
45892 o_conv.is_owned = false;
45893 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45894 int64_t ret_conv = PaymentParameters_hash(&o_conv);
45898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45899 LDKPaymentParameters a_conv;
45900 a_conv.inner = (void*)(a & (~1));
45901 a_conv.is_owned = false;
45902 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45903 LDKPaymentParameters b_conv;
45904 b_conv.inner = (void*)(b & (~1));
45905 b_conv.is_owned = false;
45906 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45907 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
45911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
45912 LDKPaymentParameters obj_conv;
45913 obj_conv.inner = (void*)(obj & (~1));
45914 obj_conv.is_owned = false;
45915 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45916 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
45917 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45918 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45919 CVec_u8Z_free(ret_var);
45923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45924 LDKu8slice ser_ref;
45925 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45926 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45927 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
45928 *ret_conv = PaymentParameters_read(ser_ref);
45929 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45930 return (int64_t)ret_conv;
45933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
45934 LDKPublicKey payee_pubkey_ref;
45935 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
45936 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
45937 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
45938 int64_t ret_ref = 0;
45939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45942 ret_ref = (uintptr_t)ret_var.inner;
45943 if (ret_var.is_owned) {
45949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
45950 LDKPublicKey payee_pubkey_ref;
45951 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
45952 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
45953 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
45954 int64_t ret_ref = 0;
45955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45958 ret_ref = (uintptr_t)ret_var.inner;
45959 if (ret_var.is_owned) {
45965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45966 LDKRouteHint this_obj_conv;
45967 this_obj_conv.inner = (void*)(this_obj & (~1));
45968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45970 RouteHint_free(this_obj_conv);
45973 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45974 LDKRouteHint this_ptr_conv;
45975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45976 this_ptr_conv.is_owned = false;
45977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45978 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
45979 int64_tArray ret_arr = NULL;
45980 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45981 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45982 for (size_t o = 0; o < ret_var.datalen; o++) {
45983 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
45984 int64_t ret_conv_14_ref = 0;
45985 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45986 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45988 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45989 if (ret_conv_14_var.is_owned) {
45990 ret_conv_14_ref |= 1;
45992 ret_arr_ptr[o] = ret_conv_14_ref;
45994 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45995 FREE(ret_var.data);
45999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
46000 LDKRouteHint this_ptr_conv;
46001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46002 this_ptr_conv.is_owned = false;
46003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46004 LDKCVec_RouteHintHopZ val_constr;
46005 val_constr.datalen = (*env)->GetArrayLength(env, val);
46006 if (val_constr.datalen > 0)
46007 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46009 val_constr.data = NULL;
46010 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
46011 for (size_t o = 0; o < val_constr.datalen; o++) {
46012 int64_t val_conv_14 = val_vals[o];
46013 LDKRouteHintHop val_conv_14_conv;
46014 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
46015 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
46016 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
46017 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
46018 val_constr.data[o] = val_conv_14_conv;
46020 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
46021 RouteHint_set_a(&this_ptr_conv, val_constr);
46024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
46025 LDKCVec_RouteHintHopZ a_arg_constr;
46026 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
46027 if (a_arg_constr.datalen > 0)
46028 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46030 a_arg_constr.data = NULL;
46031 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
46032 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
46033 int64_t a_arg_conv_14 = a_arg_vals[o];
46034 LDKRouteHintHop a_arg_conv_14_conv;
46035 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
46036 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
46037 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
46038 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
46039 a_arg_constr.data[o] = a_arg_conv_14_conv;
46041 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
46042 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
46043 int64_t ret_ref = 0;
46044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46047 ret_ref = (uintptr_t)ret_var.inner;
46048 if (ret_var.is_owned) {
46054 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
46055 LDKRouteHint ret_var = RouteHint_clone(arg);
46056 int64_t ret_ref = 0;
46057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46060 ret_ref = (uintptr_t)ret_var.inner;
46061 if (ret_var.is_owned) {
46066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46067 LDKRouteHint arg_conv;
46068 arg_conv.inner = (void*)(arg & (~1));
46069 arg_conv.is_owned = false;
46070 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46071 int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
46075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46076 LDKRouteHint orig_conv;
46077 orig_conv.inner = (void*)(orig & (~1));
46078 orig_conv.is_owned = false;
46079 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46080 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
46081 int64_t ret_ref = 0;
46082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46085 ret_ref = (uintptr_t)ret_var.inner;
46086 if (ret_var.is_owned) {
46092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
46093 LDKRouteHint o_conv;
46094 o_conv.inner = (void*)(o & (~1));
46095 o_conv.is_owned = false;
46096 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46097 int64_t ret_conv = RouteHint_hash(&o_conv);
46101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46102 LDKRouteHint a_conv;
46103 a_conv.inner = (void*)(a & (~1));
46104 a_conv.is_owned = false;
46105 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46106 LDKRouteHint b_conv;
46107 b_conv.inner = (void*)(b & (~1));
46108 b_conv.is_owned = false;
46109 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46110 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
46114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
46115 LDKRouteHint obj_conv;
46116 obj_conv.inner = (void*)(obj & (~1));
46117 obj_conv.is_owned = false;
46118 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46119 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
46120 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46121 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46122 CVec_u8Z_free(ret_var);
46126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46127 LDKu8slice ser_ref;
46128 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46129 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46130 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
46131 *ret_conv = RouteHint_read(ser_ref);
46132 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46133 return (int64_t)ret_conv;
46136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46137 LDKRouteHintHop this_obj_conv;
46138 this_obj_conv.inner = (void*)(this_obj & (~1));
46139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46141 RouteHintHop_free(this_obj_conv);
46144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46145 LDKRouteHintHop this_ptr_conv;
46146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46147 this_ptr_conv.is_owned = false;
46148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46149 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
46154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46155 LDKRouteHintHop this_ptr_conv;
46156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46157 this_ptr_conv.is_owned = false;
46158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46159 LDKPublicKey val_ref;
46160 CHECK((*env)->GetArrayLength(env, val) == 33);
46161 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46162 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
46165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46166 LDKRouteHintHop this_ptr_conv;
46167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46168 this_ptr_conv.is_owned = false;
46169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46170 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
46174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46175 LDKRouteHintHop this_ptr_conv;
46176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46177 this_ptr_conv.is_owned = false;
46178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46179 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
46182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
46183 LDKRouteHintHop this_ptr_conv;
46184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46185 this_ptr_conv.is_owned = false;
46186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46187 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
46188 int64_t ret_ref = 0;
46189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46192 ret_ref = (uintptr_t)ret_var.inner;
46193 if (ret_var.is_owned) {
46199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46200 LDKRouteHintHop this_ptr_conv;
46201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46202 this_ptr_conv.is_owned = false;
46203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46204 LDKRoutingFees val_conv;
46205 val_conv.inner = (void*)(val & (~1));
46206 val_conv.is_owned = (val & 1) || (val == 0);
46207 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46208 val_conv = RoutingFees_clone(&val_conv);
46209 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
46212 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46213 LDKRouteHintHop this_ptr_conv;
46214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46215 this_ptr_conv.is_owned = false;
46216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46217 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
46221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46222 LDKRouteHintHop this_ptr_conv;
46223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46224 this_ptr_conv.is_owned = false;
46225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46226 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46230 LDKRouteHintHop this_ptr_conv;
46231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46232 this_ptr_conv.is_owned = false;
46233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46234 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46235 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
46236 int64_t ret_ref = (uintptr_t)ret_copy;
46240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46241 LDKRouteHintHop this_ptr_conv;
46242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46243 this_ptr_conv.is_owned = false;
46244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46245 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46246 CHECK_ACCESS(val_ptr);
46247 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46248 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
46249 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
46252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46253 LDKRouteHintHop this_ptr_conv;
46254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46255 this_ptr_conv.is_owned = false;
46256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46257 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46258 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
46259 int64_t ret_ref = (uintptr_t)ret_copy;
46263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46264 LDKRouteHintHop this_ptr_conv;
46265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46266 this_ptr_conv.is_owned = false;
46267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46268 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46269 CHECK_ACCESS(val_ptr);
46270 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46271 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
46272 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
46275 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) {
46276 LDKPublicKey src_node_id_arg_ref;
46277 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
46278 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
46279 LDKRoutingFees fees_arg_conv;
46280 fees_arg_conv.inner = (void*)(fees_arg & (~1));
46281 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
46282 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
46283 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
46284 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
46285 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
46286 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
46287 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
46288 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
46289 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
46290 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
46291 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
46292 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);
46293 int64_t ret_ref = 0;
46294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46297 ret_ref = (uintptr_t)ret_var.inner;
46298 if (ret_var.is_owned) {
46304 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
46305 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
46306 int64_t ret_ref = 0;
46307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46310 ret_ref = (uintptr_t)ret_var.inner;
46311 if (ret_var.is_owned) {
46316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46317 LDKRouteHintHop arg_conv;
46318 arg_conv.inner = (void*)(arg & (~1));
46319 arg_conv.is_owned = false;
46320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46321 int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
46325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46326 LDKRouteHintHop orig_conv;
46327 orig_conv.inner = (void*)(orig & (~1));
46328 orig_conv.is_owned = false;
46329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46330 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
46331 int64_t ret_ref = 0;
46332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46335 ret_ref = (uintptr_t)ret_var.inner;
46336 if (ret_var.is_owned) {
46342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
46343 LDKRouteHintHop o_conv;
46344 o_conv.inner = (void*)(o & (~1));
46345 o_conv.is_owned = false;
46346 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46347 int64_t ret_conv = RouteHintHop_hash(&o_conv);
46351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46352 LDKRouteHintHop a_conv;
46353 a_conv.inner = (void*)(a & (~1));
46354 a_conv.is_owned = false;
46355 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46356 LDKRouteHintHop b_conv;
46357 b_conv.inner = (void*)(b & (~1));
46358 b_conv.is_owned = false;
46359 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46360 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
46364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
46365 LDKRouteHintHop obj_conv;
46366 obj_conv.inner = (void*)(obj & (~1));
46367 obj_conv.is_owned = false;
46368 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46369 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
46370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46372 CVec_u8Z_free(ret_var);
46376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46377 LDKu8slice ser_ref;
46378 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46379 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46380 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
46381 *ret_conv = RouteHintHop_read(ser_ref);
46382 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46383 return (int64_t)ret_conv;
46386 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) {
46387 LDKPublicKey our_node_pubkey_ref;
46388 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46389 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46390 LDKRouteParameters route_params_conv;
46391 route_params_conv.inner = (void*)(route_params & (~1));
46392 route_params_conv.is_owned = false;
46393 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46394 LDKNetworkGraph network_graph_conv;
46395 network_graph_conv.inner = (void*)(network_graph & (~1));
46396 network_graph_conv.is_owned = false;
46397 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46398 LDKCVec_ChannelDetailsZ first_hops_constr;
46399 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
46400 if (first_hops != NULL) {
46401 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
46402 if (first_hops_constr.datalen > 0)
46403 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
46405 first_hops_constr.data = NULL;
46406 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
46407 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
46408 int64_t first_hops_conv_16 = first_hops_vals[q];
46409 LDKChannelDetails first_hops_conv_16_conv;
46410 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
46411 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
46412 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
46413 first_hops_constr.data[q] = first_hops_conv_16_conv;
46415 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
46416 first_hops_ptr = &first_hops_constr;
46418 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46419 CHECK_ACCESS(logger_ptr);
46420 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46421 if (logger_conv.free == LDKLogger_JCalls_free) {
46422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46423 LDKLogger_JCalls_cloned(&logger_conv);
46425 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
46426 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
46427 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
46428 unsigned char random_seed_bytes_arr[32];
46429 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46430 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46431 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46432 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46433 *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);
46434 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
46435 return (int64_t)ret_conv;
46438 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) {
46439 LDKPublicKey our_node_pubkey_ref;
46440 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46441 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46442 LDKCVec_PublicKeyZ hops_constr;
46443 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
46444 if (hops_constr.datalen > 0)
46445 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46447 hops_constr.data = NULL;
46448 for (size_t i = 0; i < hops_constr.datalen; i++) {
46449 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
46450 LDKPublicKey hops_conv_8_ref;
46451 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
46452 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
46453 hops_constr.data[i] = hops_conv_8_ref;
46455 LDKRouteParameters route_params_conv;
46456 route_params_conv.inner = (void*)(route_params & (~1));
46457 route_params_conv.is_owned = false;
46458 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46459 LDKNetworkGraph network_graph_conv;
46460 network_graph_conv.inner = (void*)(network_graph & (~1));
46461 network_graph_conv.is_owned = false;
46462 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46463 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46464 CHECK_ACCESS(logger_ptr);
46465 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46466 if (logger_conv.free == LDKLogger_JCalls_free) {
46467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46468 LDKLogger_JCalls_cloned(&logger_conv);
46470 unsigned char random_seed_bytes_arr[32];
46471 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46472 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46473 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46474 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46475 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
46476 return (int64_t)ret_conv;
46479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46480 if ((this_ptr & 1) != 0) return;
46481 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46482 CHECK_ACCESS(this_ptr_ptr);
46483 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
46484 FREE((void*)this_ptr);
46485 Score_free(this_ptr_conv);
46488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46489 if ((this_ptr & 1) != 0) return;
46490 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46491 CHECK_ACCESS(this_ptr_ptr);
46492 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
46493 FREE((void*)this_ptr);
46494 LockableScore_free(this_ptr_conv);
46497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46498 LDKMultiThreadedLockableScore this_obj_conv;
46499 this_obj_conv.inner = (void*)(this_obj & (~1));
46500 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46502 MultiThreadedLockableScore_free(this_obj_conv);
46505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
46506 LDKMultiThreadedLockableScore obj_conv;
46507 obj_conv.inner = (void*)(obj & (~1));
46508 obj_conv.is_owned = false;
46509 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46510 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
46511 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46512 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46513 CVec_u8Z_free(ret_var);
46517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
46518 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
46519 CHECK_ACCESS(score_ptr);
46520 LDKScore score_conv = *(LDKScore*)(score_ptr);
46521 if (score_conv.free == LDKScore_JCalls_free) {
46522 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46523 LDKScore_JCalls_cloned(&score_conv);
46525 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
46526 int64_t ret_ref = 0;
46527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46530 ret_ref = (uintptr_t)ret_var.inner;
46531 if (ret_var.is_owned) {
46537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46538 LDKChannelUsage this_obj_conv;
46539 this_obj_conv.inner = (void*)(this_obj & (~1));
46540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46542 ChannelUsage_free(this_obj_conv);
46545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46546 LDKChannelUsage this_ptr_conv;
46547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46548 this_ptr_conv.is_owned = false;
46549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46550 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
46554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46555 LDKChannelUsage this_ptr_conv;
46556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46557 this_ptr_conv.is_owned = false;
46558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46559 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
46562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46563 LDKChannelUsage this_ptr_conv;
46564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46565 this_ptr_conv.is_owned = false;
46566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46567 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
46571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46572 LDKChannelUsage this_ptr_conv;
46573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46574 this_ptr_conv.is_owned = false;
46575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46576 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
46579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
46580 LDKChannelUsage this_ptr_conv;
46581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46582 this_ptr_conv.is_owned = false;
46583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46584 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
46585 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
46586 int64_t ret_ref = (uintptr_t)ret_copy;
46590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46591 LDKChannelUsage this_ptr_conv;
46592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46593 this_ptr_conv.is_owned = false;
46594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46595 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46596 CHECK_ACCESS(val_ptr);
46597 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
46598 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
46599 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
46602 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) {
46603 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
46604 CHECK_ACCESS(effective_capacity_arg_ptr);
46605 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
46606 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
46607 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
46608 int64_t ret_ref = 0;
46609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46612 ret_ref = (uintptr_t)ret_var.inner;
46613 if (ret_var.is_owned) {
46619 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
46620 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
46621 int64_t ret_ref = 0;
46622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46625 ret_ref = (uintptr_t)ret_var.inner;
46626 if (ret_var.is_owned) {
46631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46632 LDKChannelUsage arg_conv;
46633 arg_conv.inner = (void*)(arg & (~1));
46634 arg_conv.is_owned = false;
46635 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46636 int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
46640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46641 LDKChannelUsage orig_conv;
46642 orig_conv.inner = (void*)(orig & (~1));
46643 orig_conv.is_owned = false;
46644 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46645 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
46646 int64_t ret_ref = 0;
46647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46650 ret_ref = (uintptr_t)ret_var.inner;
46651 if (ret_var.is_owned) {
46657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46658 LDKFixedPenaltyScorer this_obj_conv;
46659 this_obj_conv.inner = (void*)(this_obj & (~1));
46660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46662 FixedPenaltyScorer_free(this_obj_conv);
46665 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
46666 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
46667 int64_t ret_ref = 0;
46668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46671 ret_ref = (uintptr_t)ret_var.inner;
46672 if (ret_var.is_owned) {
46677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46678 LDKFixedPenaltyScorer arg_conv;
46679 arg_conv.inner = (void*)(arg & (~1));
46680 arg_conv.is_owned = false;
46681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46682 int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
46686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46687 LDKFixedPenaltyScorer orig_conv;
46688 orig_conv.inner = (void*)(orig & (~1));
46689 orig_conv.is_owned = false;
46690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46691 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
46692 int64_t ret_ref = 0;
46693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46696 ret_ref = (uintptr_t)ret_var.inner;
46697 if (ret_var.is_owned) {
46703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
46704 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
46705 int64_t ret_ref = 0;
46706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46709 ret_ref = (uintptr_t)ret_var.inner;
46710 if (ret_var.is_owned) {
46716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
46717 LDKFixedPenaltyScorer this_arg_conv;
46718 this_arg_conv.inner = (void*)(this_arg & (~1));
46719 this_arg_conv.is_owned = false;
46720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46721 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46722 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
46723 return (int64_t)ret_ret;
46726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
46727 LDKFixedPenaltyScorer obj_conv;
46728 obj_conv.inner = (void*)(obj & (~1));
46729 obj_conv.is_owned = false;
46730 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46731 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
46732 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46733 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46734 CVec_u8Z_free(ret_var);
46738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
46739 LDKu8slice ser_ref;
46740 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46741 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46742 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
46743 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
46744 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46745 return (int64_t)ret_conv;
46748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46749 LDKProbabilisticScorer this_obj_conv;
46750 this_obj_conv.inner = (void*)(this_obj & (~1));
46751 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46753 ProbabilisticScorer_free(this_obj_conv);
46756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46757 LDKProbabilisticScoringParameters this_obj_conv;
46758 this_obj_conv.inner = (void*)(this_obj & (~1));
46759 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46761 ProbabilisticScoringParameters_free(this_obj_conv);
46764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46765 LDKProbabilisticScoringParameters this_ptr_conv;
46766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46767 this_ptr_conv.is_owned = false;
46768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46769 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
46773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46774 LDKProbabilisticScoringParameters this_ptr_conv;
46775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46776 this_ptr_conv.is_owned = false;
46777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46778 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
46781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46782 LDKProbabilisticScoringParameters this_ptr_conv;
46783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46784 this_ptr_conv.is_owned = false;
46785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46786 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
46790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46791 LDKProbabilisticScoringParameters this_ptr_conv;
46792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46793 this_ptr_conv.is_owned = false;
46794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46795 ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46799 LDKProbabilisticScoringParameters this_ptr_conv;
46800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46801 this_ptr_conv.is_owned = false;
46802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46803 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
46807 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) {
46808 LDKProbabilisticScoringParameters this_ptr_conv;
46809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46810 this_ptr_conv.is_owned = false;
46811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46812 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
46815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
46816 LDKProbabilisticScoringParameters this_ptr_conv;
46817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46818 this_ptr_conv.is_owned = false;
46819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46820 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
46824 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) {
46825 LDKProbabilisticScoringParameters this_ptr_conv;
46826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46827 this_ptr_conv.is_owned = false;
46828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46829 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
46832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46833 LDKProbabilisticScoringParameters this_ptr_conv;
46834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46835 this_ptr_conv.is_owned = false;
46836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46837 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
46841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46842 LDKProbabilisticScoringParameters this_ptr_conv;
46843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46844 this_ptr_conv.is_owned = false;
46845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46846 ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46850 LDKProbabilisticScoringParameters this_ptr_conv;
46851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46852 this_ptr_conv.is_owned = false;
46853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46854 int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
46858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46859 LDKProbabilisticScoringParameters this_ptr_conv;
46860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46861 this_ptr_conv.is_owned = false;
46862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46863 ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
46866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46867 LDKProbabilisticScoringParameters this_ptr_conv;
46868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46869 this_ptr_conv.is_owned = false;
46870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46871 int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
46875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46876 LDKProbabilisticScoringParameters this_ptr_conv;
46877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46878 this_ptr_conv.is_owned = false;
46879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46880 ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
46883 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
46884 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
46885 int64_t ret_ref = 0;
46886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46889 ret_ref = (uintptr_t)ret_var.inner;
46890 if (ret_var.is_owned) {
46895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46896 LDKProbabilisticScoringParameters arg_conv;
46897 arg_conv.inner = (void*)(arg & (~1));
46898 arg_conv.is_owned = false;
46899 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46900 int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
46904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46905 LDKProbabilisticScoringParameters orig_conv;
46906 orig_conv.inner = (void*)(orig & (~1));
46907 orig_conv.is_owned = false;
46908 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46909 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
46910 int64_t ret_ref = 0;
46911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46914 ret_ref = (uintptr_t)ret_var.inner;
46915 if (ret_var.is_owned) {
46921 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) {
46922 LDKProbabilisticScoringParameters params_conv;
46923 params_conv.inner = (void*)(params & (~1));
46924 params_conv.is_owned = (params & 1) || (params == 0);
46925 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
46926 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
46927 LDKNetworkGraph network_graph_conv;
46928 network_graph_conv.inner = (void*)(network_graph & (~1));
46929 network_graph_conv.is_owned = false;
46930 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46931 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46932 CHECK_ACCESS(logger_ptr);
46933 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46934 if (logger_conv.free == LDKLogger_JCalls_free) {
46935 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46936 LDKLogger_JCalls_cloned(&logger_conv);
46938 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
46939 int64_t ret_ref = 0;
46940 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46941 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46943 ret_ref = (uintptr_t)ret_var.inner;
46944 if (ret_var.is_owned) {
46950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
46951 LDKProbabilisticScorer this_arg_conv;
46952 this_arg_conv.inner = (void*)(this_arg & (~1));
46953 this_arg_conv.is_owned = false;
46954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46955 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
46958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
46959 LDKProbabilisticScorer this_arg_conv;
46960 this_arg_conv.inner = (void*)(this_arg & (~1));
46961 this_arg_conv.is_owned = false;
46962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46963 LDKNodeId target_conv;
46964 target_conv.inner = (void*)(target & (~1));
46965 target_conv.is_owned = false;
46966 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46967 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
46968 *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
46969 int64_t ret_ref = (uintptr_t)ret_copy;
46973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
46974 LDKProbabilisticScorer this_arg_conv;
46975 this_arg_conv.inner = (void*)(this_arg & (~1));
46976 this_arg_conv.is_owned = false;
46977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46978 LDKNodeId node_id_conv;
46979 node_id_conv.inner = (void*)(node_id & (~1));
46980 node_id_conv.is_owned = false;
46981 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
46982 ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
46985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
46986 LDKProbabilisticScorer 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 LDKNodeId node_id_conv;
46991 node_id_conv.inner = (void*)(node_id & (~1));
46992 node_id_conv.is_owned = false;
46993 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
46994 ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
46997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
46998 LDKProbabilisticScorer this_arg_conv;
46999 this_arg_conv.inner = (void*)(this_arg & (~1));
47000 this_arg_conv.is_owned = false;
47001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47002 LDKNodeId node_id_conv;
47003 node_id_conv.inner = (void*)(node_id & (~1));
47004 node_id_conv.is_owned = false;
47005 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47006 ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
47009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
47010 LDKProbabilisticScorer this_arg_conv;
47011 this_arg_conv.inner = (void*)(this_arg & (~1));
47012 this_arg_conv.is_owned = false;
47013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47014 LDKNodeId node_id_conv;
47015 node_id_conv.inner = (void*)(node_id & (~1));
47016 node_id_conv.is_owned = false;
47017 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47018 ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
47021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
47022 LDKProbabilisticScorer this_arg_conv;
47023 this_arg_conv.inner = (void*)(this_arg & (~1));
47024 this_arg_conv.is_owned = false;
47025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47026 ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
47029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
47030 LDKProbabilisticScoringParameters this_arg_conv;
47031 this_arg_conv.inner = (void*)(this_arg & (~1));
47032 this_arg_conv.is_owned = false;
47033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47034 LDKCVec_NodeIdZ node_ids_constr;
47035 node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
47036 if (node_ids_constr.datalen > 0)
47037 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
47039 node_ids_constr.data = NULL;
47040 int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
47041 for (size_t i = 0; i < node_ids_constr.datalen; i++) {
47042 int64_t node_ids_conv_8 = node_ids_vals[i];
47043 LDKNodeId node_ids_conv_8_conv;
47044 node_ids_conv_8_conv.inner = (void*)(node_ids_conv_8 & (~1));
47045 node_ids_conv_8_conv.is_owned = (node_ids_conv_8 & 1) || (node_ids_conv_8 == 0);
47046 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
47047 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
47048 node_ids_constr.data[i] = node_ids_conv_8_conv;
47050 (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
47051 ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
47054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
47055 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
47056 int64_t ret_ref = 0;
47057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47060 ret_ref = (uintptr_t)ret_var.inner;
47061 if (ret_var.is_owned) {
47067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
47068 LDKProbabilisticScorer this_arg_conv;
47069 this_arg_conv.inner = (void*)(this_arg & (~1));
47070 this_arg_conv.is_owned = false;
47071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47072 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47073 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
47074 return (int64_t)ret_ret;
47077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
47078 LDKProbabilisticScorer obj_conv;
47079 obj_conv.inner = (void*)(obj & (~1));
47080 obj_conv.is_owned = false;
47081 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47082 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
47083 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47084 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47085 CVec_u8Z_free(ret_var);
47089 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) {
47090 LDKu8slice ser_ref;
47091 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47092 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47093 LDKProbabilisticScoringParameters arg_a_conv;
47094 arg_a_conv.inner = (void*)(arg_a & (~1));
47095 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
47096 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
47097 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
47098 LDKNetworkGraph arg_b_conv;
47099 arg_b_conv.inner = (void*)(arg_b & (~1));
47100 arg_b_conv.is_owned = false;
47101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
47102 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
47103 CHECK_ACCESS(arg_c_ptr);
47104 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
47105 if (arg_c_conv.free == LDKLogger_JCalls_free) {
47106 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47107 LDKLogger_JCalls_cloned(&arg_c_conv);
47109 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
47110 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
47111 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47112 return (int64_t)ret_conv;
47115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47116 LDKFilesystemPersister this_obj_conv;
47117 this_obj_conv.inner = (void*)(this_obj & (~1));
47118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47120 FilesystemPersister_free(this_obj_conv);
47123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
47124 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
47125 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
47126 int64_t ret_ref = 0;
47127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47130 ret_ref = (uintptr_t)ret_var.inner;
47131 if (ret_var.is_owned) {
47137 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
47138 LDKFilesystemPersister this_arg_conv;
47139 this_arg_conv.inner = (void*)(this_arg & (~1));
47140 this_arg_conv.is_owned = false;
47141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47142 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
47143 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
47149 LDKFilesystemPersister this_arg_conv;
47150 this_arg_conv.inner = (void*)(this_arg & (~1));
47151 this_arg_conv.is_owned = false;
47152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47153 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
47154 CHECK_ACCESS(keys_manager_ptr);
47155 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47156 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47157 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47158 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47160 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
47161 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
47162 return (int64_t)ret_conv;
47165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47166 LDKBackgroundProcessor this_obj_conv;
47167 this_obj_conv.inner = (void*)(this_obj & (~1));
47168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47170 BackgroundProcessor_free(this_obj_conv);
47173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47174 if ((this_ptr & 1) != 0) return;
47175 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47176 CHECK_ACCESS(this_ptr_ptr);
47177 LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
47178 FREE((void*)this_ptr);
47179 GossipSync_free(this_ptr_conv);
47182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
47183 LDKP2PGossipSync a_conv;
47184 a_conv.inner = (void*)(a & (~1));
47185 a_conv.is_owned = false;
47186 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47187 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47188 *ret_copy = GossipSync_p2_p(&a_conv);
47189 int64_t ret_ref = (uintptr_t)ret_copy;
47193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
47194 LDKRapidGossipSync a_conv;
47195 a_conv.inner = (void*)(a & (~1));
47196 a_conv.is_owned = false;
47197 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47198 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47199 *ret_copy = GossipSync_rapid(&a_conv);
47200 int64_t ret_ref = (uintptr_t)ret_copy;
47204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
47205 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47206 *ret_copy = GossipSync_none();
47207 int64_t ret_ref = (uintptr_t)ret_copy;
47211 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) {
47212 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
47213 CHECK_ACCESS(persister_ptr);
47214 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
47215 if (persister_conv.free == LDKPersister_JCalls_free) {
47216 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47217 LDKPersister_JCalls_cloned(&persister_conv);
47219 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
47220 CHECK_ACCESS(event_handler_ptr);
47221 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47222 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47223 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47224 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47226 LDKChainMonitor chain_monitor_conv;
47227 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
47228 chain_monitor_conv.is_owned = false;
47229 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
47230 LDKChannelManager channel_manager_conv;
47231 channel_manager_conv.inner = (void*)(channel_manager & (~1));
47232 channel_manager_conv.is_owned = false;
47233 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
47234 void* gossip_sync_ptr = (void*)(((uintptr_t)gossip_sync) & ~1);
47235 CHECK_ACCESS(gossip_sync_ptr);
47236 LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
47237 // WARNING: we may need a move here but no clone is available for LDKGossipSync
47238 LDKPeerManager peer_manager_conv;
47239 peer_manager_conv.inner = (void*)(peer_manager & (~1));
47240 peer_manager_conv.is_owned = false;
47241 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
47242 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
47243 CHECK_ACCESS(logger_ptr);
47244 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47245 if (logger_conv.free == LDKLogger_JCalls_free) {
47246 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47247 LDKLogger_JCalls_cloned(&logger_conv);
47249 LDKMultiThreadedLockableScore scorer_conv;
47250 scorer_conv.inner = (void*)(scorer & (~1));
47251 scorer_conv.is_owned = (scorer & 1) || (scorer == 0);
47252 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47253 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);
47254 int64_t ret_ref = 0;
47255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47258 ret_ref = (uintptr_t)ret_var.inner;
47259 if (ret_var.is_owned) {
47265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
47266 LDKBackgroundProcessor this_arg_conv;
47267 this_arg_conv.inner = (void*)(this_arg & (~1));
47268 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47270 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47271 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47272 *ret_conv = BackgroundProcessor_join(this_arg_conv);
47273 return (int64_t)ret_conv;
47276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
47277 LDKBackgroundProcessor this_arg_conv;
47278 this_arg_conv.inner = (void*)(this_arg & (~1));
47279 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47281 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47282 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47283 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
47284 return (int64_t)ret_conv;
47287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47288 if ((this_ptr & 1) != 0) return;
47289 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47290 CHECK_ACCESS(this_ptr_ptr);
47291 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
47292 FREE((void*)this_ptr);
47293 ParseError_free(this_ptr_conv);
47296 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
47297 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47298 *ret_copy = ParseError_clone(arg);
47299 int64_t ret_ref = (uintptr_t)ret_copy;
47302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47303 LDKParseError* arg_conv = (LDKParseError*)arg;
47304 int64_t ret_conv = ParseError_clone_ptr(arg_conv);
47308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47309 LDKParseError* orig_conv = (LDKParseError*)orig;
47310 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47311 *ret_copy = ParseError_clone(orig_conv);
47312 int64_t ret_ref = (uintptr_t)ret_copy;
47316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
47317 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
47318 CHECK_ACCESS(a_ptr);
47319 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
47320 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
47321 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47322 *ret_copy = ParseError_bech32_error(a_conv);
47323 int64_t ret_ref = (uintptr_t)ret_copy;
47327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
47329 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47330 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
47331 int64_t ret_ref = (uintptr_t)ret_copy;
47335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
47336 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
47337 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47338 *ret_copy = ParseError_malformed_signature(a_conv);
47339 int64_t ret_ref = (uintptr_t)ret_copy;
47343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
47344 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47345 *ret_copy = ParseError_bad_prefix();
47346 int64_t ret_ref = (uintptr_t)ret_copy;
47350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
47351 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47352 *ret_copy = ParseError_unknown_currency();
47353 int64_t ret_ref = (uintptr_t)ret_copy;
47357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
47358 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47359 *ret_copy = ParseError_unknown_si_prefix();
47360 int64_t ret_ref = (uintptr_t)ret_copy;
47364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
47365 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47366 *ret_copy = ParseError_malformed_hrp();
47367 int64_t ret_ref = (uintptr_t)ret_copy;
47371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
47372 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47373 *ret_copy = ParseError_too_short_data_part();
47374 int64_t ret_ref = (uintptr_t)ret_copy;
47378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
47379 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47380 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
47381 int64_t ret_ref = (uintptr_t)ret_copy;
47385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
47387 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47388 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
47389 int64_t ret_ref = (uintptr_t)ret_copy;
47393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
47394 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47395 *ret_copy = ParseError_padding_error();
47396 int64_t ret_ref = (uintptr_t)ret_copy;
47400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
47401 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47402 *ret_copy = ParseError_integer_overflow_error();
47403 int64_t ret_ref = (uintptr_t)ret_copy;
47407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
47408 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47409 *ret_copy = ParseError_invalid_seg_wit_program_length();
47410 int64_t ret_ref = (uintptr_t)ret_copy;
47414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
47415 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47416 *ret_copy = ParseError_invalid_pub_key_hash_length();
47417 int64_t ret_ref = (uintptr_t)ret_copy;
47421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
47422 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47423 *ret_copy = ParseError_invalid_script_hash_length();
47424 int64_t ret_ref = (uintptr_t)ret_copy;
47428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47429 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47430 *ret_copy = ParseError_invalid_recovery_id();
47431 int64_t ret_ref = (uintptr_t)ret_copy;
47435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
47436 LDKStr a_conv = java_to_owned_str(env, a);
47437 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47438 *ret_copy = ParseError_invalid_slice_length(a_conv);
47439 int64_t ret_ref = (uintptr_t)ret_copy;
47443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
47444 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47445 *ret_copy = ParseError_skip();
47446 int64_t ret_ref = (uintptr_t)ret_copy;
47450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47451 if ((this_ptr & 1) != 0) return;
47452 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47453 CHECK_ACCESS(this_ptr_ptr);
47454 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
47455 FREE((void*)this_ptr);
47456 ParseOrSemanticError_free(this_ptr_conv);
47459 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
47460 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47461 *ret_copy = ParseOrSemanticError_clone(arg);
47462 int64_t ret_ref = (uintptr_t)ret_copy;
47465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47466 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
47467 int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
47471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47472 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
47473 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47474 *ret_copy = ParseOrSemanticError_clone(orig_conv);
47475 int64_t ret_ref = (uintptr_t)ret_copy;
47479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
47480 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
47481 CHECK_ACCESS(a_ptr);
47482 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
47483 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
47484 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47485 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
47486 int64_t ret_ref = (uintptr_t)ret_copy;
47490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
47491 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
47492 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47493 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
47494 int64_t ret_ref = (uintptr_t)ret_copy;
47498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47499 LDKInvoice this_obj_conv;
47500 this_obj_conv.inner = (void*)(this_obj & (~1));
47501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47503 Invoice_free(this_obj_conv);
47506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47508 a_conv.inner = (void*)(a & (~1));
47509 a_conv.is_owned = false;
47510 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47512 b_conv.inner = (void*)(b & (~1));
47513 b_conv.is_owned = false;
47514 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47515 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
47519 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
47520 LDKInvoice ret_var = Invoice_clone(arg);
47521 int64_t ret_ref = 0;
47522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47525 ret_ref = (uintptr_t)ret_var.inner;
47526 if (ret_var.is_owned) {
47531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47532 LDKInvoice arg_conv;
47533 arg_conv.inner = (void*)(arg & (~1));
47534 arg_conv.is_owned = false;
47535 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47536 int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
47540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47541 LDKInvoice orig_conv;
47542 orig_conv.inner = (void*)(orig & (~1));
47543 orig_conv.is_owned = false;
47544 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47545 LDKInvoice ret_var = Invoice_clone(&orig_conv);
47546 int64_t ret_ref = 0;
47547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47550 ret_ref = (uintptr_t)ret_var.inner;
47551 if (ret_var.is_owned) {
47557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47558 LDKSignedRawInvoice this_obj_conv;
47559 this_obj_conv.inner = (void*)(this_obj & (~1));
47560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47562 SignedRawInvoice_free(this_obj_conv);
47565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47566 LDKSignedRawInvoice a_conv;
47567 a_conv.inner = (void*)(a & (~1));
47568 a_conv.is_owned = false;
47569 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47570 LDKSignedRawInvoice b_conv;
47571 b_conv.inner = (void*)(b & (~1));
47572 b_conv.is_owned = false;
47573 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47574 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
47578 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
47579 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
47580 int64_t ret_ref = 0;
47581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47584 ret_ref = (uintptr_t)ret_var.inner;
47585 if (ret_var.is_owned) {
47590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47591 LDKSignedRawInvoice arg_conv;
47592 arg_conv.inner = (void*)(arg & (~1));
47593 arg_conv.is_owned = false;
47594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47595 int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
47599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47600 LDKSignedRawInvoice orig_conv;
47601 orig_conv.inner = (void*)(orig & (~1));
47602 orig_conv.is_owned = false;
47603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47604 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
47605 int64_t ret_ref = 0;
47606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47609 ret_ref = (uintptr_t)ret_var.inner;
47610 if (ret_var.is_owned) {
47616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47617 LDKRawInvoice this_obj_conv;
47618 this_obj_conv.inner = (void*)(this_obj & (~1));
47619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47621 RawInvoice_free(this_obj_conv);
47624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
47625 LDKRawInvoice this_ptr_conv;
47626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47627 this_ptr_conv.is_owned = false;
47628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47629 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
47630 int64_t ret_ref = 0;
47631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47634 ret_ref = (uintptr_t)ret_var.inner;
47635 if (ret_var.is_owned) {
47641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47642 LDKRawInvoice this_ptr_conv;
47643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47644 this_ptr_conv.is_owned = false;
47645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47646 LDKRawDataPart val_conv;
47647 val_conv.inner = (void*)(val & (~1));
47648 val_conv.is_owned = (val & 1) || (val == 0);
47649 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47650 val_conv = RawDataPart_clone(&val_conv);
47651 RawInvoice_set_data(&this_ptr_conv, val_conv);
47654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47655 LDKRawInvoice a_conv;
47656 a_conv.inner = (void*)(a & (~1));
47657 a_conv.is_owned = false;
47658 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47659 LDKRawInvoice b_conv;
47660 b_conv.inner = (void*)(b & (~1));
47661 b_conv.is_owned = false;
47662 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47663 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
47667 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
47668 LDKRawInvoice ret_var = RawInvoice_clone(arg);
47669 int64_t ret_ref = 0;
47670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47673 ret_ref = (uintptr_t)ret_var.inner;
47674 if (ret_var.is_owned) {
47679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47680 LDKRawInvoice arg_conv;
47681 arg_conv.inner = (void*)(arg & (~1));
47682 arg_conv.is_owned = false;
47683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47684 int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
47688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47689 LDKRawInvoice orig_conv;
47690 orig_conv.inner = (void*)(orig & (~1));
47691 orig_conv.is_owned = false;
47692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47693 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
47694 int64_t ret_ref = 0;
47695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47698 ret_ref = (uintptr_t)ret_var.inner;
47699 if (ret_var.is_owned) {
47705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47706 LDKRawDataPart this_obj_conv;
47707 this_obj_conv.inner = (void*)(this_obj & (~1));
47708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47710 RawDataPart_free(this_obj_conv);
47713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47714 LDKRawDataPart this_ptr_conv;
47715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47716 this_ptr_conv.is_owned = false;
47717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47718 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
47719 int64_t ret_ref = 0;
47720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47723 ret_ref = (uintptr_t)ret_var.inner;
47724 if (ret_var.is_owned) {
47730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47731 LDKRawDataPart this_ptr_conv;
47732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47733 this_ptr_conv.is_owned = false;
47734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47735 LDKPositiveTimestamp val_conv;
47736 val_conv.inner = (void*)(val & (~1));
47737 val_conv.is_owned = (val & 1) || (val == 0);
47738 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47739 val_conv = PositiveTimestamp_clone(&val_conv);
47740 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
47743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47744 LDKRawDataPart a_conv;
47745 a_conv.inner = (void*)(a & (~1));
47746 a_conv.is_owned = false;
47747 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47748 LDKRawDataPart b_conv;
47749 b_conv.inner = (void*)(b & (~1));
47750 b_conv.is_owned = false;
47751 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47752 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
47756 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
47757 LDKRawDataPart ret_var = RawDataPart_clone(arg);
47758 int64_t ret_ref = 0;
47759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47762 ret_ref = (uintptr_t)ret_var.inner;
47763 if (ret_var.is_owned) {
47768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47769 LDKRawDataPart arg_conv;
47770 arg_conv.inner = (void*)(arg & (~1));
47771 arg_conv.is_owned = false;
47772 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47773 int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
47777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47778 LDKRawDataPart orig_conv;
47779 orig_conv.inner = (void*)(orig & (~1));
47780 orig_conv.is_owned = false;
47781 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47782 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
47783 int64_t ret_ref = 0;
47784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47787 ret_ref = (uintptr_t)ret_var.inner;
47788 if (ret_var.is_owned) {
47794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47795 LDKPositiveTimestamp this_obj_conv;
47796 this_obj_conv.inner = (void*)(this_obj & (~1));
47797 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47799 PositiveTimestamp_free(this_obj_conv);
47802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47803 LDKPositiveTimestamp a_conv;
47804 a_conv.inner = (void*)(a & (~1));
47805 a_conv.is_owned = false;
47806 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47807 LDKPositiveTimestamp b_conv;
47808 b_conv.inner = (void*)(b & (~1));
47809 b_conv.is_owned = false;
47810 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47811 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
47815 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
47816 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
47817 int64_t ret_ref = 0;
47818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47821 ret_ref = (uintptr_t)ret_var.inner;
47822 if (ret_var.is_owned) {
47827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47828 LDKPositiveTimestamp arg_conv;
47829 arg_conv.inner = (void*)(arg & (~1));
47830 arg_conv.is_owned = false;
47831 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47832 int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
47836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47837 LDKPositiveTimestamp orig_conv;
47838 orig_conv.inner = (void*)(orig & (~1));
47839 orig_conv.is_owned = false;
47840 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47841 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
47842 int64_t ret_ref = 0;
47843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47846 ret_ref = (uintptr_t)ret_var.inner;
47847 if (ret_var.is_owned) {
47853 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47854 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
47855 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
47859 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
47860 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
47864 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
47865 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
47869 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
47870 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
47874 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
47875 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
47879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47880 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
47881 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
47882 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
47886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
47887 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
47888 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
47892 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47893 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
47894 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
47898 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
47899 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
47903 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
47904 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
47908 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
47909 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
47913 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
47914 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
47918 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
47919 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
47923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
47924 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
47925 int64_t ret_conv = Currency_hash(o_conv);
47929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47930 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
47931 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
47932 jboolean ret_conv = Currency_eq(a_conv, b_conv);
47936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47937 LDKSha256 this_obj_conv;
47938 this_obj_conv.inner = (void*)(this_obj & (~1));
47939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47941 Sha256_free(this_obj_conv);
47944 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
47945 LDKSha256 ret_var = Sha256_clone(arg);
47946 int64_t ret_ref = 0;
47947 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47948 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47950 ret_ref = (uintptr_t)ret_var.inner;
47951 if (ret_var.is_owned) {
47956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47957 LDKSha256 arg_conv;
47958 arg_conv.inner = (void*)(arg & (~1));
47959 arg_conv.is_owned = false;
47960 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47961 int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
47965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47966 LDKSha256 orig_conv;
47967 orig_conv.inner = (void*)(orig & (~1));
47968 orig_conv.is_owned = false;
47969 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47970 LDKSha256 ret_var = Sha256_clone(&orig_conv);
47971 int64_t ret_ref = 0;
47972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47975 ret_ref = (uintptr_t)ret_var.inner;
47976 if (ret_var.is_owned) {
47982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
47984 o_conv.inner = (void*)(o & (~1));
47985 o_conv.is_owned = false;
47986 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47987 int64_t ret_conv = Sha256_hash(&o_conv);
47991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47993 a_conv.inner = (void*)(a & (~1));
47994 a_conv.is_owned = false;
47995 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47997 b_conv.inner = (void*)(b & (~1));
47998 b_conv.is_owned = false;
47999 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48000 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
48004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48005 LDKDescription this_obj_conv;
48006 this_obj_conv.inner = (void*)(this_obj & (~1));
48007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48009 Description_free(this_obj_conv);
48012 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
48013 LDKDescription ret_var = Description_clone(arg);
48014 int64_t ret_ref = 0;
48015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48018 ret_ref = (uintptr_t)ret_var.inner;
48019 if (ret_var.is_owned) {
48024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48025 LDKDescription arg_conv;
48026 arg_conv.inner = (void*)(arg & (~1));
48027 arg_conv.is_owned = false;
48028 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48029 int64_t ret_conv = Description_clone_ptr(&arg_conv);
48033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48034 LDKDescription orig_conv;
48035 orig_conv.inner = (void*)(orig & (~1));
48036 orig_conv.is_owned = false;
48037 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48038 LDKDescription ret_var = Description_clone(&orig_conv);
48039 int64_t ret_ref = 0;
48040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48043 ret_ref = (uintptr_t)ret_var.inner;
48044 if (ret_var.is_owned) {
48050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
48051 LDKDescription o_conv;
48052 o_conv.inner = (void*)(o & (~1));
48053 o_conv.is_owned = false;
48054 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48055 int64_t ret_conv = Description_hash(&o_conv);
48059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48060 LDKDescription a_conv;
48061 a_conv.inner = (void*)(a & (~1));
48062 a_conv.is_owned = false;
48063 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48064 LDKDescription b_conv;
48065 b_conv.inner = (void*)(b & (~1));
48066 b_conv.is_owned = false;
48067 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48068 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
48072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48073 LDKPayeePubKey this_obj_conv;
48074 this_obj_conv.inner = (void*)(this_obj & (~1));
48075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48077 PayeePubKey_free(this_obj_conv);
48080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48081 LDKPayeePubKey this_ptr_conv;
48082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48083 this_ptr_conv.is_owned = false;
48084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48085 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48086 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
48090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48091 LDKPayeePubKey this_ptr_conv;
48092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48093 this_ptr_conv.is_owned = false;
48094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48095 LDKPublicKey val_ref;
48096 CHECK((*env)->GetArrayLength(env, val) == 33);
48097 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48098 PayeePubKey_set_a(&this_ptr_conv, val_ref);
48101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
48102 LDKPublicKey a_arg_ref;
48103 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
48104 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
48105 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
48106 int64_t ret_ref = 0;
48107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48110 ret_ref = (uintptr_t)ret_var.inner;
48111 if (ret_var.is_owned) {
48117 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
48118 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
48119 int64_t ret_ref = 0;
48120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48123 ret_ref = (uintptr_t)ret_var.inner;
48124 if (ret_var.is_owned) {
48129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48130 LDKPayeePubKey arg_conv;
48131 arg_conv.inner = (void*)(arg & (~1));
48132 arg_conv.is_owned = false;
48133 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48134 int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
48138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48139 LDKPayeePubKey orig_conv;
48140 orig_conv.inner = (void*)(orig & (~1));
48141 orig_conv.is_owned = false;
48142 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48143 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
48144 int64_t ret_ref = 0;
48145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48148 ret_ref = (uintptr_t)ret_var.inner;
48149 if (ret_var.is_owned) {
48155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
48156 LDKPayeePubKey o_conv;
48157 o_conv.inner = (void*)(o & (~1));
48158 o_conv.is_owned = false;
48159 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48160 int64_t ret_conv = PayeePubKey_hash(&o_conv);
48164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48165 LDKPayeePubKey a_conv;
48166 a_conv.inner = (void*)(a & (~1));
48167 a_conv.is_owned = false;
48168 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48169 LDKPayeePubKey b_conv;
48170 b_conv.inner = (void*)(b & (~1));
48171 b_conv.is_owned = false;
48172 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48173 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
48177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48178 LDKExpiryTime this_obj_conv;
48179 this_obj_conv.inner = (void*)(this_obj & (~1));
48180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48182 ExpiryTime_free(this_obj_conv);
48185 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
48186 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
48187 int64_t ret_ref = 0;
48188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48191 ret_ref = (uintptr_t)ret_var.inner;
48192 if (ret_var.is_owned) {
48197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48198 LDKExpiryTime arg_conv;
48199 arg_conv.inner = (void*)(arg & (~1));
48200 arg_conv.is_owned = false;
48201 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48202 int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
48206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48207 LDKExpiryTime orig_conv;
48208 orig_conv.inner = (void*)(orig & (~1));
48209 orig_conv.is_owned = false;
48210 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48211 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
48212 int64_t ret_ref = 0;
48213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48216 ret_ref = (uintptr_t)ret_var.inner;
48217 if (ret_var.is_owned) {
48223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
48224 LDKExpiryTime o_conv;
48225 o_conv.inner = (void*)(o & (~1));
48226 o_conv.is_owned = false;
48227 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48228 int64_t ret_conv = ExpiryTime_hash(&o_conv);
48232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48233 LDKExpiryTime a_conv;
48234 a_conv.inner = (void*)(a & (~1));
48235 a_conv.is_owned = false;
48236 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48237 LDKExpiryTime b_conv;
48238 b_conv.inner = (void*)(b & (~1));
48239 b_conv.is_owned = false;
48240 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48241 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
48245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48246 LDKMinFinalCltvExpiry this_obj_conv;
48247 this_obj_conv.inner = (void*)(this_obj & (~1));
48248 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48250 MinFinalCltvExpiry_free(this_obj_conv);
48253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48254 LDKMinFinalCltvExpiry this_ptr_conv;
48255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48256 this_ptr_conv.is_owned = false;
48257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48258 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
48262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48263 LDKMinFinalCltvExpiry this_ptr_conv;
48264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48265 this_ptr_conv.is_owned = false;
48266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48267 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
48270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
48271 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
48272 int64_t ret_ref = 0;
48273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48276 ret_ref = (uintptr_t)ret_var.inner;
48277 if (ret_var.is_owned) {
48283 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
48284 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
48285 int64_t ret_ref = 0;
48286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48289 ret_ref = (uintptr_t)ret_var.inner;
48290 if (ret_var.is_owned) {
48295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48296 LDKMinFinalCltvExpiry arg_conv;
48297 arg_conv.inner = (void*)(arg & (~1));
48298 arg_conv.is_owned = false;
48299 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48300 int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
48304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48305 LDKMinFinalCltvExpiry orig_conv;
48306 orig_conv.inner = (void*)(orig & (~1));
48307 orig_conv.is_owned = false;
48308 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48309 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
48310 int64_t ret_ref = 0;
48311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48314 ret_ref = (uintptr_t)ret_var.inner;
48315 if (ret_var.is_owned) {
48321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
48322 LDKMinFinalCltvExpiry o_conv;
48323 o_conv.inner = (void*)(o & (~1));
48324 o_conv.is_owned = false;
48325 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48326 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
48330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48331 LDKMinFinalCltvExpiry a_conv;
48332 a_conv.inner = (void*)(a & (~1));
48333 a_conv.is_owned = false;
48334 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48335 LDKMinFinalCltvExpiry b_conv;
48336 b_conv.inner = (void*)(b & (~1));
48337 b_conv.is_owned = false;
48338 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48339 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
48343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48344 if ((this_ptr & 1) != 0) return;
48345 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48346 CHECK_ACCESS(this_ptr_ptr);
48347 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
48348 FREE((void*)this_ptr);
48349 Fallback_free(this_ptr_conv);
48352 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
48353 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48354 *ret_copy = Fallback_clone(arg);
48355 int64_t ret_ref = (uintptr_t)ret_copy;
48358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48359 LDKFallback* arg_conv = (LDKFallback*)arg;
48360 int64_t ret_conv = Fallback_clone_ptr(arg_conv);
48364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48365 LDKFallback* orig_conv = (LDKFallback*)orig;
48366 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48367 *ret_copy = Fallback_clone(orig_conv);
48368 int64_t ret_ref = (uintptr_t)ret_copy;
48372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
48374 LDKCVec_u8Z program_ref;
48375 program_ref.datalen = (*env)->GetArrayLength(env, program);
48376 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
48377 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
48378 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48379 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
48380 int64_t ret_ref = (uintptr_t)ret_copy;
48384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
48385 LDKTwentyBytes a_ref;
48386 CHECK((*env)->GetArrayLength(env, a) == 20);
48387 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
48388 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48389 *ret_copy = Fallback_pub_key_hash(a_ref);
48390 int64_t ret_ref = (uintptr_t)ret_copy;
48394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
48395 LDKTwentyBytes a_ref;
48396 CHECK((*env)->GetArrayLength(env, a) == 20);
48397 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
48398 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48399 *ret_copy = Fallback_script_hash(a_ref);
48400 int64_t ret_ref = (uintptr_t)ret_copy;
48404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
48405 LDKFallback* o_conv = (LDKFallback*)o;
48406 int64_t ret_conv = Fallback_hash(o_conv);
48410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48411 LDKFallback* a_conv = (LDKFallback*)a;
48412 LDKFallback* b_conv = (LDKFallback*)b;
48413 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
48417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48418 LDKInvoiceSignature this_obj_conv;
48419 this_obj_conv.inner = (void*)(this_obj & (~1));
48420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48422 InvoiceSignature_free(this_obj_conv);
48425 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
48426 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
48427 int64_t ret_ref = 0;
48428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48431 ret_ref = (uintptr_t)ret_var.inner;
48432 if (ret_var.is_owned) {
48437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48438 LDKInvoiceSignature arg_conv;
48439 arg_conv.inner = (void*)(arg & (~1));
48440 arg_conv.is_owned = false;
48441 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48442 int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
48446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48447 LDKInvoiceSignature orig_conv;
48448 orig_conv.inner = (void*)(orig & (~1));
48449 orig_conv.is_owned = false;
48450 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48451 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
48452 int64_t ret_ref = 0;
48453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48456 ret_ref = (uintptr_t)ret_var.inner;
48457 if (ret_var.is_owned) {
48463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48464 LDKInvoiceSignature a_conv;
48465 a_conv.inner = (void*)(a & (~1));
48466 a_conv.is_owned = false;
48467 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48468 LDKInvoiceSignature b_conv;
48469 b_conv.inner = (void*)(b & (~1));
48470 b_conv.is_owned = false;
48471 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48472 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
48476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48477 LDKPrivateRoute this_obj_conv;
48478 this_obj_conv.inner = (void*)(this_obj & (~1));
48479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48481 PrivateRoute_free(this_obj_conv);
48484 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
48485 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
48486 int64_t ret_ref = 0;
48487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48490 ret_ref = (uintptr_t)ret_var.inner;
48491 if (ret_var.is_owned) {
48496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48497 LDKPrivateRoute arg_conv;
48498 arg_conv.inner = (void*)(arg & (~1));
48499 arg_conv.is_owned = false;
48500 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48501 int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
48505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48506 LDKPrivateRoute orig_conv;
48507 orig_conv.inner = (void*)(orig & (~1));
48508 orig_conv.is_owned = false;
48509 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48510 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
48511 int64_t ret_ref = 0;
48512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48515 ret_ref = (uintptr_t)ret_var.inner;
48516 if (ret_var.is_owned) {
48522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
48523 LDKPrivateRoute o_conv;
48524 o_conv.inner = (void*)(o & (~1));
48525 o_conv.is_owned = false;
48526 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48527 int64_t ret_conv = PrivateRoute_hash(&o_conv);
48531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48532 LDKPrivateRoute a_conv;
48533 a_conv.inner = (void*)(a & (~1));
48534 a_conv.is_owned = false;
48535 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48536 LDKPrivateRoute b_conv;
48537 b_conv.inner = (void*)(b & (~1));
48538 b_conv.is_owned = false;
48539 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48540 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
48544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
48545 LDKSignedRawInvoice this_arg_conv;
48546 this_arg_conv.inner = (void*)(this_arg & (~1));
48547 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
48548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48549 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
48550 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
48551 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
48552 return ((int64_t)ret_conv);
48555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
48556 LDKSignedRawInvoice this_arg_conv;
48557 this_arg_conv.inner = (void*)(this_arg & (~1));
48558 this_arg_conv.is_owned = false;
48559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48560 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
48561 int64_t ret_ref = 0;
48562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48565 ret_ref = (uintptr_t)ret_var.inner;
48566 if (ret_var.is_owned) {
48572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48573 LDKSignedRawInvoice this_arg_conv;
48574 this_arg_conv.inner = (void*)(this_arg & (~1));
48575 this_arg_conv.is_owned = false;
48576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48577 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
48582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48583 LDKSignedRawInvoice this_arg_conv;
48584 this_arg_conv.inner = (void*)(this_arg & (~1));
48585 this_arg_conv.is_owned = false;
48586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48587 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
48588 int64_t ret_ref = 0;
48589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48592 ret_ref = (uintptr_t)ret_var.inner;
48593 if (ret_var.is_owned) {
48599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48600 LDKSignedRawInvoice this_arg_conv;
48601 this_arg_conv.inner = (void*)(this_arg & (~1));
48602 this_arg_conv.is_owned = false;
48603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48604 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
48605 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
48606 return (int64_t)ret_conv;
48609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48610 LDKSignedRawInvoice this_arg_conv;
48611 this_arg_conv.inner = (void*)(this_arg & (~1));
48612 this_arg_conv.is_owned = false;
48613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48614 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
48618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48619 LDKRawInvoice this_arg_conv;
48620 this_arg_conv.inner = (void*)(this_arg & (~1));
48621 this_arg_conv.is_owned = false;
48622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48623 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
48628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48629 LDKRawInvoice this_arg_conv;
48630 this_arg_conv.inner = (void*)(this_arg & (~1));
48631 this_arg_conv.is_owned = false;
48632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48633 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
48634 int64_t ret_ref = 0;
48635 if ((uintptr_t)ret_var.inner > 4096) {
48636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48639 ret_ref = (uintptr_t)ret_var.inner;
48640 if (ret_var.is_owned) {
48647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
48648 LDKRawInvoice this_arg_conv;
48649 this_arg_conv.inner = (void*)(this_arg & (~1));
48650 this_arg_conv.is_owned = false;
48651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48652 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
48653 int64_t ret_ref = 0;
48654 if ((uintptr_t)ret_var.inner > 4096) {
48655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48658 ret_ref = (uintptr_t)ret_var.inner;
48659 if (ret_var.is_owned) {
48666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48667 LDKRawInvoice this_arg_conv;
48668 this_arg_conv.inner = (void*)(this_arg & (~1));
48669 this_arg_conv.is_owned = false;
48670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48671 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
48672 int64_t ret_ref = 0;
48673 if ((uintptr_t)ret_var.inner > 4096) {
48674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48677 ret_ref = (uintptr_t)ret_var.inner;
48678 if (ret_var.is_owned) {
48685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48686 LDKRawInvoice this_arg_conv;
48687 this_arg_conv.inner = (void*)(this_arg & (~1));
48688 this_arg_conv.is_owned = false;
48689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48690 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
48691 int64_t ret_ref = 0;
48692 if ((uintptr_t)ret_var.inner > 4096) {
48693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48696 ret_ref = (uintptr_t)ret_var.inner;
48697 if (ret_var.is_owned) {
48704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48705 LDKRawInvoice this_arg_conv;
48706 this_arg_conv.inner = (void*)(this_arg & (~1));
48707 this_arg_conv.is_owned = false;
48708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48709 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
48710 int64_t ret_ref = 0;
48711 if ((uintptr_t)ret_var.inner > 4096) {
48712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48715 ret_ref = (uintptr_t)ret_var.inner;
48716 if (ret_var.is_owned) {
48723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
48724 LDKRawInvoice this_arg_conv;
48725 this_arg_conv.inner = (void*)(this_arg & (~1));
48726 this_arg_conv.is_owned = false;
48727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48728 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
48729 int64_t ret_ref = 0;
48730 if ((uintptr_t)ret_var.inner > 4096) {
48731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48734 ret_ref = (uintptr_t)ret_var.inner;
48735 if (ret_var.is_owned) {
48742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
48743 LDKRawInvoice this_arg_conv;
48744 this_arg_conv.inner = (void*)(this_arg & (~1));
48745 this_arg_conv.is_owned = false;
48746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48747 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
48752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48753 LDKRawInvoice this_arg_conv;
48754 this_arg_conv.inner = (void*)(this_arg & (~1));
48755 this_arg_conv.is_owned = false;
48756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48757 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
48758 int64_t ret_ref = 0;
48759 if ((uintptr_t)ret_var.inner > 4096) {
48760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48763 ret_ref = (uintptr_t)ret_var.inner;
48764 if (ret_var.is_owned) {
48771 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
48772 LDKRawInvoice this_arg_conv;
48773 this_arg_conv.inner = (void*)(this_arg & (~1));
48774 this_arg_conv.is_owned = false;
48775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48776 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
48777 int64_tArray ret_arr = NULL;
48778 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48779 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48780 for (size_t o = 0; o < ret_var.datalen; o++) {
48781 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
48782 int64_t ret_conv_14_ref = 0;
48783 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48784 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
48786 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
48787 if (ret_conv_14_var.is_owned) {
48788 ret_conv_14_ref |= 1;
48790 ret_arr_ptr[o] = ret_conv_14_ref;
48792 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48793 FREE(ret_var.data);
48797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
48798 LDKRawInvoice this_arg_conv;
48799 this_arg_conv.inner = (void*)(this_arg & (~1));
48800 this_arg_conv.is_owned = false;
48801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48802 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48803 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
48804 int64_t ret_ref = (uintptr_t)ret_copy;
48808 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
48809 LDKRawInvoice this_arg_conv;
48810 this_arg_conv.inner = (void*)(this_arg & (~1));
48811 this_arg_conv.is_owned = false;
48812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48813 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
48817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
48818 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48819 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
48820 return (int64_t)ret_conv;
48823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
48824 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48825 *ret_conv = PositiveTimestamp_from_system_time(time);
48826 return (int64_t)ret_conv;
48829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
48830 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48831 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
48832 return (int64_t)ret_conv;
48835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
48836 LDKPositiveTimestamp this_arg_conv;
48837 this_arg_conv.inner = (void*)(this_arg & (~1));
48838 this_arg_conv.is_owned = false;
48839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48840 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
48844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
48845 LDKPositiveTimestamp this_arg_conv;
48846 this_arg_conv.inner = (void*)(this_arg & (~1));
48847 this_arg_conv.is_owned = false;
48848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48849 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
48853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48854 LDKPositiveTimestamp this_arg_conv;
48855 this_arg_conv.inner = (void*)(this_arg & (~1));
48856 this_arg_conv.is_owned = false;
48857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48858 int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
48862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
48863 LDKInvoice this_arg_conv;
48864 this_arg_conv.inner = (void*)(this_arg & (~1));
48865 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
48866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48867 this_arg_conv = Invoice_clone(&this_arg_conv);
48868 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
48869 int64_t ret_ref = 0;
48870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48873 ret_ref = (uintptr_t)ret_var.inner;
48874 if (ret_var.is_owned) {
48880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48881 LDKInvoice this_arg_conv;
48882 this_arg_conv.inner = (void*)(this_arg & (~1));
48883 this_arg_conv.is_owned = false;
48884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48885 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
48886 *ret_conv = Invoice_check_signature(&this_arg_conv);
48887 return (int64_t)ret_conv;
48890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
48891 LDKSignedRawInvoice signed_invoice_conv;
48892 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
48893 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
48894 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
48895 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
48896 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
48897 *ret_conv = Invoice_from_signed(signed_invoice_conv);
48898 return (int64_t)ret_conv;
48901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
48902 LDKInvoice this_arg_conv;
48903 this_arg_conv.inner = (void*)(this_arg & (~1));
48904 this_arg_conv.is_owned = false;
48905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48906 int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
48910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
48911 LDKInvoice this_arg_conv;
48912 this_arg_conv.inner = (void*)(this_arg & (~1));
48913 this_arg_conv.is_owned = false;
48914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48915 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
48919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48920 LDKInvoice this_arg_conv;
48921 this_arg_conv.inner = (void*)(this_arg & (~1));
48922 this_arg_conv.is_owned = false;
48923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48924 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48925 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
48929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48930 LDKInvoice this_arg_conv;
48931 this_arg_conv.inner = (void*)(this_arg & (~1));
48932 this_arg_conv.is_owned = false;
48933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48934 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
48939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
48940 LDKInvoice this_arg_conv;
48941 this_arg_conv.inner = (void*)(this_arg & (~1));
48942 this_arg_conv.is_owned = false;
48943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48944 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
48949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48950 LDKInvoice this_arg_conv;
48951 this_arg_conv.inner = (void*)(this_arg & (~1));
48952 this_arg_conv.is_owned = false;
48953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48954 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
48955 int64_t ret_ref = 0;
48956 if ((uintptr_t)ret_var.inner > 4096) {
48957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48960 ret_ref = (uintptr_t)ret_var.inner;
48961 if (ret_var.is_owned) {
48968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48969 LDKInvoice this_arg_conv;
48970 this_arg_conv.inner = (void*)(this_arg & (~1));
48971 this_arg_conv.is_owned = false;
48972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48973 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48974 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
48978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48979 LDKInvoice this_arg_conv;
48980 this_arg_conv.inner = (void*)(this_arg & (~1));
48981 this_arg_conv.is_owned = false;
48982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48983 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
48987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
48988 LDKInvoice this_arg_conv;
48989 this_arg_conv.inner = (void*)(this_arg & (~1));
48990 this_arg_conv.is_owned = false;
48991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48992 jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
48996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
48997 LDKInvoice this_arg_conv;
48998 this_arg_conv.inner = (void*)(this_arg & (~1));
48999 this_arg_conv.is_owned = false;
49000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49001 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
49005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
49006 LDKInvoice this_arg_conv;
49007 this_arg_conv.inner = (void*)(this_arg & (~1));
49008 this_arg_conv.is_owned = false;
49009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49010 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
49014 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
49015 LDKInvoice this_arg_conv;
49016 this_arg_conv.inner = (void*)(this_arg & (~1));
49017 this_arg_conv.is_owned = false;
49018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49019 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
49020 int64_tArray ret_arr = NULL;
49021 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49022 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49023 for (size_t o = 0; o < ret_var.datalen; o++) {
49024 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49025 int64_t ret_conv_14_ref = 0;
49026 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49027 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49029 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
49030 if (ret_conv_14_var.is_owned) {
49031 ret_conv_14_ref |= 1;
49033 ret_arr_ptr[o] = ret_conv_14_ref;
49035 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49036 FREE(ret_var.data);
49040 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
49041 LDKInvoice this_arg_conv;
49042 this_arg_conv.inner = (void*)(this_arg & (~1));
49043 this_arg_conv.is_owned = false;
49044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49045 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
49046 int64_tArray ret_arr = NULL;
49047 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49048 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49049 for (size_t l = 0; l < ret_var.datalen; l++) {
49050 LDKRouteHint ret_conv_11_var = ret_var.data[l];
49051 int64_t ret_conv_11_ref = 0;
49052 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49053 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
49055 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
49056 if (ret_conv_11_var.is_owned) {
49057 ret_conv_11_ref |= 1;
49059 ret_arr_ptr[l] = ret_conv_11_ref;
49061 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49062 FREE(ret_var.data);
49066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
49067 LDKInvoice this_arg_conv;
49068 this_arg_conv.inner = (void*)(this_arg & (~1));
49069 this_arg_conv.is_owned = false;
49070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49071 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
49075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
49076 LDKInvoice this_arg_conv;
49077 this_arg_conv.inner = (void*)(this_arg & (~1));
49078 this_arg_conv.is_owned = false;
49079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49080 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49081 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
49082 int64_t ret_ref = (uintptr_t)ret_copy;
49086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
49087 LDKStr description_conv = java_to_owned_str(env, description);
49088 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
49089 *ret_conv = Description_new(description_conv);
49090 return (int64_t)ret_conv;
49093 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49094 LDKDescription this_arg_conv;
49095 this_arg_conv.inner = (void*)(this_arg & (~1));
49096 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
49097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49098 this_arg_conv = Description_clone(&this_arg_conv);
49099 LDKStr ret_str = Description_into_inner(this_arg_conv);
49100 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
49106 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
49107 int64_t ret_ref = 0;
49108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49111 ret_ref = (uintptr_t)ret_var.inner;
49112 if (ret_var.is_owned) {
49118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
49119 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
49120 int64_t ret_ref = 0;
49121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49124 ret_ref = (uintptr_t)ret_var.inner;
49125 if (ret_var.is_owned) {
49131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
49132 LDKExpiryTime this_arg_conv;
49133 this_arg_conv.inner = (void*)(this_arg & (~1));
49134 this_arg_conv.is_owned = false;
49135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49136 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
49140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
49141 LDKExpiryTime this_arg_conv;
49142 this_arg_conv.inner = (void*)(this_arg & (~1));
49143 this_arg_conv.is_owned = false;
49144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49145 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
49149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
49150 LDKRouteHint hops_conv;
49151 hops_conv.inner = (void*)(hops & (~1));
49152 hops_conv.is_owned = (hops & 1) || (hops == 0);
49153 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
49154 hops_conv = RouteHint_clone(&hops_conv);
49155 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
49156 *ret_conv = PrivateRoute_new(hops_conv);
49157 return (int64_t)ret_conv;
49160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49161 LDKPrivateRoute this_arg_conv;
49162 this_arg_conv.inner = (void*)(this_arg & (~1));
49163 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
49164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49165 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
49166 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
49167 int64_t ret_ref = 0;
49168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49171 ret_ref = (uintptr_t)ret_var.inner;
49172 if (ret_var.is_owned) {
49178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49179 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
49180 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
49184 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
49185 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
49189 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
49190 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
49194 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
49195 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
49199 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
49200 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
49204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
49205 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
49209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49210 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
49211 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
49212 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
49216 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49217 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
49218 LDKStr ret_str = CreationError_to_str(o_conv);
49219 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49225 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
49226 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
49230 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
49231 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
49235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
49236 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
49240 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
49241 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
49245 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
49246 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
49250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
49251 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
49255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
49256 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
49260 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
49261 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
49265 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
49266 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
49270 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
49271 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
49275 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
49276 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
49280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49281 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
49282 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
49283 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
49287 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49288 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
49289 LDKStr ret_str = SemanticError_to_str(o_conv);
49290 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49296 if ((this_ptr & 1) != 0) return;
49297 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49298 CHECK_ACCESS(this_ptr_ptr);
49299 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
49300 FREE((void*)this_ptr);
49301 SignOrCreationError_free(this_ptr_conv);
49304 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
49305 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49306 *ret_copy = SignOrCreationError_clone(arg);
49307 int64_t ret_ref = (uintptr_t)ret_copy;
49310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49311 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
49312 int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
49316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49317 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
49318 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49319 *ret_copy = SignOrCreationError_clone(orig_conv);
49320 int64_t ret_ref = (uintptr_t)ret_copy;
49324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
49325 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49326 *ret_copy = SignOrCreationError_sign_error();
49327 int64_t ret_ref = (uintptr_t)ret_copy;
49331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
49332 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
49333 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49334 *ret_copy = SignOrCreationError_creation_error(a_conv);
49335 int64_t ret_ref = (uintptr_t)ret_copy;
49339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49340 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
49341 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
49342 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
49346 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49347 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
49348 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
49349 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49355 LDKInvoicePayer this_obj_conv;
49356 this_obj_conv.inner = (void*)(this_obj & (~1));
49357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49359 InvoicePayer_free(this_obj_conv);
49362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49363 if ((this_ptr & 1) != 0) return;
49364 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49365 CHECK_ACCESS(this_ptr_ptr);
49366 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
49367 FREE((void*)this_ptr);
49368 Payer_free(this_ptr_conv);
49371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49372 if ((this_ptr & 1) != 0) return;
49373 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49374 CHECK_ACCESS(this_ptr_ptr);
49375 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
49376 FREE((void*)this_ptr);
49377 Router_free(this_ptr_conv);
49380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49381 if ((this_ptr & 1) != 0) return;
49382 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49383 CHECK_ACCESS(this_ptr_ptr);
49384 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
49385 FREE((void*)this_ptr);
49386 Retry_free(this_ptr_conv);
49389 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
49390 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49391 *ret_copy = Retry_clone(arg);
49392 int64_t ret_ref = (uintptr_t)ret_copy;
49395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49396 LDKRetry* arg_conv = (LDKRetry*)arg;
49397 int64_t ret_conv = Retry_clone_ptr(arg_conv);
49401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49402 LDKRetry* orig_conv = (LDKRetry*)orig;
49403 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49404 *ret_copy = Retry_clone(orig_conv);
49405 int64_t ret_ref = (uintptr_t)ret_copy;
49409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
49410 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49411 *ret_copy = Retry_attempts(a);
49412 int64_t ret_ref = (uintptr_t)ret_copy;
49416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
49417 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49418 *ret_copy = Retry_timeout(a);
49419 int64_t ret_ref = (uintptr_t)ret_copy;
49423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49424 LDKRetry* a_conv = (LDKRetry*)a;
49425 LDKRetry* b_conv = (LDKRetry*)b;
49426 jboolean ret_conv = Retry_eq(a_conv, b_conv);
49430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
49431 LDKRetry* o_conv = (LDKRetry*)o;
49432 int64_t ret_conv = Retry_hash(o_conv);
49436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49437 if ((this_ptr & 1) != 0) return;
49438 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49439 CHECK_ACCESS(this_ptr_ptr);
49440 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
49441 FREE((void*)this_ptr);
49442 PaymentError_free(this_ptr_conv);
49445 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
49446 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49447 *ret_copy = PaymentError_clone(arg);
49448 int64_t ret_ref = (uintptr_t)ret_copy;
49451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49452 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
49453 int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
49457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49458 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
49459 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49460 *ret_copy = PaymentError_clone(orig_conv);
49461 int64_t ret_ref = (uintptr_t)ret_copy;
49465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
49466 LDKStr a_conv = java_to_owned_str(env, a);
49467 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49468 *ret_copy = PaymentError_invoice(a_conv);
49469 int64_t ret_ref = (uintptr_t)ret_copy;
49473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
49474 LDKLightningError a_conv;
49475 a_conv.inner = (void*)(a & (~1));
49476 a_conv.is_owned = (a & 1) || (a == 0);
49477 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49478 a_conv = LightningError_clone(&a_conv);
49479 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49480 *ret_copy = PaymentError_routing(a_conv);
49481 int64_t ret_ref = (uintptr_t)ret_copy;
49485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
49486 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
49487 CHECK_ACCESS(a_ptr);
49488 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
49489 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
49490 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49491 *ret_copy = PaymentError_sending(a_conv);
49492 int64_t ret_ref = (uintptr_t)ret_copy;
49496 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) {
49497 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
49498 CHECK_ACCESS(payer_ptr);
49499 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
49500 if (payer_conv.free == LDKPayer_JCalls_free) {
49501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49502 LDKPayer_JCalls_cloned(&payer_conv);
49504 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
49505 CHECK_ACCESS(router_ptr);
49506 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
49507 if (router_conv.free == LDKRouter_JCalls_free) {
49508 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49509 LDKRouter_JCalls_cloned(&router_conv);
49511 LDKMultiThreadedLockableScore scorer_conv;
49512 scorer_conv.inner = (void*)(scorer & (~1));
49513 scorer_conv.is_owned = false;
49514 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
49515 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
49516 CHECK_ACCESS(logger_ptr);
49517 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49518 if (logger_conv.free == LDKLogger_JCalls_free) {
49519 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49520 LDKLogger_JCalls_cloned(&logger_conv);
49522 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
49523 CHECK_ACCESS(event_handler_ptr);
49524 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
49525 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
49526 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49527 LDKEventHandler_JCalls_cloned(&event_handler_conv);
49529 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
49530 CHECK_ACCESS(retry_ptr);
49531 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
49532 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
49533 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
49534 int64_t ret_ref = 0;
49535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49538 ret_ref = (uintptr_t)ret_var.inner;
49539 if (ret_var.is_owned) {
49545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
49546 LDKInvoicePayer this_arg_conv;
49547 this_arg_conv.inner = (void*)(this_arg & (~1));
49548 this_arg_conv.is_owned = false;
49549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49550 LDKInvoice invoice_conv;
49551 invoice_conv.inner = (void*)(invoice & (~1));
49552 invoice_conv.is_owned = false;
49553 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
49554 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49555 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
49556 return (int64_t)ret_conv;
49559 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) {
49560 LDKInvoicePayer this_arg_conv;
49561 this_arg_conv.inner = (void*)(this_arg & (~1));
49562 this_arg_conv.is_owned = false;
49563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49564 LDKInvoice invoice_conv;
49565 invoice_conv.inner = (void*)(invoice & (~1));
49566 invoice_conv.is_owned = false;
49567 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
49568 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49569 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
49570 return (int64_t)ret_conv;
49573 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) {
49574 LDKInvoicePayer this_arg_conv;
49575 this_arg_conv.inner = (void*)(this_arg & (~1));
49576 this_arg_conv.is_owned = false;
49577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49578 LDKPublicKey pubkey_ref;
49579 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
49580 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
49581 LDKThirtyTwoBytes payment_preimage_ref;
49582 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
49583 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
49584 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49585 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
49586 return (int64_t)ret_conv;
49589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
49590 LDKInvoicePayer this_arg_conv;
49591 this_arg_conv.inner = (void*)(this_arg & (~1));
49592 this_arg_conv.is_owned = false;
49593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49594 unsigned char payment_hash_arr[32];
49595 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49596 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
49597 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
49598 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
49601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49602 LDKInvoicePayer this_arg_conv;
49603 this_arg_conv.inner = (void*)(this_arg & (~1));
49604 this_arg_conv.is_owned = false;
49605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49606 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
49607 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
49608 return (int64_t)ret_ret;
49611 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) {
49612 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49613 CHECK_ACCESS(amt_msat_ptr);
49614 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49615 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49616 LDKThirtyTwoBytes payment_hash_ref;
49617 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49618 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
49619 LDKStr description_conv = java_to_owned_str(env, description);
49620 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
49621 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
49622 if (phantom_route_hints_constr.datalen > 0)
49623 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
49625 phantom_route_hints_constr.data = NULL;
49626 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
49627 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
49628 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
49629 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
49630 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
49631 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
49632 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
49633 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
49634 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
49636 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
49637 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49638 CHECK_ACCESS(keys_manager_ptr);
49639 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49640 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49641 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49642 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49644 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49645 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49646 *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);
49647 return (int64_t)ret_conv;
49650 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) {
49651 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49652 CHECK_ACCESS(amt_msat_ptr);
49653 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49654 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49655 LDKThirtyTwoBytes payment_hash_ref;
49656 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49657 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
49658 LDKSha256 description_hash_conv;
49659 description_hash_conv.inner = (void*)(description_hash & (~1));
49660 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49661 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49662 description_hash_conv = Sha256_clone(&description_hash_conv);
49663 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
49664 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
49665 if (phantom_route_hints_constr.datalen > 0)
49666 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
49668 phantom_route_hints_constr.data = NULL;
49669 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
49670 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
49671 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
49672 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
49673 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
49674 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
49675 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
49676 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
49677 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
49679 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
49680 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49681 CHECK_ACCESS(keys_manager_ptr);
49682 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49683 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49684 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49685 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49687 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49688 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49689 *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);
49690 return (int64_t)ret_conv;
49693 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) {
49694 LDKChannelManager channelmanager_conv;
49695 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49696 channelmanager_conv.is_owned = false;
49697 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49698 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49699 CHECK_ACCESS(keys_manager_ptr);
49700 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49701 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49702 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49703 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49705 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49706 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49707 CHECK_ACCESS(amt_msat_ptr);
49708 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49709 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49710 LDKStr description_conv = java_to_owned_str(env, description);
49711 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49712 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
49713 return (int64_t)ret_conv;
49716 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) {
49717 LDKChannelManager channelmanager_conv;
49718 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49719 channelmanager_conv.is_owned = false;
49720 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49721 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49722 CHECK_ACCESS(keys_manager_ptr);
49723 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49724 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49725 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49726 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49728 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49729 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49730 CHECK_ACCESS(amt_msat_ptr);
49731 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49732 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49733 LDKSha256 description_hash_conv;
49734 description_hash_conv.inner = (void*)(description_hash & (~1));
49735 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49736 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49737 description_hash_conv = Sha256_clone(&description_hash_conv);
49738 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49739 *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);
49740 return (int64_t)ret_conv;
49743 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) {
49744 LDKChannelManager channelmanager_conv;
49745 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49746 channelmanager_conv.is_owned = false;
49747 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49748 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49749 CHECK_ACCESS(keys_manager_ptr);
49750 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49751 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49752 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49753 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49755 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49756 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49757 CHECK_ACCESS(amt_msat_ptr);
49758 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49759 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49760 LDKSha256 description_hash_conv;
49761 description_hash_conv.inner = (void*)(description_hash & (~1));
49762 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49763 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49764 description_hash_conv = Sha256_clone(&description_hash_conv);
49765 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49766 *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);
49767 return (int64_t)ret_conv;
49770 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) {
49771 LDKChannelManager channelmanager_conv;
49772 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49773 channelmanager_conv.is_owned = false;
49774 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49775 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49776 CHECK_ACCESS(keys_manager_ptr);
49777 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49778 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49779 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49780 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49782 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49783 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49784 CHECK_ACCESS(amt_msat_ptr);
49785 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49786 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49787 LDKStr description_conv = java_to_owned_str(env, description);
49788 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49789 *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);
49790 return (int64_t)ret_conv;
49793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49794 LDKDefaultRouter this_obj_conv;
49795 this_obj_conv.inner = (void*)(this_obj & (~1));
49796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49798 DefaultRouter_free(this_obj_conv);
49801 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) {
49802 LDKNetworkGraph network_graph_conv;
49803 network_graph_conv.inner = (void*)(network_graph & (~1));
49804 network_graph_conv.is_owned = false;
49805 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
49806 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
49807 CHECK_ACCESS(logger_ptr);
49808 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49809 if (logger_conv.free == LDKLogger_JCalls_free) {
49810 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49811 LDKLogger_JCalls_cloned(&logger_conv);
49813 LDKThirtyTwoBytes random_seed_bytes_ref;
49814 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
49815 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
49816 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
49817 int64_t ret_ref = 0;
49818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49821 ret_ref = (uintptr_t)ret_var.inner;
49822 if (ret_var.is_owned) {
49828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
49829 LDKDefaultRouter this_arg_conv;
49830 this_arg_conv.inner = (void*)(this_arg & (~1));
49831 this_arg_conv.is_owned = false;
49832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49833 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
49834 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
49835 return (int64_t)ret_ret;
49838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
49839 LDKChannelManager this_arg_conv;
49840 this_arg_conv.inner = (void*)(this_arg & (~1));
49841 this_arg_conv.is_owned = false;
49842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49843 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
49844 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
49845 return (int64_t)ret_ret;
49848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49849 LDKStr s_conv = java_to_owned_str(env, s);
49850 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
49851 *ret_conv = SiPrefix_from_str(s_conv);
49852 return (int64_t)ret_conv;
49855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49856 LDKStr s_conv = java_to_owned_str(env, s);
49857 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
49858 *ret_conv = Invoice_from_str(s_conv);
49859 return (int64_t)ret_conv;
49862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49863 LDKStr s_conv = java_to_owned_str(env, s);
49864 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
49865 *ret_conv = SignedRawInvoice_from_str(s_conv);
49866 return (int64_t)ret_conv;
49869 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49870 LDKParseError* o_conv = (LDKParseError*)o;
49871 LDKStr ret_str = ParseError_to_str(o_conv);
49872 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49877 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49878 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
49879 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
49880 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49885 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49887 o_conv.inner = (void*)(o & (~1));
49888 o_conv.is_owned = false;
49889 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49890 LDKStr ret_str = Invoice_to_str(&o_conv);
49891 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49896 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49897 LDKSignedRawInvoice o_conv;
49898 o_conv.inner = (void*)(o & (~1));
49899 o_conv.is_owned = false;
49900 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49901 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
49902 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49907 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49908 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
49909 LDKStr ret_str = Currency_to_str(o_conv);
49910 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49915 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49916 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
49917 LDKStr ret_str = SiPrefix_to_str(o_conv);
49918 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49924 LDKRapidGossipSync this_obj_conv;
49925 this_obj_conv.inner = (void*)(this_obj & (~1));
49926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49928 RapidGossipSync_free(this_obj_conv);
49931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
49932 LDKNetworkGraph network_graph_conv;
49933 network_graph_conv.inner = (void*)(network_graph & (~1));
49934 network_graph_conv.is_owned = false;
49935 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
49936 LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
49937 int64_t ret_ref = 0;
49938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49941 ret_ref = (uintptr_t)ret_var.inner;
49942 if (ret_var.is_owned) {
49948 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) {
49949 LDKRapidGossipSync this_arg_conv;
49950 this_arg_conv.inner = (void*)(this_arg & (~1));
49951 this_arg_conv.is_owned = false;
49952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49953 LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
49954 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
49955 *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
49956 return (int64_t)ret_conv;
49959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
49960 LDKRapidGossipSync this_arg_conv;
49961 this_arg_conv.inner = (void*)(this_arg & (~1));
49962 this_arg_conv.is_owned = false;
49963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49964 jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
49968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49969 if ((this_ptr & 1) != 0) return;
49970 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49971 CHECK_ACCESS(this_ptr_ptr);
49972 LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
49973 FREE((void*)this_ptr);
49974 GraphSyncError_free(this_ptr_conv);
49977 static inline uintptr_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
49978 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
49979 *ret_copy = GraphSyncError_clone(arg);
49980 int64_t ret_ref = (uintptr_t)ret_copy;
49983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49984 LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)arg;
49985 int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
49989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49990 LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)orig;
49991 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
49992 *ret_copy = GraphSyncError_clone(orig_conv);
49993 int64_t ret_ref = (uintptr_t)ret_copy;
49997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
49998 LDKDecodeError a_conv;
49999 a_conv.inner = (void*)(a & (~1));
50000 a_conv.is_owned = (a & 1) || (a == 0);
50001 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50002 a_conv = DecodeError_clone(&a_conv);
50003 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50004 *ret_copy = GraphSyncError_decode_error(a_conv);
50005 int64_t ret_ref = (uintptr_t)ret_copy;
50009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
50010 LDKLightningError a_conv;
50011 a_conv.inner = (void*)(a & (~1));
50012 a_conv.is_owned = (a & 1) || (a == 0);
50013 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50014 a_conv = LightningError_clone(&a_conv);
50015 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50016 *ret_copy = GraphSyncError_lightning_error(a_conv);
50017 int64_t ret_ref = (uintptr_t)ret_copy;
50021 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) {
50022 LDKRapidGossipSync this_arg_conv;
50023 this_arg_conv.inner = (void*)(this_arg & (~1));
50024 this_arg_conv.is_owned = false;
50025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50026 LDKu8slice update_data_ref;
50027 update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
50028 update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
50029 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50030 *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
50031 (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
50032 return (int64_t)ret_conv;