1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
8 #define MALLOC(a, _) malloc(a)
9 #define FREE(p) if ((long)(p) > 1024) { free(p); }
10 #define DO_ASSERT(a) (void)(a)
13 static jmethodID ordinal_meth = NULL;
14 static jmethodID slicedef_meth = NULL;
15 static jclass slicedef_cls = NULL;
16 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
17 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
18 CHECK(ordinal_meth != NULL);
19 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
20 CHECK(slicedef_meth != NULL);
21 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
22 CHECK(slicedef_cls != NULL);
25 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
28 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
35 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
36 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
39 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
40 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
41 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
42 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
45 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
46 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
47 vec->datalen = (*env)->GetArrayLength(env, bytes);
48 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
49 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
52 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
53 LDKTransaction *txdata = (LDKTransaction*)ptr;
55 slice.data = txdata->data;
56 slice.datalen = txdata->datalen;
57 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
59 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
60 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
61 txdata->datalen = (*env)->GetArrayLength(env, bytes);
62 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
63 txdata->data_is_owned = false;
64 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
67 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
68 LDKTransaction *tx = (LDKTransaction*)ptr;
69 tx->data_is_owned = true;
70 Transaction_free(*tx);
73 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
74 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
75 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
76 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
77 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
79 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
80 return (long)vec->datalen;
82 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
83 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
84 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
85 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
86 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
88 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
94 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
96 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
97 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
100 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
101 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
103 typedef jlongArray int64_tArray;
104 typedef jbyteArray int8_tArray;
106 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
107 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
108 char* err_buf = MALLOC(len + 1, "str conv buf");
109 memcpy(err_buf, chars, len);
111 jstring err_conv = (*env)->NewStringUTF(env, chars);
115 static jclass arr_of_J_clz = NULL;
116 static jclass arr_of_B_clz = NULL;
117 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
118 arr_of_J_clz = (*env)->FindClass(env, "[J");
119 CHECK(arr_of_J_clz != NULL);
120 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
121 arr_of_B_clz = (*env)->FindClass(env, "[B");
122 CHECK(arr_of_B_clz != NULL);
123 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
125 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
126 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
127 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
128 case 0: return LDKAccessError_UnknownChain;
129 case 1: return LDKAccessError_UnknownTx;
133 static jclass LDKAccessError_class = NULL;
134 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
135 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
136 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv *env, jclass clz) {
137 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
138 CHECK(LDKAccessError_class != NULL);
139 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
140 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
141 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
142 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
144 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
146 case LDKAccessError_UnknownChain:
147 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
148 case LDKAccessError_UnknownTx:
149 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
154 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
155 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
156 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
157 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
161 static jclass LDKChannelMonitorUpdateErr_class = NULL;
162 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
163 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
164 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
165 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
166 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
167 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
168 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
169 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
170 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
172 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
174 case LDKChannelMonitorUpdateErr_TemporaryFailure:
175 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
176 case LDKChannelMonitorUpdateErr_PermanentFailure:
177 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
182 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
183 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
184 case 0: return LDKConfirmationTarget_Background;
185 case 1: return LDKConfirmationTarget_Normal;
186 case 2: return LDKConfirmationTarget_HighPriority;
190 static jclass LDKConfirmationTarget_class = NULL;
191 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
192 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
193 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
194 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv *env, jclass clz) {
195 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
196 CHECK(LDKConfirmationTarget_class != NULL);
197 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
198 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
199 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
200 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
201 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
202 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
204 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
206 case LDKConfirmationTarget_Background:
207 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
208 case LDKConfirmationTarget_Normal:
209 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
210 case LDKConfirmationTarget_HighPriority:
211 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
216 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
217 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
218 case 0: return LDKLevel_Off;
219 case 1: return LDKLevel_Error;
220 case 2: return LDKLevel_Warn;
221 case 3: return LDKLevel_Info;
222 case 4: return LDKLevel_Debug;
223 case 5: return LDKLevel_Trace;
227 static jclass LDKLevel_class = NULL;
228 static jfieldID LDKLevel_LDKLevel_Off = NULL;
229 static jfieldID LDKLevel_LDKLevel_Error = NULL;
230 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
231 static jfieldID LDKLevel_LDKLevel_Info = NULL;
232 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
233 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
234 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv *env, jclass clz) {
235 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
236 CHECK(LDKLevel_class != NULL);
237 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
238 CHECK(LDKLevel_LDKLevel_Off != NULL);
239 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
240 CHECK(LDKLevel_LDKLevel_Error != NULL);
241 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
242 CHECK(LDKLevel_LDKLevel_Warn != NULL);
243 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
244 CHECK(LDKLevel_LDKLevel_Info != NULL);
245 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
246 CHECK(LDKLevel_LDKLevel_Debug != NULL);
247 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
248 CHECK(LDKLevel_LDKLevel_Trace != NULL);
250 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
253 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
255 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
257 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
259 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
261 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
263 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
268 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
269 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
270 case 0: return LDKNetwork_Bitcoin;
271 case 1: return LDKNetwork_Testnet;
272 case 2: return LDKNetwork_Regtest;
276 static jclass LDKNetwork_class = NULL;
277 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
278 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
279 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
280 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
281 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
282 CHECK(LDKNetwork_class != NULL);
283 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
284 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
285 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
286 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
287 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
288 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
290 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
292 case LDKNetwork_Bitcoin:
293 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
294 case LDKNetwork_Testnet:
295 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
296 case LDKNetwork_Regtest:
297 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
302 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
303 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
304 case 0: return LDKSecp256k1Error_IncorrectSignature;
305 case 1: return LDKSecp256k1Error_InvalidMessage;
306 case 2: return LDKSecp256k1Error_InvalidPublicKey;
307 case 3: return LDKSecp256k1Error_InvalidSignature;
308 case 4: return LDKSecp256k1Error_InvalidSecretKey;
309 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
310 case 6: return LDKSecp256k1Error_InvalidTweak;
311 case 7: return LDKSecp256k1Error_NotEnoughMemory;
312 case 8: return LDKSecp256k1Error_CallbackPanicked;
316 static jclass LDKSecp256k1Error_class = NULL;
317 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
318 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
319 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
320 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
321 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
322 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
323 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
324 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
325 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
326 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
327 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
328 CHECK(LDKSecp256k1Error_class != NULL);
329 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
330 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
331 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
332 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
333 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
334 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
335 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
336 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
337 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
338 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
339 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
340 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
341 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
342 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
343 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
344 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
345 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
346 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
348 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
350 case LDKSecp256k1Error_IncorrectSignature:
351 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
352 case LDKSecp256k1Error_InvalidMessage:
353 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
354 case LDKSecp256k1Error_InvalidPublicKey:
355 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
356 case LDKSecp256k1Error_InvalidSignature:
357 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
358 case LDKSecp256k1Error_InvalidSecretKey:
359 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
360 case LDKSecp256k1Error_InvalidRecoveryId:
361 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
362 case LDKSecp256k1Error_InvalidTweak:
363 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
364 case LDKSecp256k1Error_NotEnoughMemory:
365 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
366 case LDKSecp256k1Error_CallbackPanicked:
367 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
373 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
374 ret->datalen = (*env)->GetArrayLength(env, elems);
375 if (ret->datalen == 0) {
378 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
379 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
380 for (size_t i = 0; i < ret->datalen; i++) {
381 ret->data[i] = java_elems[i];
383 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
387 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
388 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
389 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
393 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
396 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
397 CHECK(val->result_ok);
398 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
399 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
402 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
403 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
404 CHECK(!val->result_ok);
405 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
409 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
412 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
413 CHECK(val->result_ok);
414 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
415 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
418 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
419 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
420 CHECK(!val->result_ok);
421 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
425 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
428 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
429 CHECK(val->result_ok);
430 LDKTxCreationKeys res_var = (*val->contents.result);
431 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
432 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
433 long res_ref = (long)res_var.inner & ~1;
436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
437 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
438 CHECK(!val->result_ok);
439 LDKDecodeError err_var = (*val->contents.err);
440 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
441 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
442 long err_ref = (long)err_var.inner & ~1;
445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
446 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
449 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
450 CHECK(val->result_ok);
451 LDKChannelPublicKeys res_var = (*val->contents.result);
452 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
453 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
454 long res_ref = (long)res_var.inner & ~1;
457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
458 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
459 CHECK(!val->result_ok);
460 LDKDecodeError err_var = (*val->contents.err);
461 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
462 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
463 long err_ref = (long)err_var.inner & ~1;
466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
467 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
470 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
471 CHECK(val->result_ok);
472 LDKTxCreationKeys res_var = (*val->contents.result);
473 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
474 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
475 long res_ref = (long)res_var.inner & ~1;
478 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
479 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
480 CHECK(!val->result_ok);
481 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
485 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
488 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
489 CHECK(val->result_ok);
490 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
491 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
492 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
493 long res_ref = (long)res_var.inner & ~1;
496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
497 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
498 CHECK(!val->result_ok);
499 LDKDecodeError err_var = (*val->contents.err);
500 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
501 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
502 long err_ref = (long)err_var.inner & ~1;
505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
506 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
509 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
510 CHECK(val->result_ok);
511 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
512 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
513 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
514 long res_ref = (long)res_var.inner & ~1;
517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
518 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
519 CHECK(!val->result_ok);
520 LDKDecodeError err_var = (*val->contents.err);
521 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
522 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
523 long err_ref = (long)err_var.inner & ~1;
526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
527 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
530 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
531 CHECK(val->result_ok);
532 LDKChannelTransactionParameters res_var = (*val->contents.result);
533 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
534 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
535 long res_ref = (long)res_var.inner & ~1;
538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
539 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
540 CHECK(!val->result_ok);
541 LDKDecodeError err_var = (*val->contents.err);
542 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
543 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
544 long err_ref = (long)err_var.inner & ~1;
547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
548 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
551 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
552 CHECK(val->result_ok);
553 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
554 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
555 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
556 long res_ref = (long)res_var.inner & ~1;
559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
560 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
561 CHECK(!val->result_ok);
562 LDKDecodeError err_var = (*val->contents.err);
563 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
564 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
565 long err_ref = (long)err_var.inner & ~1;
568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
569 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
572 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
573 CHECK(val->result_ok);
574 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
575 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
576 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
577 long res_ref = (long)res_var.inner & ~1;
580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
581 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
582 CHECK(!val->result_ok);
583 LDKDecodeError err_var = (*val->contents.err);
584 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
585 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
586 long err_ref = (long)err_var.inner & ~1;
589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
590 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
593 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
594 CHECK(val->result_ok);
595 LDKCommitmentTransaction res_var = (*val->contents.result);
596 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
597 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
598 long res_ref = (long)res_var.inner & ~1;
601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
602 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
603 CHECK(!val->result_ok);
604 LDKDecodeError err_var = (*val->contents.err);
605 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
606 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
607 long err_ref = (long)err_var.inner & ~1;
610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
611 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
614 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
615 CHECK(val->result_ok);
616 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
617 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
618 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
619 long res_ref = (long)res_var.inner & ~1;
622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
623 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
624 CHECK(!val->result_ok);
625 return *val->contents.err;
627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
628 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
630 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
631 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
632 CHECK(val->result_ok);
633 LDKCVec_SignatureZ res_var = (*val->contents.result);
634 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
636 for (size_t i = 0; i < res_var.datalen; i++) {
637 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
638 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
639 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
644 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
645 CHECK(!val->result_ok);
646 return *val->contents.err;
648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
649 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
652 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
653 CHECK(val->result_ok);
654 LDKCVec_u8Z res_var = (*val->contents.result);
655 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
656 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
660 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
661 CHECK(!val->result_ok);
662 LDKPeerHandleError err_var = (*val->contents.err);
663 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
664 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
665 long err_ref = (long)err_var.inner & ~1;
668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
669 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
672 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
673 CHECK(val->result_ok);
674 return *val->contents.result;
676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
677 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
678 CHECK(!val->result_ok);
679 LDKPeerHandleError err_var = (*val->contents.err);
680 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
681 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
682 long err_ref = (long)err_var.inner & ~1;
685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
686 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
689 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
690 CHECK(val->result_ok);
691 return *val->contents.result;
693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
694 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
695 CHECK(!val->result_ok);
696 LDKPeerHandleError err_var = (*val->contents.err);
697 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
698 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
699 long err_ref = (long)err_var.inner & ~1;
702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
703 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
706 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
707 CHECK(val->result_ok);
708 LDKInitFeatures res_var = (*val->contents.result);
709 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
710 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
711 long res_ref = (long)res_var.inner & ~1;
714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
715 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
716 CHECK(!val->result_ok);
717 LDKDecodeError err_var = (*val->contents.err);
718 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
719 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
720 long err_ref = (long)err_var.inner & ~1;
723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
724 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
727 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
728 CHECK(val->result_ok);
729 LDKNodeFeatures res_var = (*val->contents.result);
730 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
731 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
732 long res_ref = (long)res_var.inner & ~1;
735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
736 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
737 CHECK(!val->result_ok);
738 LDKDecodeError err_var = (*val->contents.err);
739 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
740 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
741 long err_ref = (long)err_var.inner & ~1;
744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
745 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
748 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
749 CHECK(val->result_ok);
750 LDKChannelFeatures res_var = (*val->contents.result);
751 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
752 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
753 long res_ref = (long)res_var.inner & ~1;
756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
757 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
758 CHECK(!val->result_ok);
759 LDKDecodeError err_var = (*val->contents.err);
760 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
761 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 long err_ref = (long)err_var.inner & ~1;
765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
766 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
769 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
770 CHECK(val->result_ok);
771 LDKChannelConfig res_var = (*val->contents.result);
772 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
773 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
774 long res_ref = (long)res_var.inner & ~1;
777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
778 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
779 CHECK(!val->result_ok);
780 LDKDecodeError err_var = (*val->contents.err);
781 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
782 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
783 long err_ref = (long)err_var.inner & ~1;
786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
787 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
789 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
790 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
791 CHECK(val->result_ok);
792 return *val->contents.result;
794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
795 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
796 CHECK(!val->result_ok);
797 LDKLightningError err_var = (*val->contents.err);
798 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
800 long err_ref = (long)err_var.inner & ~1;
803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
804 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
805 LDKChannelAnnouncement a_conv;
806 a_conv.inner = (void*)(a & (~1));
807 a_conv.is_owned = (a & 1) || (a == 0);
808 a_conv = ChannelAnnouncement_clone(&a_conv);
810 LDKChannelUpdate b_conv;
811 b_conv.inner = (void*)(b & (~1));
812 b_conv.is_owned = (b & 1) || (b == 0);
813 b_conv = ChannelUpdate_clone(&b_conv);
815 LDKChannelUpdate c_conv;
816 c_conv.inner = (void*)(c & (~1));
817 c_conv.is_owned = (c & 1) || (c == 0);
818 c_conv = ChannelUpdate_clone(&c_conv);
822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
823 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
824 LDKChannelAnnouncement a_var = tuple->a;
825 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
826 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
827 long a_ref = (long)a_var.inner & ~1;
830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
831 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
832 LDKChannelUpdate b_var = tuple->b;
833 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
834 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
835 long b_ref = (long)b_var.inner & ~1;
838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
839 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
840 LDKChannelUpdate c_var = tuple->c;
841 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
842 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
843 long c_ref = (long)c_var.inner & ~1;
846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
847 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
848 ret->datalen = (*env)->GetArrayLength(env, elems);
849 if (ret->datalen == 0) {
852 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
853 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
854 for (size_t i = 0; i < ret->datalen; i++) {
855 int64_t arr_elem = java_elems[i];
856 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
857 FREE((void*)arr_elem);
858 ret->data[i] = arr_elem_conv;
860 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
864 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
865 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
866 for (size_t i = 0; i < ret.datalen; i++) {
867 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
872 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
873 ret->datalen = (*env)->GetArrayLength(env, elems);
874 if (ret->datalen == 0) {
877 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
878 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
879 for (size_t i = 0; i < ret->datalen; i++) {
880 int64_t arr_elem = java_elems[i];
881 LDKNodeAnnouncement arr_elem_conv;
882 arr_elem_conv.inner = (void*)(arr_elem & (~1));
883 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
884 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
885 ret->data[i] = arr_elem_conv;
887 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
891 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
892 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
893 for (size_t i = 0; i < ret.datalen; i++) {
894 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
899 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
902 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
903 CHECK(val->result_ok);
904 return *val->contents.result;
906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
907 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
908 CHECK(!val->result_ok);
909 LDKLightningError err_var = (*val->contents.err);
910 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 long err_ref = (long)err_var.inner & ~1;
915 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
916 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
917 static jclass LDKErrorAction_IgnoreError_class = NULL;
918 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
919 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
920 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
922 LDKErrorAction_DisconnectPeer_class =
923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
924 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
925 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
926 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
927 LDKErrorAction_IgnoreError_class =
928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
929 CHECK(LDKErrorAction_IgnoreError_class != NULL);
930 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
931 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
932 LDKErrorAction_SendErrorMessage_class =
933 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
934 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
935 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
936 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
938 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
939 LDKErrorAction *obj = (LDKErrorAction*)ptr;
941 case LDKErrorAction_DisconnectPeer: {
942 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
943 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 long msg_ref = (long)msg_var.inner & ~1;
946 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
948 case LDKErrorAction_IgnoreError: {
949 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
951 case LDKErrorAction_SendErrorMessage: {
952 LDKErrorMessage msg_var = obj->send_error_message.msg;
953 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
954 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
955 long msg_ref = (long)msg_var.inner & ~1;
956 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
961 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
962 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
963 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
964 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
965 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
966 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
968 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
969 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
970 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
971 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
972 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
973 LDKHTLCFailChannelUpdate_ChannelClosed_class =
974 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
975 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
976 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
977 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
978 LDKHTLCFailChannelUpdate_NodeFailure_class =
979 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
980 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
981 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
982 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
984 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
985 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
987 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
988 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
989 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
990 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
991 long msg_ref = (long)msg_var.inner & ~1;
992 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
994 case LDKHTLCFailChannelUpdate_ChannelClosed: {
995 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
997 case LDKHTLCFailChannelUpdate_NodeFailure: {
998 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
999 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1000 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1005 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1006 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1007 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1008 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1009 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1010 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1011 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1012 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1013 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1014 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1015 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1016 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1017 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1018 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1019 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1020 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1021 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1022 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1023 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1024 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1025 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1026 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1027 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1028 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1029 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1030 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1031 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1032 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1033 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1034 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1035 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1036 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1037 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1038 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1039 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1040 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1042 LDKMessageSendEvent_SendAcceptChannel_class =
1043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1044 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1045 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1046 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1047 LDKMessageSendEvent_SendOpenChannel_class =
1048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1049 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1050 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1051 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1052 LDKMessageSendEvent_SendFundingCreated_class =
1053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1054 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1055 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1056 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1057 LDKMessageSendEvent_SendFundingSigned_class =
1058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1059 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1060 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1061 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1062 LDKMessageSendEvent_SendFundingLocked_class =
1063 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1064 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1065 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1066 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1067 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1068 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1069 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1070 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1071 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1072 LDKMessageSendEvent_UpdateHTLCs_class =
1073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1074 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1075 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1076 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1077 LDKMessageSendEvent_SendRevokeAndACK_class =
1078 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1079 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1080 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1081 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1082 LDKMessageSendEvent_SendClosingSigned_class =
1083 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1084 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1085 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1086 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1087 LDKMessageSendEvent_SendShutdown_class =
1088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1089 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1090 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1091 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1092 LDKMessageSendEvent_SendChannelReestablish_class =
1093 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1094 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1095 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1096 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1097 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1099 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1100 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1101 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1102 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1104 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1105 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1106 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1107 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1108 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1109 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1110 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1111 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1112 LDKMessageSendEvent_HandleError_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1114 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1115 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1116 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1117 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1119 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1120 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1121 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1122 LDKMessageSendEvent_SendChannelRangeQuery_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1124 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1125 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1126 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1127 LDKMessageSendEvent_SendShortIdsQuery_class =
1128 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1129 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1130 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1131 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1133 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1134 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1136 case LDKMessageSendEvent_SendAcceptChannel: {
1137 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1138 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1139 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1140 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1141 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1142 long msg_ref = (long)msg_var.inner & ~1;
1143 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1145 case LDKMessageSendEvent_SendOpenChannel: {
1146 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1147 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1148 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1149 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1150 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1151 long msg_ref = (long)msg_var.inner & ~1;
1152 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1154 case LDKMessageSendEvent_SendFundingCreated: {
1155 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1156 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1157 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1158 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1159 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1160 long msg_ref = (long)msg_var.inner & ~1;
1161 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1163 case LDKMessageSendEvent_SendFundingSigned: {
1164 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1165 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1166 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1167 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1168 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1169 long msg_ref = (long)msg_var.inner & ~1;
1170 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1172 case LDKMessageSendEvent_SendFundingLocked: {
1173 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1174 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1175 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1176 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1177 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1178 long msg_ref = (long)msg_var.inner & ~1;
1179 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1181 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1182 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1183 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1184 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1185 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1186 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1187 long msg_ref = (long)msg_var.inner & ~1;
1188 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1190 case LDKMessageSendEvent_UpdateHTLCs: {
1191 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1192 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1193 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1194 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1195 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1196 long updates_ref = (long)updates_var.inner & ~1;
1197 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1199 case LDKMessageSendEvent_SendRevokeAndACK: {
1200 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1201 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1202 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1203 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1204 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1205 long msg_ref = (long)msg_var.inner & ~1;
1206 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1208 case LDKMessageSendEvent_SendClosingSigned: {
1209 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1210 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1211 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1212 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1213 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1214 long msg_ref = (long)msg_var.inner & ~1;
1215 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1217 case LDKMessageSendEvent_SendShutdown: {
1218 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1219 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1220 LDKShutdown msg_var = obj->send_shutdown.msg;
1221 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1222 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1223 long msg_ref = (long)msg_var.inner & ~1;
1224 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1226 case LDKMessageSendEvent_SendChannelReestablish: {
1227 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1228 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1229 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1230 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1231 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1232 long msg_ref = (long)msg_var.inner & ~1;
1233 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1235 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1236 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1237 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1238 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1239 long msg_ref = (long)msg_var.inner & ~1;
1240 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1241 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1242 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1243 long update_msg_ref = (long)update_msg_var.inner & ~1;
1244 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1246 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1247 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1248 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1249 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1250 long msg_ref = (long)msg_var.inner & ~1;
1251 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1253 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1254 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1255 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1256 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1257 long msg_ref = (long)msg_var.inner & ~1;
1258 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1260 case LDKMessageSendEvent_HandleError: {
1261 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1262 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1263 long action_ref = ((long)&obj->handle_error.action) | 1;
1264 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1266 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1267 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
1268 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1270 case LDKMessageSendEvent_SendChannelRangeQuery: {
1271 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1272 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1273 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1274 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1275 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1276 long msg_ref = (long)msg_var.inner & ~1;
1277 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1279 case LDKMessageSendEvent_SendShortIdsQuery: {
1280 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1281 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1282 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1283 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1284 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1285 long msg_ref = (long)msg_var.inner & ~1;
1286 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1292 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1293 ret->datalen = (*env)->GetArrayLength(env, elems);
1294 if (ret->datalen == 0) {
1297 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1298 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1299 for (size_t i = 0; i < ret->datalen; i++) {
1300 int64_t arr_elem = java_elems[i];
1301 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1302 FREE((void*)arr_elem);
1303 ret->data[i] = arr_elem_conv;
1305 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1309 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1310 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1311 for (size_t i = 0; i < ret.datalen; i++) {
1312 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1317 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1320 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1321 CHECK(val->result_ok);
1322 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1323 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 long res_ref = (long)res_var.inner & ~1;
1328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1329 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1330 CHECK(!val->result_ok);
1331 LDKDecodeError err_var = (*val->contents.err);
1332 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1333 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1334 long err_ref = (long)err_var.inner & ~1;
1337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1338 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1341 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1342 CHECK(val->result_ok);
1343 LDKChannelInfo res_var = (*val->contents.result);
1344 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 long res_ref = (long)res_var.inner & ~1;
1349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1350 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1351 CHECK(!val->result_ok);
1352 LDKDecodeError err_var = (*val->contents.err);
1353 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1354 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1355 long err_ref = (long)err_var.inner & ~1;
1358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1359 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1362 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1363 CHECK(val->result_ok);
1364 LDKRoutingFees res_var = (*val->contents.result);
1365 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 long res_ref = (long)res_var.inner & ~1;
1370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1371 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1372 CHECK(!val->result_ok);
1373 LDKDecodeError err_var = (*val->contents.err);
1374 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1375 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1376 long err_ref = (long)err_var.inner & ~1;
1379 static jclass LDKNetAddress_IPv4_class = NULL;
1380 static jmethodID LDKNetAddress_IPv4_meth = NULL;
1381 static jclass LDKNetAddress_IPv6_class = NULL;
1382 static jmethodID LDKNetAddress_IPv6_meth = NULL;
1383 static jclass LDKNetAddress_OnionV2_class = NULL;
1384 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
1385 static jclass LDKNetAddress_OnionV3_class = NULL;
1386 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
1387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
1388 LDKNetAddress_IPv4_class =
1389 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
1390 CHECK(LDKNetAddress_IPv4_class != NULL);
1391 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
1392 CHECK(LDKNetAddress_IPv4_meth != NULL);
1393 LDKNetAddress_IPv6_class =
1394 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
1395 CHECK(LDKNetAddress_IPv6_class != NULL);
1396 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
1397 CHECK(LDKNetAddress_IPv6_meth != NULL);
1398 LDKNetAddress_OnionV2_class =
1399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
1400 CHECK(LDKNetAddress_OnionV2_class != NULL);
1401 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
1402 CHECK(LDKNetAddress_OnionV2_meth != NULL);
1403 LDKNetAddress_OnionV3_class =
1404 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
1405 CHECK(LDKNetAddress_OnionV3_class != NULL);
1406 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
1407 CHECK(LDKNetAddress_OnionV3_meth != NULL);
1409 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1410 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1412 case LDKNetAddress_IPv4: {
1413 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
1414 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
1415 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
1417 case LDKNetAddress_IPv6: {
1418 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
1419 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
1420 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
1422 case LDKNetAddress_OnionV2: {
1423 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
1424 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
1425 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
1427 case LDKNetAddress_OnionV3: {
1428 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
1429 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
1430 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port);
1435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1436 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1437 ret->datalen = (*env)->GetArrayLength(env, elems);
1438 if (ret->datalen == 0) {
1441 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1442 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1443 for (size_t i = 0; i < ret->datalen; i++) {
1444 int64_t arr_elem = java_elems[i];
1445 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1446 FREE((void*)arr_elem);
1447 ret->data[i] = arr_elem_conv;
1449 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1453 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1454 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1455 for (size_t i = 0; i < ret.datalen; i++) {
1456 ret.data[i] = NetAddress_clone(&orig->data[i]);
1460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1461 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1464 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1465 CHECK(val->result_ok);
1466 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1467 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1468 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1469 long res_ref = (long)res_var.inner & ~1;
1472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1473 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1474 CHECK(!val->result_ok);
1475 LDKDecodeError err_var = (*val->contents.err);
1476 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1477 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1478 long err_ref = (long)err_var.inner & ~1;
1481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1482 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1483 ret->datalen = (*env)->GetArrayLength(env, elems);
1484 if (ret->datalen == 0) {
1487 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1488 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1489 for (size_t i = 0; i < ret->datalen; i++) {
1490 ret->data[i] = java_elems[i];
1492 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1496 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1497 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1498 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1502 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1505 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1506 CHECK(val->result_ok);
1507 LDKNodeInfo res_var = (*val->contents.result);
1508 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1509 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1510 long res_ref = (long)res_var.inner & ~1;
1513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1514 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1515 CHECK(!val->result_ok);
1516 LDKDecodeError err_var = (*val->contents.err);
1517 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1518 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1519 long err_ref = (long)err_var.inner & ~1;
1522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1523 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1526 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1527 CHECK(val->result_ok);
1528 LDKNetworkGraph res_var = (*val->contents.result);
1529 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1530 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1531 long res_ref = (long)res_var.inner & ~1;
1534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1535 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1536 CHECK(!val->result_ok);
1537 LDKDecodeError err_var = (*val->contents.err);
1538 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1539 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1540 long err_ref = (long)err_var.inner & ~1;
1543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1544 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1546 LDKTransaction b_ref;
1547 b_ref.datalen = (*env)->GetArrayLength(env, b);
1548 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1549 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1550 b_ref.data_is_owned = false;
1554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1555 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1559 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1560 LDKTransaction b_var = tuple->b;
1561 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1562 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1566 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1567 ret->datalen = (*env)->GetArrayLength(env, elems);
1568 if (ret->datalen == 0) {
1571 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1572 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1573 for (size_t i = 0; i < ret->datalen; i++) {
1574 int64_t arr_elem = java_elems[i];
1575 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1576 FREE((void*)arr_elem);
1577 ret->data[i] = arr_elem_conv;
1579 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1584 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1587 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1588 CHECK(val->result_ok);
1589 return *val->contents.result;
1591 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1592 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1593 CHECK(!val->result_ok);
1594 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1598 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1599 ret->datalen = (*env)->GetArrayLength(env, elems);
1600 if (ret->datalen == 0) {
1603 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1604 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1605 for (size_t i = 0; i < ret->datalen; i++) {
1606 int64_t arr_elem = java_elems[i];
1607 LDKMonitorEvent arr_elem_conv;
1608 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1609 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1610 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1611 ret->data[i] = arr_elem_conv;
1613 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1617 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1618 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1619 for (size_t i = 0; i < ret.datalen; i++) {
1620 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
1625 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1631 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
1634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1635 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
1638 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1639 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1640 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
1641 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
1642 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
1643 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
1644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1645 LDKSpendableOutputDescriptor_StaticOutput_class =
1646 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1647 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1648 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1649 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1650 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
1651 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
1652 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
1653 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
1654 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
1655 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
1656 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
1657 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
1658 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
1659 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
1661 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1662 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1664 case LDKSpendableOutputDescriptor_StaticOutput: {
1665 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1666 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1667 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1668 long outpoint_ref = (long)outpoint_var.inner & ~1;
1669 long output_ref = ((long)&obj->static_output.output) | 1;
1670 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
1672 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
1673 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
1674 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1675 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1676 long outpoint_ref = (long)outpoint_var.inner & ~1;
1677 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1678 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
1679 long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1;
1680 long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1;
1681 int8_tArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
1682 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
1683 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, (long)output_ref, key_derivation_params_ref, revocation_pubkey_arr);
1685 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
1686 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
1687 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1688 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1689 long outpoint_ref = (long)outpoint_var.inner & ~1;
1690 long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1;
1691 long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1;
1692 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref);
1697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1698 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1699 ret->datalen = (*env)->GetArrayLength(env, elems);
1700 if (ret->datalen == 0) {
1703 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1704 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1705 for (size_t i = 0; i < ret->datalen; i++) {
1706 int64_t arr_elem = java_elems[i];
1707 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1708 FREE((void*)arr_elem);
1709 ret->data[i] = arr_elem_conv;
1711 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1715 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1716 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1717 for (size_t i = 0; i < ret.datalen; i++) {
1718 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1722 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1723 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1724 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1725 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1726 static jclass LDKEvent_PaymentReceived_class = NULL;
1727 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1728 static jclass LDKEvent_PaymentSent_class = NULL;
1729 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1730 static jclass LDKEvent_PaymentFailed_class = NULL;
1731 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1732 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1733 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1734 static jclass LDKEvent_SpendableOutputs_class = NULL;
1735 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1737 LDKEvent_FundingGenerationReady_class =
1738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1739 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1740 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1741 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1742 LDKEvent_FundingBroadcastSafe_class =
1743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1744 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1745 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1746 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1747 LDKEvent_PaymentReceived_class =
1748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1749 CHECK(LDKEvent_PaymentReceived_class != NULL);
1750 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1751 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1752 LDKEvent_PaymentSent_class =
1753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1754 CHECK(LDKEvent_PaymentSent_class != NULL);
1755 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1756 CHECK(LDKEvent_PaymentSent_meth != NULL);
1757 LDKEvent_PaymentFailed_class =
1758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1759 CHECK(LDKEvent_PaymentFailed_class != NULL);
1760 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1761 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1762 LDKEvent_PendingHTLCsForwardable_class =
1763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1764 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1765 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1766 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1767 LDKEvent_SpendableOutputs_class =
1768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1769 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1770 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1771 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1773 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1774 LDKEvent *obj = (LDKEvent*)ptr;
1776 case LDKEvent_FundingGenerationReady: {
1777 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1778 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1779 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1780 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1781 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1782 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
1784 case LDKEvent_FundingBroadcastSafe: {
1785 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1786 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1787 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1788 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1789 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1791 case LDKEvent_PaymentReceived: {
1792 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1793 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1794 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1795 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1796 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1798 case LDKEvent_PaymentSent: {
1799 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1800 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1801 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1803 case LDKEvent_PaymentFailed: {
1804 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1805 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1806 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1808 case LDKEvent_PendingHTLCsForwardable: {
1809 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1811 case LDKEvent_SpendableOutputs: {
1812 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1813 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1814 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1815 for (size_t b = 0; b < outputs_var.datalen; b++) {
1816 long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1817 outputs_arr_ptr[b] = arr_conv_27_ref;
1819 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1820 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1826 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1827 ret->datalen = (*env)->GetArrayLength(env, elems);
1828 if (ret->datalen == 0) {
1831 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1832 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1833 for (size_t i = 0; i < ret->datalen; i++) {
1834 int64_t arr_elem = java_elems[i];
1835 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1836 FREE((void*)arr_elem);
1837 ret->data[i] = arr_elem_conv;
1839 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1843 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1844 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1845 for (size_t i = 0; i < ret.datalen; i++) {
1846 ret.data[i] = Event_clone(&orig->data[i]);
1850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1851 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1854 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1855 CHECK(val->result_ok);
1856 LDKOutPoint res_var = (*val->contents.result);
1857 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1858 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1859 long res_ref = (long)res_var.inner & ~1;
1862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1863 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1864 CHECK(!val->result_ok);
1865 LDKDecodeError err_var = (*val->contents.err);
1866 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1867 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1868 long err_ref = (long)err_var.inner & ~1;
1871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1872 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1875 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1876 CHECK(val->result_ok);
1877 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1878 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1879 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1880 long res_ref = (long)res_var.inner & ~1;
1883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1884 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1885 CHECK(!val->result_ok);
1886 LDKDecodeError err_var = (*val->contents.err);
1887 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1888 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1889 long err_ref = (long)err_var.inner & ~1;
1892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1893 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1896 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1897 CHECK(val->result_ok);
1898 LDKHTLCUpdate res_var = (*val->contents.result);
1899 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1900 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1901 long res_ref = (long)res_var.inner & ~1;
1904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1905 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1906 CHECK(!val->result_ok);
1907 LDKDecodeError err_var = (*val->contents.err);
1908 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1909 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1910 long err_ref = (long)err_var.inner & ~1;
1913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1914 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1917 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1918 CHECK(val->result_ok);
1919 return *val->contents.result;
1921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1922 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1923 CHECK(!val->result_ok);
1924 LDKMonitorUpdateError err_var = (*val->contents.err);
1925 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1926 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1927 long err_ref = (long)err_var.inner & ~1;
1930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1931 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1933 a_conv.inner = (void*)(a & (~1));
1934 a_conv.is_owned = (a & 1) || (a == 0);
1935 a_conv = OutPoint_clone(&a_conv);
1938 b_ref.datalen = (*env)->GetArrayLength(env, b);
1939 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1940 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1945 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1946 LDKOutPoint a_var = tuple->a;
1947 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1948 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1949 long a_ref = (long)a_var.inner & ~1;
1952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1953 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1954 LDKCVec_u8Z b_var = tuple->b;
1955 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1956 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
1960 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1962 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1967 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1968 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1972 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1973 long b_ref = ((long)&tuple->b) | 1;
1976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1977 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1978 ret->datalen = (*env)->GetArrayLength(env, elems);
1979 if (ret->datalen == 0) {
1982 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1983 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1984 for (size_t i = 0; i < ret->datalen; i++) {
1985 int64_t arr_elem = java_elems[i];
1986 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1987 FREE((void*)arr_elem);
1988 ret->data[i] = arr_elem_conv;
1990 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1994 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1995 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1996 for (size_t i = 0; i < ret.datalen; i++) {
1997 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
2001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
2002 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
2003 LDKThirtyTwoBytes a_ref;
2004 CHECK((*env)->GetArrayLength(env, a) == 32);
2005 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2007 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
2008 b_constr.datalen = (*env)->GetArrayLength(env, b);
2009 if (b_constr.datalen > 0)
2010 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
2012 b_constr.data = NULL;
2013 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
2014 for (size_t a = 0; a < b_constr.datalen; a++) {
2015 int64_t arr_conv_26 = b_vals[a];
2016 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
2017 FREE((void*)arr_conv_26);
2018 b_constr.data[a] = arr_conv_26_conv;
2020 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
2024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2025 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2026 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2027 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2030 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2031 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
2032 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
2033 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
2034 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
2035 for (size_t a = 0; a < b_var.datalen; a++) {
2036 long arr_conv_26_ref = (long)(&b_var.data[a]) | 1;
2037 b_arr_ptr[a] = arr_conv_26_ref;
2039 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
2042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2043 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
2044 ret->datalen = (*env)->GetArrayLength(env, elems);
2045 if (ret->datalen == 0) {
2048 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
2049 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2050 for (size_t i = 0; i < ret->datalen; i++) {
2051 int64_t arr_elem = java_elems[i];
2052 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
2053 FREE((void*)arr_elem);
2054 ret->data[i] = arr_elem_conv;
2056 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2061 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2063 CHECK((*env)->GetArrayLength(env, a) == 64);
2064 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2066 LDKCVec_SignatureZ b_constr;
2067 b_constr.datalen = (*env)->GetArrayLength(env, b);
2068 if (b_constr.datalen > 0)
2069 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2071 b_constr.data = NULL;
2072 for (size_t i = 0; i < b_constr.datalen; i++) {
2073 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2074 LDKSignature arr_conv_8_ref;
2075 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
2076 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
2077 b_constr.data[i] = arr_conv_8_ref;
2082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2083 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2084 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2085 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2088 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2089 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2090 LDKCVec_SignatureZ b_var = tuple->b;
2091 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2093 for (size_t i = 0; i < b_var.datalen; i++) {
2094 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
2095 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2096 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
2100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2101 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2104 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2105 CHECK(val->result_ok);
2106 long res_ref = (long)(&(*val->contents.result)) | 1;
2109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2110 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2111 CHECK(!val->result_ok);
2112 return *val->contents.err;
2114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2115 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2118 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2119 CHECK(val->result_ok);
2120 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2121 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2125 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2126 CHECK(!val->result_ok);
2127 return *val->contents.err;
2129 typedef struct LDKChannelKeys_JCalls {
2130 atomic_size_t refcnt;
2133 jmethodID get_per_commitment_point_meth;
2134 jmethodID release_commitment_secret_meth;
2135 jmethodID key_derivation_params_meth;
2136 jmethodID sign_counterparty_commitment_meth;
2137 jmethodID sign_holder_commitment_and_htlcs_meth;
2138 jmethodID sign_justice_transaction_meth;
2139 jmethodID sign_counterparty_htlc_transaction_meth;
2140 jmethodID sign_closing_transaction_meth;
2141 jmethodID sign_channel_announcement_meth;
2142 jmethodID ready_channel_meth;
2143 jmethodID write_meth;
2144 } LDKChannelKeys_JCalls;
2145 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2146 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2147 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2149 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2150 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2154 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
2155 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2157 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2158 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2160 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2161 LDKPublicKey arg_ref;
2162 CHECK((*env)->GetArrayLength(env, arg) == 33);
2163 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
2166 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
2167 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2169 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2170 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2172 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2173 LDKThirtyTwoBytes arg_ref;
2174 CHECK((*env)->GetArrayLength(env, arg) == 32);
2175 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
2178 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
2179 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2181 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2182 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2184 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
2185 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1);
2186 ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret);
2189 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2190 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2192 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2193 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2194 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2195 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2196 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2197 long commitment_tx_ref = (long)commitment_tx_var.inner;
2198 if (commitment_tx_var.is_owned) {
2199 commitment_tx_ref |= 1;
2201 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2203 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2204 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2205 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2208 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2209 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2211 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2212 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2213 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2214 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2215 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2216 long commitment_tx_ref = (long)commitment_tx_var.inner;
2217 if (commitment_tx_var.is_owned) {
2218 commitment_tx_ref |= 1;
2220 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2222 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2223 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2224 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
2227 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2228 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2230 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2231 LDKTransaction justice_tx_var = justice_tx;
2232 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2233 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2234 Transaction_free(justice_tx_var);
2235 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2236 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2237 LDKHTLCOutputInCommitment htlc_var = *htlc;
2238 htlc_var = HTLCOutputInCommitment_clone(htlc);
2239 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2240 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2241 long htlc_ref = (long)htlc_var.inner;
2242 if (htlc_var.is_owned) {
2245 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2247 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2248 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2249 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2252 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2253 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2255 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2256 LDKTransaction htlc_tx_var = htlc_tx;
2257 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2258 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2259 Transaction_free(htlc_tx_var);
2260 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2261 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2262 LDKHTLCOutputInCommitment htlc_var = *htlc;
2263 htlc_var = HTLCOutputInCommitment_clone(htlc);
2264 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2265 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2266 long htlc_ref = (long)htlc_var.inner;
2267 if (htlc_var.is_owned) {
2270 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2272 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2273 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2274 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2277 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2278 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2280 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2281 LDKTransaction closing_tx_var = closing_tx;
2282 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2283 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2284 Transaction_free(closing_tx_var);
2285 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2287 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2288 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2289 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2292 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2293 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2295 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2296 LDKUnsignedChannelAnnouncement msg_var = *msg;
2297 msg_var = UnsignedChannelAnnouncement_clone(msg);
2298 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2299 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2300 long msg_ref = (long)msg_var.inner;
2301 if (msg_var.is_owned) {
2304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2306 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2307 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2308 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
2311 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2312 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2314 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2315 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2316 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2317 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2318 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2319 long channel_parameters_ref = (long)channel_parameters_var.inner;
2320 if (channel_parameters_var.is_owned) {
2321 channel_parameters_ref |= 1;
2323 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2325 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2327 LDKCVec_u8Z write_jcall(const void* this_arg) {
2328 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2330 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2331 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2333 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2334 LDKCVec_u8Z arg_ref;
2335 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
2336 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2337 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
2340 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2341 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2342 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2343 return (void*) this_arg;
2345 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2346 jclass c = (*env)->GetObjectClass(env, o);
2348 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2349 atomic_init(&calls->refcnt, 1);
2350 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2351 calls->o = (*env)->NewWeakGlobalRef(env, o);
2352 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2353 CHECK(calls->get_per_commitment_point_meth != NULL);
2354 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2355 CHECK(calls->release_commitment_secret_meth != NULL);
2356 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2357 CHECK(calls->key_derivation_params_meth != NULL);
2358 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2359 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2360 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2361 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2362 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2363 CHECK(calls->sign_justice_transaction_meth != NULL);
2364 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2365 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2366 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2367 CHECK(calls->sign_closing_transaction_meth != NULL);
2368 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2369 CHECK(calls->sign_channel_announcement_meth != NULL);
2370 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2371 CHECK(calls->ready_channel_meth != NULL);
2372 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2373 CHECK(calls->write_meth != NULL);
2375 LDKChannelPublicKeys pubkeys_conv;
2376 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2377 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2378 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2380 LDKChannelKeys ret = {
2381 .this_arg = (void*) calls,
2382 .get_per_commitment_point = get_per_commitment_point_jcall,
2383 .release_commitment_secret = release_commitment_secret_jcall,
2384 .key_derivation_params = key_derivation_params_jcall,
2385 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2386 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
2387 .sign_justice_transaction = sign_justice_transaction_jcall,
2388 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2389 .sign_closing_transaction = sign_closing_transaction_jcall,
2390 .sign_channel_announcement = sign_channel_announcement_jcall,
2391 .ready_channel = ready_channel_jcall,
2392 .clone = LDKChannelKeys_JCalls_clone,
2393 .write = write_jcall,
2394 .free = LDKChannelKeys_JCalls_free,
2395 .pubkeys = pubkeys_conv,
2396 .set_pubkeys = NULL,
2400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2401 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2402 *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys);
2403 return (long)res_ptr;
2405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2406 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2407 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
2408 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2413 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2414 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2415 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) {
2420 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2421 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2422 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2423 return (long)ret_ref;
2426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2427 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2428 LDKCommitmentTransaction commitment_tx_conv;
2429 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2430 commitment_tx_conv.is_owned = false;
2431 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2432 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2433 return (long)ret_conv;
2436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2437 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2438 LDKHolderCommitmentTransaction commitment_tx_conv;
2439 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2440 commitment_tx_conv.is_owned = false;
2441 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2442 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2443 return (long)ret_conv;
2446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(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) {
2447 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2448 LDKTransaction justice_tx_ref;
2449 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2450 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2451 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2452 justice_tx_ref.data_is_owned = true;
2453 unsigned char per_commitment_key_arr[32];
2454 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2455 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2456 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2457 LDKHTLCOutputInCommitment htlc_conv;
2458 htlc_conv.inner = (void*)(htlc & (~1));
2459 htlc_conv.is_owned = false;
2460 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2461 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2462 return (long)ret_conv;
2465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_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) {
2466 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2467 LDKTransaction htlc_tx_ref;
2468 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2469 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2470 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2471 htlc_tx_ref.data_is_owned = true;
2472 LDKPublicKey per_commitment_point_ref;
2473 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2474 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2475 LDKHTLCOutputInCommitment htlc_conv;
2476 htlc_conv.inner = (void*)(htlc & (~1));
2477 htlc_conv.is_owned = false;
2478 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2479 *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);
2480 return (long)ret_conv;
2483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2484 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2485 LDKTransaction closing_tx_ref;
2486 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2487 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2488 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2489 closing_tx_ref.data_is_owned = true;
2490 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2491 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2492 return (long)ret_conv;
2495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2496 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2497 LDKUnsignedChannelAnnouncement msg_conv;
2498 msg_conv.inner = (void*)(msg & (~1));
2499 msg_conv.is_owned = false;
2500 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2501 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2502 return (long)ret_conv;
2505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2506 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2507 LDKChannelTransactionParameters channel_parameters_conv;
2508 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2509 channel_parameters_conv.is_owned = false;
2510 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2514 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2515 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2516 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
2517 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
2518 CVec_u8Z_free(arg_var);
2522 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2523 if (this_arg->set_pubkeys != NULL)
2524 this_arg->set_pubkeys(this_arg);
2525 return this_arg->pubkeys;
2527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2528 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2529 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2530 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2531 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2532 long ret_ref = (long)ret_var.inner;
2533 if (ret_var.is_owned) {
2539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2540 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2541 LDKThirtyTwoBytes a_ref;
2542 CHECK((*env)->GetArrayLength(env, a) == 32);
2543 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2545 LDKChannelMonitor b_conv;
2546 b_conv.inner = (void*)(b & (~1));
2547 b_conv.is_owned = (b & 1) || (b == 0);
2548 b_conv = ChannelMonitor_clone(&b_conv);
2552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2553 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2554 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2555 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2559 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2560 LDKChannelMonitor b_var = tuple->b;
2561 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2562 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2563 long b_ref = (long)b_var.inner & ~1;
2566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2567 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2570 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2571 CHECK(val->result_ok);
2572 long res_ref = (long)(&(*val->contents.result)) | 1;
2575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2576 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2577 CHECK(!val->result_ok);
2578 LDKDecodeError err_var = (*val->contents.err);
2579 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2580 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2581 long err_ref = (long)err_var.inner & ~1;
2584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2585 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2588 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2589 CHECK(val->result_ok);
2590 long res_ref = ((long)&(*val->contents.result)) | 1;
2591 return (long)res_ref;
2593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2594 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2595 CHECK(!val->result_ok);
2596 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2599 static jclass LDKAPIError_APIMisuseError_class = NULL;
2600 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2601 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2602 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2603 static jclass LDKAPIError_RouteError_class = NULL;
2604 static jmethodID LDKAPIError_RouteError_meth = NULL;
2605 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2606 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2607 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2608 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2610 LDKAPIError_APIMisuseError_class =
2611 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2612 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2613 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2614 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2615 LDKAPIError_FeeRateTooHigh_class =
2616 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2617 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2618 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2619 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2620 LDKAPIError_RouteError_class =
2621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2622 CHECK(LDKAPIError_RouteError_class != NULL);
2623 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2624 CHECK(LDKAPIError_RouteError_meth != NULL);
2625 LDKAPIError_ChannelUnavailable_class =
2626 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2627 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2628 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2629 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2630 LDKAPIError_MonitorUpdateFailed_class =
2631 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2632 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2633 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2634 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2636 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2637 LDKAPIError *obj = (LDKAPIError*)ptr;
2639 case LDKAPIError_APIMisuseError: {
2640 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2641 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2642 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2643 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2645 case LDKAPIError_FeeRateTooHigh: {
2646 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2647 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2648 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2649 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2651 case LDKAPIError_RouteError: {
2652 LDKStr err_str = obj->route_error.err;
2653 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2654 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2656 case LDKAPIError_ChannelUnavailable: {
2657 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2658 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2659 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2660 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2662 case LDKAPIError_MonitorUpdateFailed: {
2663 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2669 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2672 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2673 CHECK(val->result_ok);
2674 return *val->contents.result;
2676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2677 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2678 CHECK(!val->result_ok);
2679 long err_ref = ((long)&(*val->contents.err)) | 1;
2682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2683 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2684 ret->datalen = (*env)->GetArrayLength(env, elems);
2685 if (ret->datalen == 0) {
2688 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2689 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2690 for (size_t i = 0; i < ret->datalen; i++) {
2691 int64_t arr_elem = java_elems[i];
2692 LDKChannelDetails arr_elem_conv;
2693 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2694 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2695 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2696 ret->data[i] = arr_elem_conv;
2698 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2702 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2703 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2704 for (size_t i = 0; i < ret.datalen; i++) {
2705 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2709 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2710 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2713 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2714 CHECK(val->result_ok);
2715 return *val->contents.result;
2717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2718 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2719 CHECK(!val->result_ok);
2720 LDKPaymentSendFailure err_var = (*val->contents.err);
2721 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2722 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2723 long err_ref = (long)err_var.inner & ~1;
2726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2727 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2728 ret->datalen = (*env)->GetArrayLength(env, elems);
2729 if (ret->datalen == 0) {
2732 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2733 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2734 for (size_t i = 0; i < ret->datalen; i++) {
2735 int64_t arr_elem = java_elems[i];
2736 LDKChannelMonitor arr_elem_conv;
2737 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2738 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2739 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2740 ret->data[i] = arr_elem_conv;
2742 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2746 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2747 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2748 for (size_t i = 0; i < ret.datalen; i++) {
2749 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2753 typedef struct LDKWatch_JCalls {
2754 atomic_size_t refcnt;
2757 jmethodID watch_channel_meth;
2758 jmethodID update_channel_meth;
2759 jmethodID release_pending_monitor_events_meth;
2761 static void LDKWatch_JCalls_free(void* this_arg) {
2762 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2763 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2765 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2766 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2770 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2771 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2773 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2774 LDKOutPoint funding_txo_var = funding_txo;
2775 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2776 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2777 long funding_txo_ref = (long)funding_txo_var.inner;
2778 if (funding_txo_var.is_owned) {
2779 funding_txo_ref |= 1;
2781 LDKChannelMonitor monitor_var = monitor;
2782 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2783 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2784 long monitor_ref = (long)monitor_var.inner;
2785 if (monitor_var.is_owned) {
2788 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2790 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2791 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2792 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2795 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2796 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2798 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2799 LDKOutPoint funding_txo_var = funding_txo;
2800 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2801 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2802 long funding_txo_ref = (long)funding_txo_var.inner;
2803 if (funding_txo_var.is_owned) {
2804 funding_txo_ref |= 1;
2806 LDKChannelMonitorUpdate update_var = update;
2807 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2808 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2809 long update_ref = (long)update_var.inner;
2810 if (update_var.is_owned) {
2813 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2815 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2816 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2817 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2820 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2821 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2823 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2824 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2826 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2827 LDKCVec_MonitorEventZ arg_constr;
2828 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
2829 if (arg_constr.datalen > 0)
2830 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2832 arg_constr.data = NULL;
2833 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
2834 for (size_t o = 0; o < arg_constr.datalen; o++) {
2835 int64_t arr_conv_14 = arg_vals[o];
2836 LDKMonitorEvent arr_conv_14_conv;
2837 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2838 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2839 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2840 arg_constr.data[o] = arr_conv_14_conv;
2842 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
2845 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2846 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2847 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2848 return (void*) this_arg;
2850 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2851 jclass c = (*env)->GetObjectClass(env, o);
2853 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2854 atomic_init(&calls->refcnt, 1);
2855 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2856 calls->o = (*env)->NewWeakGlobalRef(env, o);
2857 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2858 CHECK(calls->watch_channel_meth != NULL);
2859 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2860 CHECK(calls->update_channel_meth != NULL);
2861 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2862 CHECK(calls->release_pending_monitor_events_meth != NULL);
2865 .this_arg = (void*) calls,
2866 .watch_channel = watch_channel_jcall,
2867 .update_channel = update_channel_jcall,
2868 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2869 .free = LDKWatch_JCalls_free,
2873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2874 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2875 *res_ptr = LDKWatch_init(env, clz, o);
2876 return (long)res_ptr;
2878 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) {
2879 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2880 LDKOutPoint funding_txo_conv;
2881 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2882 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2883 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2884 LDKChannelMonitor monitor_conv;
2885 monitor_conv.inner = (void*)(monitor & (~1));
2886 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2887 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2888 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2889 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2890 return (long)ret_conv;
2893 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) {
2894 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2895 LDKOutPoint funding_txo_conv;
2896 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2897 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2898 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2899 LDKChannelMonitorUpdate update_conv;
2900 update_conv.inner = (void*)(update & (~1));
2901 update_conv.is_owned = (update & 1) || (update == 0);
2902 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2903 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2904 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2905 return (long)ret_conv;
2908 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
2909 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2910 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2911 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
2912 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
2913 for (size_t o = 0; o < ret_var.datalen; o++) {
2914 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2915 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2916 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2917 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2918 if (arr_conv_14_var.is_owned) {
2919 arr_conv_14_ref |= 1;
2921 ret_arr_ptr[o] = arr_conv_14_ref;
2923 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
2928 typedef struct LDKBroadcasterInterface_JCalls {
2929 atomic_size_t refcnt;
2932 jmethodID broadcast_transaction_meth;
2933 } LDKBroadcasterInterface_JCalls;
2934 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2935 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2936 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2938 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2939 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2943 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2944 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2946 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
2947 LDKTransaction tx_var = tx;
2948 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
2949 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
2950 Transaction_free(tx_var);
2951 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2953 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2955 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2956 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2957 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2958 return (void*) this_arg;
2960 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
2961 jclass c = (*env)->GetObjectClass(env, o);
2963 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2964 atomic_init(&calls->refcnt, 1);
2965 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2966 calls->o = (*env)->NewWeakGlobalRef(env, o);
2967 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2968 CHECK(calls->broadcast_transaction_meth != NULL);
2970 LDKBroadcasterInterface ret = {
2971 .this_arg = (void*) calls,
2972 .broadcast_transaction = broadcast_transaction_jcall,
2973 .free = LDKBroadcasterInterface_JCalls_free,
2977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2978 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2979 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
2980 return (long)res_ptr;
2982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
2983 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2984 LDKTransaction tx_ref;
2985 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
2986 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2987 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
2988 tx_ref.data_is_owned = true;
2989 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2993 return ((LDKCResult_ChannelKeysDecodeErrorZ*)arg)->result_ok;
2995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2996 LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1);
2997 CHECK(val->result_ok);
2998 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2999 *ret = ChannelKeys_clone(&(*val->contents.result));
3002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3003 LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1);
3004 CHECK(!val->result_ok);
3005 LDKDecodeError err_var = (*val->contents.err);
3006 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 long err_ref = (long)err_var.inner & ~1;
3011 typedef struct LDKKeysInterface_JCalls {
3012 atomic_size_t refcnt;
3015 jmethodID get_node_secret_meth;
3016 jmethodID get_destination_script_meth;
3017 jmethodID get_shutdown_pubkey_meth;
3018 jmethodID get_channel_keys_meth;
3019 jmethodID get_secure_random_bytes_meth;
3020 jmethodID read_chan_signer_meth;
3021 } LDKKeysInterface_JCalls;
3022 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3023 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3024 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3026 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3027 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3031 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
3032 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3034 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3035 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3037 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3038 LDKSecretKey arg_ref;
3039 CHECK((*env)->GetArrayLength(env, arg) == 32);
3040 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
3043 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
3044 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3046 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3047 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3049 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3050 LDKCVec_u8Z arg_ref;
3051 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
3052 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
3053 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
3056 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
3057 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3059 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3062 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3063 LDKPublicKey arg_ref;
3064 CHECK((*env)->GetArrayLength(env, arg) == 33);
3065 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
3068 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3069 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3071 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3072 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3074 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
3075 LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1);
3076 ret_conv = ChannelKeys_clone(ret);
3079 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
3080 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3082 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3083 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3085 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3086 LDKThirtyTwoBytes arg_ref;
3087 CHECK((*env)->GetArrayLength(env, arg) == 32);
3088 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
3091 LDKCResult_ChannelKeysDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
3092 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3094 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3095 LDKu8slice reader_var = reader;
3096 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3097 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3098 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3100 LDKCResult_ChannelKeysDecodeErrorZ* ret = (LDKCResult_ChannelKeysDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3101 LDKCResult_ChannelKeysDecodeErrorZ ret_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)ret) & ~1);
3102 ret_conv = CResult_ChannelKeysDecodeErrorZ_clone((LDKCResult_ChannelKeysDecodeErrorZ*)ret);
3105 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3106 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3107 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3108 return (void*) this_arg;
3110 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3111 jclass c = (*env)->GetObjectClass(env, o);
3113 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3114 atomic_init(&calls->refcnt, 1);
3115 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3116 calls->o = (*env)->NewWeakGlobalRef(env, o);
3117 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3118 CHECK(calls->get_node_secret_meth != NULL);
3119 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3120 CHECK(calls->get_destination_script_meth != NULL);
3121 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3122 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3123 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
3124 CHECK(calls->get_channel_keys_meth != NULL);
3125 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3126 CHECK(calls->get_secure_random_bytes_meth != NULL);
3127 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3128 CHECK(calls->read_chan_signer_meth != NULL);
3130 LDKKeysInterface ret = {
3131 .this_arg = (void*) calls,
3132 .get_node_secret = get_node_secret_jcall,
3133 .get_destination_script = get_destination_script_jcall,
3134 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
3135 .get_channel_keys = get_channel_keys_jcall,
3136 .get_secure_random_bytes = get_secure_random_bytes_jcall,
3137 .read_chan_signer = read_chan_signer_jcall,
3138 .free = LDKKeysInterface_JCalls_free,
3142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3143 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3144 *res_ptr = LDKKeysInterface_init(env, clz, o);
3145 return (long)res_ptr;
3147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3148 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3149 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
3150 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3155 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3156 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3157 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
3158 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
3159 CVec_u8Z_free(arg_var);
3163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3164 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3165 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
3166 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3171 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3172 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
3173 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3178 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3179 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
3180 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3185 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
3186 LDKu8slice reader_ref;
3187 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3188 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3189 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
3190 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3191 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3192 return (long)ret_conv;
3195 typedef struct LDKFeeEstimator_JCalls {
3196 atomic_size_t refcnt;
3199 jmethodID get_est_sat_per_1000_weight_meth;
3200 } LDKFeeEstimator_JCalls;
3201 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3202 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3203 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3205 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3206 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3210 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3211 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3213 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3214 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3215 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3217 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3219 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3220 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3221 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3222 return (void*) this_arg;
3224 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3225 jclass c = (*env)->GetObjectClass(env, o);
3227 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3228 atomic_init(&calls->refcnt, 1);
3229 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3230 calls->o = (*env)->NewWeakGlobalRef(env, o);
3231 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
3232 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3234 LDKFeeEstimator ret = {
3235 .this_arg = (void*) calls,
3236 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
3237 .free = LDKFeeEstimator_JCalls_free,
3241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3242 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3243 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3244 return (long)res_ptr;
3246 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) {
3247 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
3248 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3249 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3253 typedef struct LDKLogger_JCalls {
3254 atomic_size_t refcnt;
3259 static void LDKLogger_JCalls_free(void* this_arg) {
3260 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3261 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3263 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3264 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3268 void log_jcall(const void* this_arg, const char* record) {
3269 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3271 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
3272 const char* record_str = record;
3273 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3274 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3276 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3278 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3279 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3280 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3281 return (void*) this_arg;
3283 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3284 jclass c = (*env)->GetObjectClass(env, o);
3286 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3287 atomic_init(&calls->refcnt, 1);
3288 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3289 calls->o = (*env)->NewWeakGlobalRef(env, o);
3290 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3291 CHECK(calls->log_meth != NULL);
3294 .this_arg = (void*) calls,
3296 .free = LDKLogger_JCalls_free,
3300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3301 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3302 *res_ptr = LDKLogger_init(env, clz, o);
3303 return (long)res_ptr;
3305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3306 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3307 LDKThirtyTwoBytes a_ref;
3308 CHECK((*env)->GetArrayLength(env, a) == 32);
3309 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3311 LDKChannelManager b_conv;
3312 b_conv.inner = (void*)(b & (~1));
3313 b_conv.is_owned = (b & 1) || (b == 0);
3314 // Warning: we need a move here but no clone is available for LDKChannelManager
3318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3319 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3320 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3321 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3325 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3326 LDKChannelManager b_var = tuple->b;
3327 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3328 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3329 long b_ref = (long)b_var.inner & ~1;
3332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3333 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3336 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3337 CHECK(val->result_ok);
3338 long res_ref = (long)(&(*val->contents.result)) | 1;
3341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3342 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3343 CHECK(!val->result_ok);
3344 LDKDecodeError err_var = (*val->contents.err);
3345 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3346 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3347 long err_ref = (long)err_var.inner & ~1;
3350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3351 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
3353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3354 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3355 CHECK(val->result_ok);
3356 long res_ref = ((long)&(*val->contents.result)) | 1;
3359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3360 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
3361 CHECK(!val->result_ok);
3362 LDKDecodeError err_var = (*val->contents.err);
3363 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3364 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3365 long err_ref = (long)err_var.inner & ~1;
3368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3369 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
3371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3372 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
3373 CHECK(val->result_ok);
3374 LDKInMemoryChannelKeys res_var = (*val->contents.result);
3375 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3376 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3377 long res_ref = (long)res_var.inner & ~1;
3380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3381 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
3382 CHECK(!val->result_ok);
3383 LDKDecodeError err_var = (*val->contents.err);
3384 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3385 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3386 long err_ref = (long)err_var.inner & ~1;
3389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3390 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3391 ret->datalen = (*env)->GetArrayLength(env, elems);
3392 if (ret->datalen == 0) {
3395 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3396 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3397 for (size_t i = 0; i < ret->datalen; i++) {
3398 int64_t arr_elem = java_elems[i];
3399 LDKRouteHop arr_elem_conv;
3400 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3401 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3402 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3403 ret->data[i] = arr_elem_conv;
3405 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3409 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3410 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3411 for (size_t i = 0; i < ret.datalen; i++) {
3412 ret.data[i] = RouteHop_clone(&orig->data[i]);
3416 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3417 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3418 for (size_t i = 0; i < ret.datalen; i++) {
3419 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3424 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3427 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3428 CHECK(val->result_ok);
3429 LDKRoute res_var = (*val->contents.result);
3430 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3431 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3432 long res_ref = (long)res_var.inner & ~1;
3435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3436 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3437 CHECK(!val->result_ok);
3438 LDKDecodeError err_var = (*val->contents.err);
3439 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3440 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3441 long err_ref = (long)err_var.inner & ~1;
3444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3445 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3446 ret->datalen = (*env)->GetArrayLength(env, elems);
3447 if (ret->datalen == 0) {
3450 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3451 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3452 for (size_t i = 0; i < ret->datalen; i++) {
3453 int64_t arr_elem = java_elems[i];
3454 LDKRouteHint arr_elem_conv;
3455 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3456 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3457 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3458 ret->data[i] = arr_elem_conv;
3460 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3464 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3465 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3466 for (size_t i = 0; i < ret.datalen; i++) {
3467 ret.data[i] = RouteHint_clone(&orig->data[i]);
3471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3472 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3475 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3476 CHECK(val->result_ok);
3477 LDKRoute res_var = (*val->contents.result);
3478 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3479 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3480 long res_ref = (long)res_var.inner & ~1;
3483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3484 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3485 CHECK(!val->result_ok);
3486 LDKLightningError err_var = (*val->contents.err);
3487 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3488 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3489 long err_ref = (long)err_var.inner & ~1;
3492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3493 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3496 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3497 CHECK(val->result_ok);
3498 long res_ref = ((long)&(*val->contents.result)) | 1;
3501 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3502 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3503 CHECK(!val->result_ok);
3504 return *val->contents.err;
3506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3507 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3510 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3511 CHECK(val->result_ok);
3512 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3513 *res_conv = (*val->contents.result);
3514 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3515 return (long)res_conv;
3517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3518 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3519 CHECK(!val->result_ok);
3520 LDKDecodeError err_var = (*val->contents.err);
3521 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3522 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3523 long err_ref = (long)err_var.inner & ~1;
3526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3527 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3528 ret->datalen = (*env)->GetArrayLength(env, elems);
3529 if (ret->datalen == 0) {
3532 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3533 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3534 for (size_t i = 0; i < ret->datalen; i++) {
3535 int64_t arr_elem = java_elems[i];
3536 LDKUpdateAddHTLC arr_elem_conv;
3537 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3538 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3539 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3540 ret->data[i] = arr_elem_conv;
3542 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3546 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3547 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3548 for (size_t i = 0; i < ret.datalen; i++) {
3549 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3554 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3555 ret->datalen = (*env)->GetArrayLength(env, elems);
3556 if (ret->datalen == 0) {
3559 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3560 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3561 for (size_t i = 0; i < ret->datalen; i++) {
3562 int64_t arr_elem = java_elems[i];
3563 LDKUpdateFulfillHTLC arr_elem_conv;
3564 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3565 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3566 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3567 ret->data[i] = arr_elem_conv;
3569 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3573 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3574 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3575 for (size_t i = 0; i < ret.datalen; i++) {
3576 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3581 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3582 ret->datalen = (*env)->GetArrayLength(env, elems);
3583 if (ret->datalen == 0) {
3586 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3587 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3588 for (size_t i = 0; i < ret->datalen; i++) {
3589 int64_t arr_elem = java_elems[i];
3590 LDKUpdateFailHTLC arr_elem_conv;
3591 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3592 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3593 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3594 ret->data[i] = arr_elem_conv;
3596 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3600 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3601 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3602 for (size_t i = 0; i < ret.datalen; i++) {
3603 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3608 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3609 ret->datalen = (*env)->GetArrayLength(env, elems);
3610 if (ret->datalen == 0) {
3613 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3614 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3615 for (size_t i = 0; i < ret->datalen; i++) {
3616 int64_t arr_elem = java_elems[i];
3617 LDKUpdateFailMalformedHTLC arr_elem_conv;
3618 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3619 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3620 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3621 ret->data[i] = arr_elem_conv;
3623 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3627 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3628 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3629 for (size_t i = 0; i < ret.datalen; i++) {
3630 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3635 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3638 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3639 CHECK(val->result_ok);
3640 LDKAcceptChannel res_var = (*val->contents.result);
3641 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3642 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3643 long res_ref = (long)res_var.inner & ~1;
3646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3647 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3648 CHECK(!val->result_ok);
3649 LDKDecodeError err_var = (*val->contents.err);
3650 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3651 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3652 long err_ref = (long)err_var.inner & ~1;
3655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3656 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3659 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3660 CHECK(val->result_ok);
3661 LDKAnnouncementSignatures res_var = (*val->contents.result);
3662 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3663 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3664 long res_ref = (long)res_var.inner & ~1;
3667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3668 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3669 CHECK(!val->result_ok);
3670 LDKDecodeError err_var = (*val->contents.err);
3671 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3672 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3673 long err_ref = (long)err_var.inner & ~1;
3676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3677 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3680 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3681 CHECK(val->result_ok);
3682 LDKChannelReestablish res_var = (*val->contents.result);
3683 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3684 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3685 long res_ref = (long)res_var.inner & ~1;
3688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3689 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3690 CHECK(!val->result_ok);
3691 LDKDecodeError err_var = (*val->contents.err);
3692 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3693 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3694 long err_ref = (long)err_var.inner & ~1;
3697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3698 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3701 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3702 CHECK(val->result_ok);
3703 LDKClosingSigned res_var = (*val->contents.result);
3704 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3705 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3706 long res_ref = (long)res_var.inner & ~1;
3709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3710 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3711 CHECK(!val->result_ok);
3712 LDKDecodeError err_var = (*val->contents.err);
3713 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3714 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3715 long err_ref = (long)err_var.inner & ~1;
3718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3719 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3722 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3723 CHECK(val->result_ok);
3724 LDKCommitmentSigned res_var = (*val->contents.result);
3725 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3726 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3727 long res_ref = (long)res_var.inner & ~1;
3730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3731 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3732 CHECK(!val->result_ok);
3733 LDKDecodeError err_var = (*val->contents.err);
3734 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3735 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3736 long err_ref = (long)err_var.inner & ~1;
3739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3740 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3743 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3744 CHECK(val->result_ok);
3745 LDKFundingCreated res_var = (*val->contents.result);
3746 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3747 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3748 long res_ref = (long)res_var.inner & ~1;
3751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3752 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3753 CHECK(!val->result_ok);
3754 LDKDecodeError err_var = (*val->contents.err);
3755 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3756 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3757 long err_ref = (long)err_var.inner & ~1;
3760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3761 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3764 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3765 CHECK(val->result_ok);
3766 LDKFundingSigned res_var = (*val->contents.result);
3767 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3768 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3769 long res_ref = (long)res_var.inner & ~1;
3772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3773 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3774 CHECK(!val->result_ok);
3775 LDKDecodeError err_var = (*val->contents.err);
3776 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3777 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3778 long err_ref = (long)err_var.inner & ~1;
3781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3782 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3785 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3786 CHECK(val->result_ok);
3787 LDKFundingLocked res_var = (*val->contents.result);
3788 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3789 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3790 long res_ref = (long)res_var.inner & ~1;
3793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3794 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3795 CHECK(!val->result_ok);
3796 LDKDecodeError err_var = (*val->contents.err);
3797 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3798 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3799 long err_ref = (long)err_var.inner & ~1;
3802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3803 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3806 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3807 CHECK(val->result_ok);
3808 LDKInit res_var = (*val->contents.result);
3809 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3810 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3811 long res_ref = (long)res_var.inner & ~1;
3814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3815 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3816 CHECK(!val->result_ok);
3817 LDKDecodeError err_var = (*val->contents.err);
3818 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3819 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3820 long err_ref = (long)err_var.inner & ~1;
3823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3824 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3827 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3828 CHECK(val->result_ok);
3829 LDKOpenChannel res_var = (*val->contents.result);
3830 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3831 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3832 long res_ref = (long)res_var.inner & ~1;
3835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3836 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3837 CHECK(!val->result_ok);
3838 LDKDecodeError err_var = (*val->contents.err);
3839 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3840 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3841 long err_ref = (long)err_var.inner & ~1;
3844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3845 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3848 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3849 CHECK(val->result_ok);
3850 LDKRevokeAndACK res_var = (*val->contents.result);
3851 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3852 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3853 long res_ref = (long)res_var.inner & ~1;
3856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3857 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3858 CHECK(!val->result_ok);
3859 LDKDecodeError err_var = (*val->contents.err);
3860 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3861 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3862 long err_ref = (long)err_var.inner & ~1;
3865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3866 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3869 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3870 CHECK(val->result_ok);
3871 LDKShutdown res_var = (*val->contents.result);
3872 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3873 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3874 long res_ref = (long)res_var.inner & ~1;
3877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3878 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3879 CHECK(!val->result_ok);
3880 LDKDecodeError err_var = (*val->contents.err);
3881 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3882 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3883 long err_ref = (long)err_var.inner & ~1;
3886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3887 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3890 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3891 CHECK(val->result_ok);
3892 LDKUpdateFailHTLC res_var = (*val->contents.result);
3893 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3894 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3895 long res_ref = (long)res_var.inner & ~1;
3898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3899 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3900 CHECK(!val->result_ok);
3901 LDKDecodeError err_var = (*val->contents.err);
3902 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3903 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3904 long err_ref = (long)err_var.inner & ~1;
3907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3908 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3911 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3912 CHECK(val->result_ok);
3913 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
3914 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3915 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3916 long res_ref = (long)res_var.inner & ~1;
3919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3920 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3921 CHECK(!val->result_ok);
3922 LDKDecodeError err_var = (*val->contents.err);
3923 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3924 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3925 long err_ref = (long)err_var.inner & ~1;
3928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3929 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3932 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3933 CHECK(val->result_ok);
3934 LDKUpdateFee res_var = (*val->contents.result);
3935 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3936 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3937 long res_ref = (long)res_var.inner & ~1;
3940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3941 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3942 CHECK(!val->result_ok);
3943 LDKDecodeError err_var = (*val->contents.err);
3944 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3945 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3946 long err_ref = (long)err_var.inner & ~1;
3949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3950 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3953 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3954 CHECK(val->result_ok);
3955 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
3956 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3957 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3958 long res_ref = (long)res_var.inner & ~1;
3961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3962 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3963 CHECK(!val->result_ok);
3964 LDKDecodeError err_var = (*val->contents.err);
3965 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3966 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3967 long err_ref = (long)err_var.inner & ~1;
3970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3971 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3974 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3975 CHECK(val->result_ok);
3976 LDKUpdateAddHTLC res_var = (*val->contents.result);
3977 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3978 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3979 long res_ref = (long)res_var.inner & ~1;
3982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3983 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3984 CHECK(!val->result_ok);
3985 LDKDecodeError err_var = (*val->contents.err);
3986 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3987 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3988 long err_ref = (long)err_var.inner & ~1;
3991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3992 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3995 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3996 CHECK(val->result_ok);
3997 LDKPing res_var = (*val->contents.result);
3998 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3999 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4000 long res_ref = (long)res_var.inner & ~1;
4003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4004 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
4005 CHECK(!val->result_ok);
4006 LDKDecodeError err_var = (*val->contents.err);
4007 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4008 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4009 long err_ref = (long)err_var.inner & ~1;
4012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4013 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
4015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4016 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4017 CHECK(val->result_ok);
4018 LDKPong res_var = (*val->contents.result);
4019 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4020 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4021 long res_ref = (long)res_var.inner & ~1;
4024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4025 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
4026 CHECK(!val->result_ok);
4027 LDKDecodeError err_var = (*val->contents.err);
4028 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4029 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4030 long err_ref = (long)err_var.inner & ~1;
4033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4034 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4037 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4038 CHECK(val->result_ok);
4039 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
4040 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4041 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4042 long res_ref = (long)res_var.inner & ~1;
4045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4046 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4047 CHECK(!val->result_ok);
4048 LDKDecodeError err_var = (*val->contents.err);
4049 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4050 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4051 long err_ref = (long)err_var.inner & ~1;
4054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4055 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
4057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4058 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4059 CHECK(val->result_ok);
4060 LDKChannelAnnouncement res_var = (*val->contents.result);
4061 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4062 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4063 long res_ref = (long)res_var.inner & ~1;
4066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4067 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
4068 CHECK(!val->result_ok);
4069 LDKDecodeError err_var = (*val->contents.err);
4070 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4071 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4072 long err_ref = (long)err_var.inner & ~1;
4075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4076 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
4078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4079 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4080 CHECK(val->result_ok);
4081 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
4082 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4083 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4084 long res_ref = (long)res_var.inner & ~1;
4087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4088 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
4089 CHECK(!val->result_ok);
4090 LDKDecodeError err_var = (*val->contents.err);
4091 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4092 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4093 long err_ref = (long)err_var.inner & ~1;
4096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4097 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
4099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4100 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4101 CHECK(val->result_ok);
4102 LDKChannelUpdate res_var = (*val->contents.result);
4103 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4104 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4105 long res_ref = (long)res_var.inner & ~1;
4108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4109 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
4110 CHECK(!val->result_ok);
4111 LDKDecodeError err_var = (*val->contents.err);
4112 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4113 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4114 long err_ref = (long)err_var.inner & ~1;
4117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4118 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
4120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4121 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4122 CHECK(val->result_ok);
4123 LDKErrorMessage res_var = (*val->contents.result);
4124 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4125 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4126 long res_ref = (long)res_var.inner & ~1;
4129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4130 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
4131 CHECK(!val->result_ok);
4132 LDKDecodeError err_var = (*val->contents.err);
4133 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4134 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4135 long err_ref = (long)err_var.inner & ~1;
4138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4139 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4142 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4143 CHECK(val->result_ok);
4144 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
4145 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4146 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4147 long res_ref = (long)res_var.inner & ~1;
4150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4151 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
4152 CHECK(!val->result_ok);
4153 LDKDecodeError err_var = (*val->contents.err);
4154 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4155 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4156 long err_ref = (long)err_var.inner & ~1;
4159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4160 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
4162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4163 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4164 CHECK(val->result_ok);
4165 LDKNodeAnnouncement res_var = (*val->contents.result);
4166 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4167 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4168 long res_ref = (long)res_var.inner & ~1;
4171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4172 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
4173 CHECK(!val->result_ok);
4174 LDKDecodeError err_var = (*val->contents.err);
4175 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4176 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4177 long err_ref = (long)err_var.inner & ~1;
4180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4181 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
4183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4184 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4185 CHECK(val->result_ok);
4186 LDKQueryShortChannelIds res_var = (*val->contents.result);
4187 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4188 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4189 long res_ref = (long)res_var.inner & ~1;
4192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4193 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
4194 CHECK(!val->result_ok);
4195 LDKDecodeError err_var = (*val->contents.err);
4196 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 long err_ref = (long)err_var.inner & ~1;
4201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4202 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
4204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4205 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4206 CHECK(val->result_ok);
4207 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
4208 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4209 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4210 long res_ref = (long)res_var.inner & ~1;
4213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4214 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
4215 CHECK(!val->result_ok);
4216 LDKDecodeError err_var = (*val->contents.err);
4217 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4218 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4219 long err_ref = (long)err_var.inner & ~1;
4222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4223 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
4225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4226 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4227 CHECK(val->result_ok);
4228 LDKQueryChannelRange res_var = (*val->contents.result);
4229 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4230 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4231 long res_ref = (long)res_var.inner & ~1;
4234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4235 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
4236 CHECK(!val->result_ok);
4237 LDKDecodeError err_var = (*val->contents.err);
4238 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4239 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4240 long err_ref = (long)err_var.inner & ~1;
4243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4244 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
4246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4247 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4248 CHECK(val->result_ok);
4249 LDKReplyChannelRange res_var = (*val->contents.result);
4250 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4251 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4252 long res_ref = (long)res_var.inner & ~1;
4255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4256 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
4257 CHECK(!val->result_ok);
4258 LDKDecodeError err_var = (*val->contents.err);
4259 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4260 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4261 long err_ref = (long)err_var.inner & ~1;
4264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4265 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
4267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4268 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4269 CHECK(val->result_ok);
4270 LDKGossipTimestampFilter res_var = (*val->contents.result);
4271 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4272 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4273 long res_ref = (long)res_var.inner & ~1;
4276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4277 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
4278 CHECK(!val->result_ok);
4279 LDKDecodeError err_var = (*val->contents.err);
4280 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4281 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4282 long err_ref = (long)err_var.inner & ~1;
4285 typedef struct LDKMessageSendEventsProvider_JCalls {
4286 atomic_size_t refcnt;
4289 jmethodID get_and_clear_pending_msg_events_meth;
4290 } LDKMessageSendEventsProvider_JCalls;
4291 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
4292 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4293 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4295 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4296 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4300 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
4301 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4303 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4306 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
4307 LDKCVec_MessageSendEventZ arg_constr;
4308 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4309 if (arg_constr.datalen > 0)
4310 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4312 arg_constr.data = NULL;
4313 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4314 for (size_t s = 0; s < arg_constr.datalen; s++) {
4315 int64_t arr_conv_18 = arg_vals[s];
4316 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
4317 FREE((void*)arr_conv_18);
4318 arg_constr.data[s] = arr_conv_18_conv;
4320 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4323 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
4324 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
4325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4326 return (void*) this_arg;
4328 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4329 jclass c = (*env)->GetObjectClass(env, o);
4331 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
4332 atomic_init(&calls->refcnt, 1);
4333 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4334 calls->o = (*env)->NewWeakGlobalRef(env, o);
4335 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
4336 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
4338 LDKMessageSendEventsProvider ret = {
4339 .this_arg = (void*) calls,
4340 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
4341 .free = LDKMessageSendEventsProvider_JCalls_free,
4345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4346 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4347 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
4348 return (long)res_ptr;
4350 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4351 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
4352 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
4353 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4354 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4355 for (size_t s = 0; s < ret_var.datalen; s++) {
4356 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4357 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
4358 long arr_conv_18_ref = (long)arr_conv_18_copy;
4359 ret_arr_ptr[s] = arr_conv_18_ref;
4361 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4366 typedef struct LDKEventsProvider_JCalls {
4367 atomic_size_t refcnt;
4370 jmethodID get_and_clear_pending_events_meth;
4371 } LDKEventsProvider_JCalls;
4372 static void LDKEventsProvider_JCalls_free(void* this_arg) {
4373 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4374 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4376 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4377 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4381 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
4382 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4384 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4385 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4387 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
4388 LDKCVec_EventZ arg_constr;
4389 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4390 if (arg_constr.datalen > 0)
4391 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4393 arg_constr.data = NULL;
4394 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4395 for (size_t h = 0; h < arg_constr.datalen; h++) {
4396 int64_t arr_conv_7 = arg_vals[h];
4397 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
4398 FREE((void*)arr_conv_7);
4399 arg_constr.data[h] = arr_conv_7_conv;
4401 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4404 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
4405 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
4406 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4407 return (void*) this_arg;
4409 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
4410 jclass c = (*env)->GetObjectClass(env, o);
4412 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4413 atomic_init(&calls->refcnt, 1);
4414 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4415 calls->o = (*env)->NewWeakGlobalRef(env, o);
4416 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
4417 CHECK(calls->get_and_clear_pending_events_meth != NULL);
4419 LDKEventsProvider ret = {
4420 .this_arg = (void*) calls,
4421 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
4422 .free = LDKEventsProvider_JCalls_free,
4426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
4427 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4428 *res_ptr = LDKEventsProvider_init(env, clz, o);
4429 return (long)res_ptr;
4431 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4432 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
4433 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4434 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4435 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4436 for (size_t h = 0; h < ret_var.datalen; h++) {
4437 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4438 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
4439 long arr_conv_7_ref = (long)arr_conv_7_copy;
4440 ret_arr_ptr[h] = arr_conv_7_ref;
4442 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4447 typedef struct LDKAccess_JCalls {
4448 atomic_size_t refcnt;
4451 jmethodID get_utxo_meth;
4453 static void LDKAccess_JCalls_free(void* this_arg) {
4454 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4455 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4457 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4458 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4462 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4463 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4466 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4467 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4470 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4471 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4472 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4475 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4476 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4477 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4478 return (void*) this_arg;
4480 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4481 jclass c = (*env)->GetObjectClass(env, o);
4483 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4484 atomic_init(&calls->refcnt, 1);
4485 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4486 calls->o = (*env)->NewWeakGlobalRef(env, o);
4487 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4488 CHECK(calls->get_utxo_meth != NULL);
4491 .this_arg = (void*) calls,
4492 .get_utxo = get_utxo_jcall,
4493 .free = LDKAccess_JCalls_free,
4497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4498 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4499 *res_ptr = LDKAccess_init(env, clz, o);
4500 return (long)res_ptr;
4502 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) {
4503 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
4504 unsigned char genesis_hash_arr[32];
4505 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4506 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4507 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4508 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4509 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4510 return (long)ret_conv;
4513 typedef struct LDKFilter_JCalls {
4514 atomic_size_t refcnt;
4517 jmethodID register_tx_meth;
4518 jmethodID register_output_meth;
4520 static void LDKFilter_JCalls_free(void* this_arg) {
4521 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4522 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4524 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4525 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4529 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4530 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4532 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4533 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4534 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4535 LDKu8slice script_pubkey_var = script_pubkey;
4536 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4537 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4538 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4540 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4542 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4543 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4545 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4546 LDKOutPoint outpoint_var = *outpoint;
4547 outpoint_var = OutPoint_clone(outpoint);
4548 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4549 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4550 long outpoint_ref = (long)outpoint_var.inner;
4551 if (outpoint_var.is_owned) {
4554 LDKu8slice script_pubkey_var = script_pubkey;
4555 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4556 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4557 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4559 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4561 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4562 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4563 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4564 return (void*) this_arg;
4566 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4567 jclass c = (*env)->GetObjectClass(env, o);
4569 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4570 atomic_init(&calls->refcnt, 1);
4571 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4572 calls->o = (*env)->NewWeakGlobalRef(env, o);
4573 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4574 CHECK(calls->register_tx_meth != NULL);
4575 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4576 CHECK(calls->register_output_meth != NULL);
4579 .this_arg = (void*) calls,
4580 .register_tx = register_tx_jcall,
4581 .register_output = register_output_jcall,
4582 .free = LDKFilter_JCalls_free,
4586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4587 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4588 *res_ptr = LDKFilter_init(env, clz, o);
4589 return (long)res_ptr;
4591 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) {
4592 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4593 unsigned char txid_arr[32];
4594 CHECK((*env)->GetArrayLength(env, txid) == 32);
4595 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4596 unsigned char (*txid_ref)[32] = &txid_arr;
4597 LDKu8slice script_pubkey_ref;
4598 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4599 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4600 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4601 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t outpoint, int8_tArray script_pubkey) {
4605 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4606 LDKOutPoint outpoint_conv;
4607 outpoint_conv.inner = (void*)(outpoint & (~1));
4608 outpoint_conv.is_owned = false;
4609 LDKu8slice script_pubkey_ref;
4610 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4611 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4612 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4613 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4616 typedef struct LDKPersist_JCalls {
4617 atomic_size_t refcnt;
4620 jmethodID persist_new_channel_meth;
4621 jmethodID update_persisted_channel_meth;
4622 } LDKPersist_JCalls;
4623 static void LDKPersist_JCalls_free(void* this_arg) {
4624 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4625 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4628 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4632 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4633 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4635 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4636 LDKOutPoint id_var = id;
4637 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4638 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4639 long id_ref = (long)id_var.inner;
4640 if (id_var.is_owned) {
4643 LDKChannelMonitor data_var = *data;
4644 data_var = ChannelMonitor_clone(data);
4645 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4646 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4647 long data_ref = (long)data_var.inner;
4648 if (data_var.is_owned) {
4651 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4653 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4654 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4655 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4658 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4659 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4661 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4662 LDKOutPoint id_var = id;
4663 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4664 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4665 long id_ref = (long)id_var.inner;
4666 if (id_var.is_owned) {
4669 LDKChannelMonitorUpdate update_var = *update;
4670 update_var = ChannelMonitorUpdate_clone(update);
4671 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4672 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4673 long update_ref = (long)update_var.inner;
4674 if (update_var.is_owned) {
4677 LDKChannelMonitor data_var = *data;
4678 data_var = ChannelMonitor_clone(data);
4679 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4680 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4681 long data_ref = (long)data_var.inner;
4682 if (data_var.is_owned) {
4685 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4687 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4688 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4689 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4692 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4693 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4694 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4695 return (void*) this_arg;
4697 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
4698 jclass c = (*env)->GetObjectClass(env, o);
4700 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4701 atomic_init(&calls->refcnt, 1);
4702 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4703 calls->o = (*env)->NewWeakGlobalRef(env, o);
4704 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4705 CHECK(calls->persist_new_channel_meth != NULL);
4706 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4707 CHECK(calls->update_persisted_channel_meth != NULL);
4710 .this_arg = (void*) calls,
4711 .persist_new_channel = persist_new_channel_jcall,
4712 .update_persisted_channel = update_persisted_channel_jcall,
4713 .free = LDKPersist_JCalls_free,
4717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
4718 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4719 *res_ptr = LDKPersist_init(env, clz, o);
4720 return (long)res_ptr;
4722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
4723 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4724 LDKOutPoint id_conv;
4725 id_conv.inner = (void*)(id & (~1));
4726 id_conv.is_owned = (id & 1) || (id == 0);
4727 id_conv = OutPoint_clone(&id_conv);
4728 LDKChannelMonitor data_conv;
4729 data_conv.inner = (void*)(data & (~1));
4730 data_conv.is_owned = false;
4731 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4732 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4733 return (long)ret_conv;
4736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
4737 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4738 LDKOutPoint id_conv;
4739 id_conv.inner = (void*)(id & (~1));
4740 id_conv.is_owned = (id & 1) || (id == 0);
4741 id_conv = OutPoint_clone(&id_conv);
4742 LDKChannelMonitorUpdate update_conv;
4743 update_conv.inner = (void*)(update & (~1));
4744 update_conv.is_owned = false;
4745 LDKChannelMonitor data_conv;
4746 data_conv.inner = (void*)(data & (~1));
4747 data_conv.is_owned = false;
4748 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4749 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4750 return (long)ret_conv;
4753 typedef struct LDKChannelMessageHandler_JCalls {
4754 atomic_size_t refcnt;
4757 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4758 jmethodID handle_open_channel_meth;
4759 jmethodID handle_accept_channel_meth;
4760 jmethodID handle_funding_created_meth;
4761 jmethodID handle_funding_signed_meth;
4762 jmethodID handle_funding_locked_meth;
4763 jmethodID handle_shutdown_meth;
4764 jmethodID handle_closing_signed_meth;
4765 jmethodID handle_update_add_htlc_meth;
4766 jmethodID handle_update_fulfill_htlc_meth;
4767 jmethodID handle_update_fail_htlc_meth;
4768 jmethodID handle_update_fail_malformed_htlc_meth;
4769 jmethodID handle_commitment_signed_meth;
4770 jmethodID handle_revoke_and_ack_meth;
4771 jmethodID handle_update_fee_meth;
4772 jmethodID handle_announcement_signatures_meth;
4773 jmethodID peer_disconnected_meth;
4774 jmethodID peer_connected_meth;
4775 jmethodID handle_channel_reestablish_meth;
4776 jmethodID handle_error_meth;
4777 } LDKChannelMessageHandler_JCalls;
4778 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4779 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4780 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4782 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4783 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4787 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4788 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4790 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4791 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4792 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4793 LDKInitFeatures their_features_var = their_features;
4794 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4795 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4796 long their_features_ref = (long)their_features_var.inner;
4797 if (their_features_var.is_owned) {
4798 their_features_ref |= 1;
4800 LDKOpenChannel msg_var = *msg;
4801 msg_var = OpenChannel_clone(msg);
4802 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4803 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4804 long msg_ref = (long)msg_var.inner;
4805 if (msg_var.is_owned) {
4808 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4810 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4812 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4813 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4815 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4816 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4817 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4818 LDKInitFeatures their_features_var = their_features;
4819 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4820 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4821 long their_features_ref = (long)their_features_var.inner;
4822 if (their_features_var.is_owned) {
4823 their_features_ref |= 1;
4825 LDKAcceptChannel msg_var = *msg;
4826 msg_var = AcceptChannel_clone(msg);
4827 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4828 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4829 long msg_ref = (long)msg_var.inner;
4830 if (msg_var.is_owned) {
4833 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4835 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4837 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4838 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4840 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4841 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4842 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4843 LDKFundingCreated msg_var = *msg;
4844 msg_var = FundingCreated_clone(msg);
4845 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4846 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4847 long msg_ref = (long)msg_var.inner;
4848 if (msg_var.is_owned) {
4851 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4853 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4855 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4856 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4858 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4859 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4860 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4861 LDKFundingSigned msg_var = *msg;
4862 msg_var = FundingSigned_clone(msg);
4863 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4864 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4865 long msg_ref = (long)msg_var.inner;
4866 if (msg_var.is_owned) {
4869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4871 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4873 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4874 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4876 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4877 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4878 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4879 LDKFundingLocked msg_var = *msg;
4880 msg_var = FundingLocked_clone(msg);
4881 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4882 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4883 long msg_ref = (long)msg_var.inner;
4884 if (msg_var.is_owned) {
4887 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4889 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4891 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4892 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4894 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4895 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4896 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4897 LDKShutdown msg_var = *msg;
4898 msg_var = Shutdown_clone(msg);
4899 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4900 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4901 long msg_ref = (long)msg_var.inner;
4902 if (msg_var.is_owned) {
4905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4907 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4909 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4910 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4912 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4913 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4914 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4915 LDKClosingSigned msg_var = *msg;
4916 msg_var = ClosingSigned_clone(msg);
4917 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4918 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4919 long msg_ref = (long)msg_var.inner;
4920 if (msg_var.is_owned) {
4923 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4925 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4927 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4928 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4930 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4931 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4932 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4933 LDKUpdateAddHTLC msg_var = *msg;
4934 msg_var = UpdateAddHTLC_clone(msg);
4935 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4936 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4937 long msg_ref = (long)msg_var.inner;
4938 if (msg_var.is_owned) {
4941 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4943 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4945 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4946 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4948 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4949 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4950 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4951 LDKUpdateFulfillHTLC msg_var = *msg;
4952 msg_var = UpdateFulfillHTLC_clone(msg);
4953 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4954 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4955 long msg_ref = (long)msg_var.inner;
4956 if (msg_var.is_owned) {
4959 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4961 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4963 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4964 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4966 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4967 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4968 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4969 LDKUpdateFailHTLC msg_var = *msg;
4970 msg_var = UpdateFailHTLC_clone(msg);
4971 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4972 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4973 long msg_ref = (long)msg_var.inner;
4974 if (msg_var.is_owned) {
4977 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4979 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4981 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4984 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
4985 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4986 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4987 LDKUpdateFailMalformedHTLC msg_var = *msg;
4988 msg_var = UpdateFailMalformedHTLC_clone(msg);
4989 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4990 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4991 long msg_ref = (long)msg_var.inner;
4992 if (msg_var.is_owned) {
4995 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4997 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4999 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
5000 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5002 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5003 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5004 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5005 LDKCommitmentSigned msg_var = *msg;
5006 msg_var = CommitmentSigned_clone(msg);
5007 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5008 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5009 long msg_ref = (long)msg_var.inner;
5010 if (msg_var.is_owned) {
5013 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5015 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
5017 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
5018 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5020 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5021 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5022 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5023 LDKRevokeAndACK msg_var = *msg;
5024 msg_var = RevokeAndACK_clone(msg);
5025 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5026 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5027 long msg_ref = (long)msg_var.inner;
5028 if (msg_var.is_owned) {
5031 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5033 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
5035 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
5036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5039 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5040 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5041 LDKUpdateFee msg_var = *msg;
5042 msg_var = UpdateFee_clone(msg);
5043 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5044 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5045 long msg_ref = (long)msg_var.inner;
5046 if (msg_var.is_owned) {
5049 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5051 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
5053 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
5054 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5056 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5057 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5058 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5059 LDKAnnouncementSignatures msg_var = *msg;
5060 msg_var = AnnouncementSignatures_clone(msg);
5061 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5062 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5063 long msg_ref = (long)msg_var.inner;
5064 if (msg_var.is_owned) {
5067 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5069 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
5071 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
5072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5074 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5075 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5076 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5077 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5079 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
5081 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
5082 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5084 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5085 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5086 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5087 LDKInit msg_var = *msg;
5088 msg_var = Init_clone(msg);
5089 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5090 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5091 long msg_ref = (long)msg_var.inner;
5092 if (msg_var.is_owned) {
5095 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5097 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
5099 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
5100 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5102 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5103 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5104 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5105 LDKChannelReestablish msg_var = *msg;
5106 msg_var = ChannelReestablish_clone(msg);
5107 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5108 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5109 long msg_ref = (long)msg_var.inner;
5110 if (msg_var.is_owned) {
5113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5115 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
5117 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
5118 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5120 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5121 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5122 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5123 LDKErrorMessage msg_var = *msg;
5124 msg_var = ErrorMessage_clone(msg);
5125 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5126 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5127 long msg_ref = (long)msg_var.inner;
5128 if (msg_var.is_owned) {
5131 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5133 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
5135 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
5136 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
5137 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5138 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5139 return (void*) this_arg;
5141 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5142 jclass c = (*env)->GetObjectClass(env, o);
5144 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
5145 atomic_init(&calls->refcnt, 1);
5146 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5147 calls->o = (*env)->NewWeakGlobalRef(env, o);
5148 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
5149 CHECK(calls->handle_open_channel_meth != NULL);
5150 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
5151 CHECK(calls->handle_accept_channel_meth != NULL);
5152 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
5153 CHECK(calls->handle_funding_created_meth != NULL);
5154 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
5155 CHECK(calls->handle_funding_signed_meth != NULL);
5156 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
5157 CHECK(calls->handle_funding_locked_meth != NULL);
5158 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
5159 CHECK(calls->handle_shutdown_meth != NULL);
5160 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
5161 CHECK(calls->handle_closing_signed_meth != NULL);
5162 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
5163 CHECK(calls->handle_update_add_htlc_meth != NULL);
5164 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
5165 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
5166 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
5167 CHECK(calls->handle_update_fail_htlc_meth != NULL);
5168 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
5169 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
5170 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
5171 CHECK(calls->handle_commitment_signed_meth != NULL);
5172 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
5173 CHECK(calls->handle_revoke_and_ack_meth != NULL);
5174 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
5175 CHECK(calls->handle_update_fee_meth != NULL);
5176 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
5177 CHECK(calls->handle_announcement_signatures_meth != NULL);
5178 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
5179 CHECK(calls->peer_disconnected_meth != NULL);
5180 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
5181 CHECK(calls->peer_connected_meth != NULL);
5182 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
5183 CHECK(calls->handle_channel_reestablish_meth != NULL);
5184 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
5185 CHECK(calls->handle_error_meth != NULL);
5187 LDKChannelMessageHandler ret = {
5188 .this_arg = (void*) calls,
5189 .handle_open_channel = handle_open_channel_jcall,
5190 .handle_accept_channel = handle_accept_channel_jcall,
5191 .handle_funding_created = handle_funding_created_jcall,
5192 .handle_funding_signed = handle_funding_signed_jcall,
5193 .handle_funding_locked = handle_funding_locked_jcall,
5194 .handle_shutdown = handle_shutdown_jcall,
5195 .handle_closing_signed = handle_closing_signed_jcall,
5196 .handle_update_add_htlc = handle_update_add_htlc_jcall,
5197 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
5198 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
5199 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
5200 .handle_commitment_signed = handle_commitment_signed_jcall,
5201 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
5202 .handle_update_fee = handle_update_fee_jcall,
5203 .handle_announcement_signatures = handle_announcement_signatures_jcall,
5204 .peer_disconnected = peer_disconnected_jcall,
5205 .peer_connected = peer_connected_jcall,
5206 .handle_channel_reestablish = handle_channel_reestablish_jcall,
5207 .handle_error = handle_error_jcall,
5208 .free = LDKChannelMessageHandler_JCalls_free,
5209 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5211 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5215 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5216 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5217 return (long)res_ptr;
5219 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) {
5220 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5221 LDKPublicKey their_node_id_ref;
5222 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5223 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5224 LDKInitFeatures their_features_conv;
5225 their_features_conv.inner = (void*)(their_features & (~1));
5226 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5227 their_features_conv = InitFeatures_clone(&their_features_conv);
5228 LDKOpenChannel msg_conv;
5229 msg_conv.inner = (void*)(msg & (~1));
5230 msg_conv.is_owned = false;
5231 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5234 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) {
5235 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5236 LDKPublicKey their_node_id_ref;
5237 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5238 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5239 LDKInitFeatures their_features_conv;
5240 their_features_conv.inner = (void*)(their_features & (~1));
5241 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
5242 their_features_conv = InitFeatures_clone(&their_features_conv);
5243 LDKAcceptChannel msg_conv;
5244 msg_conv.inner = (void*)(msg & (~1));
5245 msg_conv.is_owned = false;
5246 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
5249 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) {
5250 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5251 LDKPublicKey their_node_id_ref;
5252 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5253 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5254 LDKFundingCreated msg_conv;
5255 msg_conv.inner = (void*)(msg & (~1));
5256 msg_conv.is_owned = false;
5257 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5260 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) {
5261 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5262 LDKPublicKey their_node_id_ref;
5263 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5264 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5265 LDKFundingSigned msg_conv;
5266 msg_conv.inner = (void*)(msg & (~1));
5267 msg_conv.is_owned = false;
5268 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5272 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5273 LDKPublicKey their_node_id_ref;
5274 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5275 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5276 LDKFundingLocked msg_conv;
5277 msg_conv.inner = (void*)(msg & (~1));
5278 msg_conv.is_owned = false;
5279 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5282 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 msg) {
5283 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5284 LDKPublicKey their_node_id_ref;
5285 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5286 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5287 LDKShutdown msg_conv;
5288 msg_conv.inner = (void*)(msg & (~1));
5289 msg_conv.is_owned = false;
5290 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5293 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) {
5294 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5295 LDKPublicKey their_node_id_ref;
5296 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5297 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5298 LDKClosingSigned msg_conv;
5299 msg_conv.inner = (void*)(msg & (~1));
5300 msg_conv.is_owned = false;
5301 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5304 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) {
5305 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5306 LDKPublicKey their_node_id_ref;
5307 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5308 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5309 LDKUpdateAddHTLC msg_conv;
5310 msg_conv.inner = (void*)(msg & (~1));
5311 msg_conv.is_owned = false;
5312 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5315 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) {
5316 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5317 LDKPublicKey their_node_id_ref;
5318 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5319 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5320 LDKUpdateFulfillHTLC msg_conv;
5321 msg_conv.inner = (void*)(msg & (~1));
5322 msg_conv.is_owned = false;
5323 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5326 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) {
5327 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5328 LDKPublicKey their_node_id_ref;
5329 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5330 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5331 LDKUpdateFailHTLC msg_conv;
5332 msg_conv.inner = (void*)(msg & (~1));
5333 msg_conv.is_owned = false;
5334 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5337 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) {
5338 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5339 LDKPublicKey their_node_id_ref;
5340 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5341 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5342 LDKUpdateFailMalformedHTLC msg_conv;
5343 msg_conv.inner = (void*)(msg & (~1));
5344 msg_conv.is_owned = false;
5345 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5348 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) {
5349 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5350 LDKPublicKey their_node_id_ref;
5351 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5352 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5353 LDKCommitmentSigned msg_conv;
5354 msg_conv.inner = (void*)(msg & (~1));
5355 msg_conv.is_owned = false;
5356 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5359 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) {
5360 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5361 LDKPublicKey their_node_id_ref;
5362 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5363 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5364 LDKRevokeAndACK msg_conv;
5365 msg_conv.inner = (void*)(msg & (~1));
5366 msg_conv.is_owned = false;
5367 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5370 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) {
5371 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5372 LDKPublicKey their_node_id_ref;
5373 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5374 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5375 LDKUpdateFee msg_conv;
5376 msg_conv.inner = (void*)(msg & (~1));
5377 msg_conv.is_owned = false;
5378 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5381 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) {
5382 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5383 LDKPublicKey their_node_id_ref;
5384 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5385 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5386 LDKAnnouncementSignatures msg_conv;
5387 msg_conv.inner = (void*)(msg & (~1));
5388 msg_conv.is_owned = false;
5389 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5392 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) {
5393 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5394 LDKPublicKey their_node_id_ref;
5395 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5396 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5397 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
5400 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) {
5401 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5402 LDKPublicKey their_node_id_ref;
5403 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5404 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5406 msg_conv.inner = (void*)(msg & (~1));
5407 msg_conv.is_owned = false;
5408 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5411 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) {
5412 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5413 LDKPublicKey their_node_id_ref;
5414 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5415 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5416 LDKChannelReestablish msg_conv;
5417 msg_conv.inner = (void*)(msg & (~1));
5418 msg_conv.is_owned = false;
5419 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5422 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) {
5423 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
5424 LDKPublicKey their_node_id_ref;
5425 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5426 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5427 LDKErrorMessage msg_conv;
5428 msg_conv.inner = (void*)(msg & (~1));
5429 msg_conv.is_owned = false;
5430 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
5433 typedef struct LDKRoutingMessageHandler_JCalls {
5434 atomic_size_t refcnt;
5437 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
5438 jmethodID handle_node_announcement_meth;
5439 jmethodID handle_channel_announcement_meth;
5440 jmethodID handle_channel_update_meth;
5441 jmethodID handle_htlc_fail_channel_update_meth;
5442 jmethodID get_next_channel_announcements_meth;
5443 jmethodID get_next_node_announcements_meth;
5444 jmethodID sync_routing_table_meth;
5445 jmethodID handle_reply_channel_range_meth;
5446 jmethodID handle_reply_short_channel_ids_end_meth;
5447 jmethodID handle_query_channel_range_meth;
5448 jmethodID handle_query_short_channel_ids_meth;
5449 } LDKRoutingMessageHandler_JCalls;
5450 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5451 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5452 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5454 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5455 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5459 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5460 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5462 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5463 LDKNodeAnnouncement msg_var = *msg;
5464 msg_var = NodeAnnouncement_clone(msg);
5465 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5466 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5467 long msg_ref = (long)msg_var.inner;
5468 if (msg_var.is_owned) {
5471 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5473 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5474 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5475 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5478 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5479 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5481 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5482 LDKChannelAnnouncement msg_var = *msg;
5483 msg_var = ChannelAnnouncement_clone(msg);
5484 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5485 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5486 long msg_ref = (long)msg_var.inner;
5487 if (msg_var.is_owned) {
5490 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5492 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5493 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5494 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5497 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5498 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5500 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5501 LDKChannelUpdate msg_var = *msg;
5502 msg_var = ChannelUpdate_clone(msg);
5503 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5504 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5505 long msg_ref = (long)msg_var.inner;
5506 if (msg_var.is_owned) {
5509 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5511 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5512 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5513 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5516 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5517 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5519 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5520 long ret_update = (long)update;
5521 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5523 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5525 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5526 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5528 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5531 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5532 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5533 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5534 if (arg_constr.datalen > 0)
5535 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5537 arg_constr.data = NULL;
5538 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5539 for (size_t l = 0; l < arg_constr.datalen; l++) {
5540 int64_t arr_conv_63 = arg_vals[l];
5541 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
5542 FREE((void*)arr_conv_63);
5543 arg_constr.data[l] = arr_conv_63_conv;
5545 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5548 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5549 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5552 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5553 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5554 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5556 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5557 LDKCVec_NodeAnnouncementZ arg_constr;
5558 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5559 if (arg_constr.datalen > 0)
5560 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5562 arg_constr.data = NULL;
5563 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5564 for (size_t s = 0; s < arg_constr.datalen; s++) {
5565 int64_t arr_conv_18 = arg_vals[s];
5566 LDKNodeAnnouncement arr_conv_18_conv;
5567 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5568 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5569 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
5570 arg_constr.data[s] = arr_conv_18_conv;
5572 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5575 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5576 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5578 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5579 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5580 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5581 LDKInit init_var = *init;
5582 init_var = Init_clone(init);
5583 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5584 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5585 long init_ref = (long)init_var.inner;
5586 if (init_var.is_owned) {
5589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5591 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5593 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5594 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5597 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5598 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5599 LDKReplyChannelRange msg_var = msg;
5600 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5601 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5602 long msg_ref = (long)msg_var.inner;
5603 if (msg_var.is_owned) {
5606 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5608 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5609 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5610 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5613 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5614 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5616 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5617 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5618 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5619 LDKReplyShortChannelIdsEnd msg_var = msg;
5620 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5621 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5622 long msg_ref = (long)msg_var.inner;
5623 if (msg_var.is_owned) {
5626 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5628 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5629 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5630 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5633 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5634 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5636 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5637 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5638 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5639 LDKQueryChannelRange msg_var = msg;
5640 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5641 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5642 long msg_ref = (long)msg_var.inner;
5643 if (msg_var.is_owned) {
5646 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5648 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5649 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5650 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5653 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5654 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5656 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5657 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5658 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5659 LDKQueryShortChannelIds msg_var = msg;
5660 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5661 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5662 long msg_ref = (long)msg_var.inner;
5663 if (msg_var.is_owned) {
5666 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5668 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5669 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5670 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5673 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5674 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5675 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5676 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5677 return (void*) this_arg;
5679 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5680 jclass c = (*env)->GetObjectClass(env, o);
5682 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5683 atomic_init(&calls->refcnt, 1);
5684 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5685 calls->o = (*env)->NewWeakGlobalRef(env, o);
5686 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5687 CHECK(calls->handle_node_announcement_meth != NULL);
5688 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5689 CHECK(calls->handle_channel_announcement_meth != NULL);
5690 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5691 CHECK(calls->handle_channel_update_meth != NULL);
5692 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5693 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5694 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5695 CHECK(calls->get_next_channel_announcements_meth != NULL);
5696 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5697 CHECK(calls->get_next_node_announcements_meth != NULL);
5698 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5699 CHECK(calls->sync_routing_table_meth != NULL);
5700 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5701 CHECK(calls->handle_reply_channel_range_meth != NULL);
5702 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5703 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5704 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5705 CHECK(calls->handle_query_channel_range_meth != NULL);
5706 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5707 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5709 LDKRoutingMessageHandler ret = {
5710 .this_arg = (void*) calls,
5711 .handle_node_announcement = handle_node_announcement_jcall,
5712 .handle_channel_announcement = handle_channel_announcement_jcall,
5713 .handle_channel_update = handle_channel_update_jcall,
5714 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5715 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5716 .get_next_node_announcements = get_next_node_announcements_jcall,
5717 .sync_routing_table = sync_routing_table_jcall,
5718 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5719 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5720 .handle_query_channel_range = handle_query_channel_range_jcall,
5721 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5722 .free = LDKRoutingMessageHandler_JCalls_free,
5723 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5725 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5729 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5730 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5731 return (long)res_ptr;
5733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5734 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5735 LDKNodeAnnouncement msg_conv;
5736 msg_conv.inner = (void*)(msg & (~1));
5737 msg_conv.is_owned = false;
5738 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5739 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5740 return (long)ret_conv;
5743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5744 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5745 LDKChannelAnnouncement msg_conv;
5746 msg_conv.inner = (void*)(msg & (~1));
5747 msg_conv.is_owned = false;
5748 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5749 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5750 return (long)ret_conv;
5753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5754 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5755 LDKChannelUpdate msg_conv;
5756 msg_conv.inner = (void*)(msg & (~1));
5757 msg_conv.is_owned = false;
5758 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5759 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5760 return (long)ret_conv;
5763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
5764 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5765 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5766 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5769 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) {
5770 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5771 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5772 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5773 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5774 for (size_t l = 0; l < ret_var.datalen; l++) {
5775 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5776 *arr_conv_63_ref = ret_var.data[l];
5777 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5779 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5784 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) {
5785 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5786 LDKPublicKey starting_point_ref;
5787 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
5788 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
5789 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5790 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5791 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5792 for (size_t s = 0; s < ret_var.datalen; s++) {
5793 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5794 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5795 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5796 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5797 if (arr_conv_18_var.is_owned) {
5798 arr_conv_18_ref |= 1;
5800 ret_arr_ptr[s] = arr_conv_18_ref;
5802 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
5808 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5809 LDKPublicKey their_node_id_ref;
5810 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5811 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5813 init_conv.inner = (void*)(init & (~1));
5814 init_conv.is_owned = false;
5815 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5818 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) {
5819 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5820 LDKPublicKey their_node_id_ref;
5821 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5822 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5823 LDKReplyChannelRange msg_conv;
5824 msg_conv.inner = (void*)(msg & (~1));
5825 msg_conv.is_owned = (msg & 1) || (msg == 0);
5826 msg_conv = ReplyChannelRange_clone(&msg_conv);
5827 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5828 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5829 return (long)ret_conv;
5832 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) {
5833 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5834 LDKPublicKey their_node_id_ref;
5835 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5836 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5837 LDKReplyShortChannelIdsEnd msg_conv;
5838 msg_conv.inner = (void*)(msg & (~1));
5839 msg_conv.is_owned = (msg & 1) || (msg == 0);
5840 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5841 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5842 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5843 return (long)ret_conv;
5846 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) {
5847 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5848 LDKPublicKey their_node_id_ref;
5849 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5850 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5851 LDKQueryChannelRange msg_conv;
5852 msg_conv.inner = (void*)(msg & (~1));
5853 msg_conv.is_owned = (msg & 1) || (msg == 0);
5854 msg_conv = QueryChannelRange_clone(&msg_conv);
5855 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5856 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5857 return (long)ret_conv;
5860 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) {
5861 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5862 LDKPublicKey their_node_id_ref;
5863 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5864 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5865 LDKQueryShortChannelIds msg_conv;
5866 msg_conv.inner = (void*)(msg & (~1));
5867 msg_conv.is_owned = (msg & 1) || (msg == 0);
5868 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5869 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5870 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5871 return (long)ret_conv;
5874 typedef struct LDKSocketDescriptor_JCalls {
5875 atomic_size_t refcnt;
5878 jmethodID send_data_meth;
5879 jmethodID disconnect_socket_meth;
5881 jmethodID hash_meth;
5882 } LDKSocketDescriptor_JCalls;
5883 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5884 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5885 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5887 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5888 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5892 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5893 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5895 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5896 LDKu8slice data_var = data;
5897 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
5898 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
5899 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5901 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
5903 void disconnect_socket_jcall(void* this_arg) {
5904 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5906 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5907 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5909 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
5911 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5912 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5914 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5915 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5916 *other_arg_clone = SocketDescriptor_clone(other_arg);
5917 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5919 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
5921 uint64_t hash_jcall(const void* this_arg) {
5922 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK);
5925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5927 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
5929 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5930 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5931 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5932 return (void*) this_arg;
5934 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
5935 jclass c = (*env)->GetObjectClass(env, o);
5937 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5938 atomic_init(&calls->refcnt, 1);
5939 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5940 calls->o = (*env)->NewWeakGlobalRef(env, o);
5941 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5942 CHECK(calls->send_data_meth != NULL);
5943 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5944 CHECK(calls->disconnect_socket_meth != NULL);
5945 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5946 CHECK(calls->eq_meth != NULL);
5947 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5948 CHECK(calls->hash_meth != NULL);
5950 LDKSocketDescriptor ret = {
5951 .this_arg = (void*) calls,
5952 .send_data = send_data_jcall,
5953 .disconnect_socket = disconnect_socket_jcall,
5956 .clone = LDKSocketDescriptor_JCalls_clone,
5957 .free = LDKSocketDescriptor_JCalls_free,
5961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
5962 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5963 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
5964 return (long)res_ptr;
5966 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) {
5967 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5968 LDKu8slice data_ref;
5969 data_ref.datalen = (*env)->GetArrayLength(env, data);
5970 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
5971 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5972 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
5976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
5977 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5978 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
5982 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5983 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
5988 LDKTransaction _res_ref;
5989 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
5990 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5991 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
5992 _res_ref.data_is_owned = true;
5993 Transaction_free(_res_ref);
5996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
5997 if ((_res & 1) != 0) return;
5998 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
6000 TxOut_free(_res_conv);
6003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6004 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
6005 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6006 *ret_ref = TxOut_clone(orig_conv);
6007 return (long)ret_ref;
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6012 CHECK((*env)->GetArrayLength(env, o) == 32);
6013 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6014 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6015 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
6016 return (long)ret_conv;
6019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6020 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6021 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
6022 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
6023 return (long)ret_conv;
6026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6027 if ((_res & 1) != 0) return;
6028 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
6030 CResult_SecretKeyErrorZ_free(_res_conv);
6033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6035 CHECK((*env)->GetArrayLength(env, o) == 33);
6036 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6037 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6038 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
6039 return (long)ret_conv;
6042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6043 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6044 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
6045 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
6046 return (long)ret_conv;
6049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6050 if ((_res & 1) != 0) return;
6051 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
6053 CResult_PublicKeyErrorZ_free(_res_conv);
6056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6057 LDKTxCreationKeys o_conv;
6058 o_conv.inner = (void*)(o & (~1));
6059 o_conv.is_owned = (o & 1) || (o == 0);
6060 o_conv = TxCreationKeys_clone(&o_conv);
6061 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6062 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
6063 return (long)ret_conv;
6066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6067 LDKDecodeError e_conv;
6068 e_conv.inner = (void*)(e & (~1));
6069 e_conv.is_owned = (e & 1) || (e == 0);
6070 e_conv = DecodeError_clone(&e_conv);
6071 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6072 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
6073 return (long)ret_conv;
6076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6077 if ((_res & 1) != 0) return;
6078 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6080 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
6083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6084 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
6085 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
6086 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
6087 return (long)ret_conv;
6090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6091 LDKChannelPublicKeys o_conv;
6092 o_conv.inner = (void*)(o & (~1));
6093 o_conv.is_owned = (o & 1) || (o == 0);
6094 o_conv = ChannelPublicKeys_clone(&o_conv);
6095 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6096 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
6097 return (long)ret_conv;
6100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6101 LDKDecodeError e_conv;
6102 e_conv.inner = (void*)(e & (~1));
6103 e_conv.is_owned = (e & 1) || (e == 0);
6104 e_conv = DecodeError_clone(&e_conv);
6105 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6106 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
6107 return (long)ret_conv;
6110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6111 if ((_res & 1) != 0) return;
6112 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
6114 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
6117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6118 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
6119 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
6120 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
6121 return (long)ret_conv;
6124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6125 LDKTxCreationKeys o_conv;
6126 o_conv.inner = (void*)(o & (~1));
6127 o_conv.is_owned = (o & 1) || (o == 0);
6128 o_conv = TxCreationKeys_clone(&o_conv);
6129 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6130 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
6131 return (long)ret_conv;
6134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6135 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6136 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
6137 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
6138 return (long)ret_conv;
6141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6142 if ((_res & 1) != 0) return;
6143 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
6145 CResult_TxCreationKeysErrorZ_free(_res_conv);
6148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6149 LDKHTLCOutputInCommitment o_conv;
6150 o_conv.inner = (void*)(o & (~1));
6151 o_conv.is_owned = (o & 1) || (o == 0);
6152 o_conv = HTLCOutputInCommitment_clone(&o_conv);
6153 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6154 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
6155 return (long)ret_conv;
6158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6159 LDKDecodeError e_conv;
6160 e_conv.inner = (void*)(e & (~1));
6161 e_conv.is_owned = (e & 1) || (e == 0);
6162 e_conv = DecodeError_clone(&e_conv);
6163 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6164 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
6165 return (long)ret_conv;
6168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6169 if ((_res & 1) != 0) return;
6170 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
6172 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
6175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6176 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
6177 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
6178 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
6179 return (long)ret_conv;
6182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6183 LDKCounterpartyChannelTransactionParameters o_conv;
6184 o_conv.inner = (void*)(o & (~1));
6185 o_conv.is_owned = (o & 1) || (o == 0);
6186 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
6187 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6188 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6189 return (long)ret_conv;
6192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6193 LDKDecodeError e_conv;
6194 e_conv.inner = (void*)(e & (~1));
6195 e_conv.is_owned = (e & 1) || (e == 0);
6196 e_conv = DecodeError_clone(&e_conv);
6197 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6198 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
6199 return (long)ret_conv;
6202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6203 if ((_res & 1) != 0) return;
6204 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6206 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6210 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6211 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
6212 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6213 return (long)ret_conv;
6216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6217 LDKChannelTransactionParameters o_conv;
6218 o_conv.inner = (void*)(o & (~1));
6219 o_conv.is_owned = (o & 1) || (o == 0);
6220 o_conv = ChannelTransactionParameters_clone(&o_conv);
6221 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6222 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
6223 return (long)ret_conv;
6226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6227 LDKDecodeError e_conv;
6228 e_conv.inner = (void*)(e & (~1));
6229 e_conv.is_owned = (e & 1) || (e == 0);
6230 e_conv = DecodeError_clone(&e_conv);
6231 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6232 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
6233 return (long)ret_conv;
6236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6237 if ((_res & 1) != 0) return;
6238 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
6240 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
6243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6244 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
6245 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
6246 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
6247 return (long)ret_conv;
6250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6251 LDKCVec_SignatureZ _res_constr;
6252 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6253 if (_res_constr.datalen > 0)
6254 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6256 _res_constr.data = NULL;
6257 for (size_t i = 0; i < _res_constr.datalen; i++) {
6258 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6259 LDKSignature arr_conv_8_ref;
6260 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
6261 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6262 _res_constr.data[i] = arr_conv_8_ref;
6264 CVec_SignatureZ_free(_res_constr);
6267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6268 LDKHolderCommitmentTransaction o_conv;
6269 o_conv.inner = (void*)(o & (~1));
6270 o_conv.is_owned = (o & 1) || (o == 0);
6271 o_conv = HolderCommitmentTransaction_clone(&o_conv);
6272 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6273 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
6274 return (long)ret_conv;
6277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6278 LDKDecodeError e_conv;
6279 e_conv.inner = (void*)(e & (~1));
6280 e_conv.is_owned = (e & 1) || (e == 0);
6281 e_conv = DecodeError_clone(&e_conv);
6282 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6283 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
6284 return (long)ret_conv;
6287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6288 if ((_res & 1) != 0) return;
6289 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6291 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
6294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6295 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6296 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
6297 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6298 return (long)ret_conv;
6301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6302 LDKBuiltCommitmentTransaction o_conv;
6303 o_conv.inner = (void*)(o & (~1));
6304 o_conv.is_owned = (o & 1) || (o == 0);
6305 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
6306 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6307 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
6308 return (long)ret_conv;
6311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6312 LDKDecodeError e_conv;
6313 e_conv.inner = (void*)(e & (~1));
6314 e_conv.is_owned = (e & 1) || (e == 0);
6315 e_conv = DecodeError_clone(&e_conv);
6316 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6317 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
6318 return (long)ret_conv;
6321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6322 if ((_res & 1) != 0) return;
6323 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6325 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
6328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6329 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
6330 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
6331 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
6332 return (long)ret_conv;
6335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6336 LDKCommitmentTransaction o_conv;
6337 o_conv.inner = (void*)(o & (~1));
6338 o_conv.is_owned = (o & 1) || (o == 0);
6339 o_conv = CommitmentTransaction_clone(&o_conv);
6340 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6341 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
6342 return (long)ret_conv;
6345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6346 LDKDecodeError e_conv;
6347 e_conv.inner = (void*)(e & (~1));
6348 e_conv.is_owned = (e & 1) || (e == 0);
6349 e_conv = DecodeError_clone(&e_conv);
6350 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6351 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
6352 return (long)ret_conv;
6355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6356 if ((_res & 1) != 0) return;
6357 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
6359 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
6362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6363 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
6364 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
6365 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
6366 return (long)ret_conv;
6369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6370 LDKTrustedCommitmentTransaction o_conv;
6371 o_conv.inner = (void*)(o & (~1));
6372 o_conv.is_owned = (o & 1) || (o == 0);
6373 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6374 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6375 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6376 return (long)ret_conv;
6379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6380 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6381 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6382 return (long)ret_conv;
6385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6386 if ((_res & 1) != 0) return;
6387 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
6389 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6393 LDKCVec_SignatureZ o_constr;
6394 o_constr.datalen = (*env)->GetArrayLength(env, o);
6395 if (o_constr.datalen > 0)
6396 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6398 o_constr.data = NULL;
6399 for (size_t i = 0; i < o_constr.datalen; i++) {
6400 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6401 LDKSignature arr_conv_8_ref;
6402 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
6403 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6404 o_constr.data[i] = arr_conv_8_ref;
6406 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6407 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6408 return (long)ret_conv;
6411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6412 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6413 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6414 return (long)ret_conv;
6417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6418 if ((_res & 1) != 0) return;
6419 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
6421 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6425 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
6426 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6427 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6428 return (long)ret_conv;
6431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6432 LDKCVec_PublicKeyZ _res_constr;
6433 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6434 if (_res_constr.datalen > 0)
6435 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6437 _res_constr.data = NULL;
6438 for (size_t i = 0; i < _res_constr.datalen; i++) {
6439 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6440 LDKPublicKey arr_conv_8_ref;
6441 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33);
6442 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6443 _res_constr.data[i] = arr_conv_8_ref;
6445 CVec_PublicKeyZ_free(_res_constr);
6448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6449 LDKCVec_u8Z _res_ref;
6450 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6451 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6452 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6453 CVec_u8Z_free(_res_ref);
6456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6458 o_ref.datalen = (*env)->GetArrayLength(env, o);
6459 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6460 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6461 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6462 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6463 return (long)ret_conv;
6466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6467 LDKPeerHandleError e_conv;
6468 e_conv.inner = (void*)(e & (~1));
6469 e_conv.is_owned = (e & 1) || (e == 0);
6470 e_conv = PeerHandleError_clone(&e_conv);
6471 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6472 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6473 return (long)ret_conv;
6476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6477 if ((_res & 1) != 0) return;
6478 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6480 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6484 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6485 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6486 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6487 return (long)ret_conv;
6490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6491 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6492 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6493 return (long)ret_conv;
6496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6497 LDKPeerHandleError e_conv;
6498 e_conv.inner = (void*)(e & (~1));
6499 e_conv.is_owned = (e & 1) || (e == 0);
6500 e_conv = PeerHandleError_clone(&e_conv);
6501 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6502 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6503 return (long)ret_conv;
6506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6507 if ((_res & 1) != 0) return;
6508 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6510 CResult_NonePeerHandleErrorZ_free(_res_conv);
6513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6514 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6515 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6516 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6517 return (long)ret_conv;
6520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6521 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6522 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6523 return (long)ret_conv;
6526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6527 LDKPeerHandleError e_conv;
6528 e_conv.inner = (void*)(e & (~1));
6529 e_conv.is_owned = (e & 1) || (e == 0);
6530 e_conv = PeerHandleError_clone(&e_conv);
6531 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6532 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6533 return (long)ret_conv;
6536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6537 if ((_res & 1) != 0) return;
6538 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6540 CResult_boolPeerHandleErrorZ_free(_res_conv);
6543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6544 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6545 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6546 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6547 return (long)ret_conv;
6550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6551 LDKInitFeatures o_conv;
6552 o_conv.inner = (void*)(o & (~1));
6553 o_conv.is_owned = (o & 1) || (o == 0);
6554 o_conv = InitFeatures_clone(&o_conv);
6555 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6556 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
6557 return (long)ret_conv;
6560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6561 LDKDecodeError e_conv;
6562 e_conv.inner = (void*)(e & (~1));
6563 e_conv.is_owned = (e & 1) || (e == 0);
6564 e_conv = DecodeError_clone(&e_conv);
6565 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6566 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
6567 return (long)ret_conv;
6570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6571 if ((_res & 1) != 0) return;
6572 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6574 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
6577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6578 LDKNodeFeatures o_conv;
6579 o_conv.inner = (void*)(o & (~1));
6580 o_conv.is_owned = (o & 1) || (o == 0);
6581 o_conv = NodeFeatures_clone(&o_conv);
6582 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6583 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
6584 return (long)ret_conv;
6587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6588 LDKDecodeError e_conv;
6589 e_conv.inner = (void*)(e & (~1));
6590 e_conv.is_owned = (e & 1) || (e == 0);
6591 e_conv = DecodeError_clone(&e_conv);
6592 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6593 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
6594 return (long)ret_conv;
6597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6598 if ((_res & 1) != 0) return;
6599 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6601 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
6604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6605 LDKChannelFeatures o_conv;
6606 o_conv.inner = (void*)(o & (~1));
6607 o_conv.is_owned = (o & 1) || (o == 0);
6608 o_conv = ChannelFeatures_clone(&o_conv);
6609 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6610 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
6611 return (long)ret_conv;
6614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6615 LDKDecodeError e_conv;
6616 e_conv.inner = (void*)(e & (~1));
6617 e_conv.is_owned = (e & 1) || (e == 0);
6618 e_conv = DecodeError_clone(&e_conv);
6619 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6620 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
6621 return (long)ret_conv;
6624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6625 if ((_res & 1) != 0) return;
6626 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6628 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
6631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6632 LDKChannelConfig o_conv;
6633 o_conv.inner = (void*)(o & (~1));
6634 o_conv.is_owned = (o & 1) || (o == 0);
6635 o_conv = ChannelConfig_clone(&o_conv);
6636 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6637 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
6638 return (long)ret_conv;
6641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6642 LDKDecodeError e_conv;
6643 e_conv.inner = (void*)(e & (~1));
6644 e_conv.is_owned = (e & 1) || (e == 0);
6645 e_conv = DecodeError_clone(&e_conv);
6646 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6647 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
6648 return (long)ret_conv;
6651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6652 if ((_res & 1) != 0) return;
6653 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
6655 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
6658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6659 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
6660 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6661 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
6662 return (long)ret_conv;
6665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6666 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6667 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6668 return (long)ret_conv;
6671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6672 LDKLightningError e_conv;
6673 e_conv.inner = (void*)(e & (~1));
6674 e_conv.is_owned = (e & 1) || (e == 0);
6675 e_conv = LightningError_clone(&e_conv);
6676 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6677 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6678 return (long)ret_conv;
6681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6682 if ((_res & 1) != 0) return;
6683 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6685 CResult_boolLightningErrorZ_free(_res_conv);
6688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6689 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6690 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6691 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6692 return (long)ret_conv;
6695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6696 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
6697 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6698 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
6699 return (long)ret_ref;
6702 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) {
6703 LDKChannelAnnouncement a_conv;
6704 a_conv.inner = (void*)(a & (~1));
6705 a_conv.is_owned = (a & 1) || (a == 0);
6706 a_conv = ChannelAnnouncement_clone(&a_conv);
6707 LDKChannelUpdate b_conv;
6708 b_conv.inner = (void*)(b & (~1));
6709 b_conv.is_owned = (b & 1) || (b == 0);
6710 b_conv = ChannelUpdate_clone(&b_conv);
6711 LDKChannelUpdate c_conv;
6712 c_conv.inner = (void*)(c & (~1));
6713 c_conv.is_owned = (c & 1) || (c == 0);
6714 c_conv = ChannelUpdate_clone(&c_conv);
6715 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6716 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6717 return (long)ret_ref;
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6721 if ((_res & 1) != 0) return;
6722 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6724 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6728 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6729 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6730 if (_res_constr.datalen > 0)
6731 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6733 _res_constr.data = NULL;
6734 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6735 for (size_t l = 0; l < _res_constr.datalen; l++) {
6736 int64_t arr_conv_63 = _res_vals[l];
6737 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
6738 FREE((void*)arr_conv_63);
6739 _res_constr.data[l] = arr_conv_63_conv;
6741 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6742 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6746 LDKCVec_NodeAnnouncementZ _res_constr;
6747 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6748 if (_res_constr.datalen > 0)
6749 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6751 _res_constr.data = NULL;
6752 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6753 for (size_t s = 0; s < _res_constr.datalen; s++) {
6754 int64_t arr_conv_18 = _res_vals[s];
6755 LDKNodeAnnouncement arr_conv_18_conv;
6756 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6757 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6758 _res_constr.data[s] = arr_conv_18_conv;
6760 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6761 CVec_NodeAnnouncementZ_free(_res_constr);
6764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6765 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6766 *ret_conv = CResult_NoneLightningErrorZ_ok();
6767 return (long)ret_conv;
6770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6771 LDKLightningError e_conv;
6772 e_conv.inner = (void*)(e & (~1));
6773 e_conv.is_owned = (e & 1) || (e == 0);
6774 e_conv = LightningError_clone(&e_conv);
6775 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6776 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6777 return (long)ret_conv;
6780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6781 if ((_res & 1) != 0) return;
6782 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6784 CResult_NoneLightningErrorZ_free(_res_conv);
6787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6788 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6789 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6790 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6791 return (long)ret_conv;
6794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6795 LDKCVec_MessageSendEventZ _res_constr;
6796 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6797 if (_res_constr.datalen > 0)
6798 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6800 _res_constr.data = NULL;
6801 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6802 for (size_t s = 0; s < _res_constr.datalen; s++) {
6803 int64_t arr_conv_18 = _res_vals[s];
6804 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
6805 FREE((void*)arr_conv_18);
6806 _res_constr.data[s] = arr_conv_18_conv;
6808 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6809 CVec_MessageSendEventZ_free(_res_constr);
6812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6813 LDKDirectionalChannelInfo o_conv;
6814 o_conv.inner = (void*)(o & (~1));
6815 o_conv.is_owned = (o & 1) || (o == 0);
6816 o_conv = DirectionalChannelInfo_clone(&o_conv);
6817 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6818 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
6819 return (long)ret_conv;
6822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6823 LDKDecodeError e_conv;
6824 e_conv.inner = (void*)(e & (~1));
6825 e_conv.is_owned = (e & 1) || (e == 0);
6826 e_conv = DecodeError_clone(&e_conv);
6827 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6828 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
6829 return (long)ret_conv;
6832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6833 if ((_res & 1) != 0) return;
6834 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6836 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6840 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
6841 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6842 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
6843 return (long)ret_conv;
6846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6847 LDKChannelInfo o_conv;
6848 o_conv.inner = (void*)(o & (~1));
6849 o_conv.is_owned = (o & 1) || (o == 0);
6850 // Warning: we need a move here but no clone is available for LDKChannelInfo
6851 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6852 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
6853 return (long)ret_conv;
6856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6857 LDKDecodeError e_conv;
6858 e_conv.inner = (void*)(e & (~1));
6859 e_conv.is_owned = (e & 1) || (e == 0);
6860 e_conv = DecodeError_clone(&e_conv);
6861 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6862 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
6863 return (long)ret_conv;
6866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6867 if ((_res & 1) != 0) return;
6868 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6870 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
6873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6874 LDKRoutingFees o_conv;
6875 o_conv.inner = (void*)(o & (~1));
6876 o_conv.is_owned = (o & 1) || (o == 0);
6877 o_conv = RoutingFees_clone(&o_conv);
6878 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6879 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6880 return (long)ret_conv;
6883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6884 LDKDecodeError e_conv;
6885 e_conv.inner = (void*)(e & (~1));
6886 e_conv.is_owned = (e & 1) || (e == 0);
6887 e_conv = DecodeError_clone(&e_conv);
6888 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6889 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6890 return (long)ret_conv;
6893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6894 if ((_res & 1) != 0) return;
6895 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6897 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6901 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
6902 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6903 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
6904 return (long)ret_conv;
6907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6908 LDKCVec_NetAddressZ _res_constr;
6909 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6910 if (_res_constr.datalen > 0)
6911 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6913 _res_constr.data = NULL;
6914 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6915 for (size_t m = 0; m < _res_constr.datalen; m++) {
6916 int64_t arr_conv_12 = _res_vals[m];
6917 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
6918 FREE((void*)arr_conv_12);
6919 _res_constr.data[m] = arr_conv_12_conv;
6921 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6922 CVec_NetAddressZ_free(_res_constr);
6925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6926 LDKNodeAnnouncementInfo o_conv;
6927 o_conv.inner = (void*)(o & (~1));
6928 o_conv.is_owned = (o & 1) || (o == 0);
6929 o_conv = NodeAnnouncementInfo_clone(&o_conv);
6930 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6931 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6932 return (long)ret_conv;
6935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6936 LDKDecodeError e_conv;
6937 e_conv.inner = (void*)(e & (~1));
6938 e_conv.is_owned = (e & 1) || (e == 0);
6939 e_conv = DecodeError_clone(&e_conv);
6940 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6941 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6942 return (long)ret_conv;
6945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6946 if ((_res & 1) != 0) return;
6947 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6949 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6953 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
6954 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6955 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
6956 return (long)ret_conv;
6959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6960 LDKCVec_u64Z _res_constr;
6961 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6962 if (_res_constr.datalen > 0)
6963 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6965 _res_constr.data = NULL;
6966 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6967 for (size_t g = 0; g < _res_constr.datalen; g++) {
6968 int64_t arr_conv_6 = _res_vals[g];
6969 _res_constr.data[g] = arr_conv_6;
6971 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6972 CVec_u64Z_free(_res_constr);
6975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6977 o_conv.inner = (void*)(o & (~1));
6978 o_conv.is_owned = (o & 1) || (o == 0);
6979 o_conv = NodeInfo_clone(&o_conv);
6980 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6981 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6982 return (long)ret_conv;
6985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6986 LDKDecodeError e_conv;
6987 e_conv.inner = (void*)(e & (~1));
6988 e_conv.is_owned = (e & 1) || (e == 0);
6989 e_conv = DecodeError_clone(&e_conv);
6990 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6991 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6992 return (long)ret_conv;
6995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6996 if ((_res & 1) != 0) return;
6997 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6999 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7003 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7004 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7005 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7006 return (long)ret_conv;
7009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7010 LDKNetworkGraph o_conv;
7011 o_conv.inner = (void*)(o & (~1));
7012 o_conv.is_owned = (o & 1) || (o == 0);
7013 // Warning: we need a move here but no clone is available for LDKNetworkGraph
7014 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7015 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7016 return (long)ret_conv;
7019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7020 LDKDecodeError e_conv;
7021 e_conv.inner = (void*)(e & (~1));
7022 e_conv.is_owned = (e & 1) || (e == 0);
7023 e_conv = DecodeError_clone(&e_conv);
7024 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7025 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7026 return (long)ret_conv;
7029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7030 if ((_res & 1) != 0) return;
7031 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7033 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7037 LDKTransaction b_ref;
7038 b_ref.datalen = (*env)->GetArrayLength(env, b);
7039 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
7040 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7041 b_ref.data_is_owned = true;
7042 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7043 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
7044 return (long)ret_ref;
7047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7048 if ((_res & 1) != 0) return;
7049 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
7051 C2Tuple_usizeTransactionZ_free(_res_conv);
7054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7055 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
7056 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7057 if (_res_constr.datalen > 0)
7058 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7060 _res_constr.data = NULL;
7061 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7062 for (size_t y = 0; y < _res_constr.datalen; y++) {
7063 int64_t arr_conv_24 = _res_vals[y];
7064 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
7065 FREE((void*)arr_conv_24);
7066 _res_constr.data[y] = arr_conv_24_conv;
7068 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7069 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
7072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
7073 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7074 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
7075 return (long)ret_conv;
7078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
7079 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
7080 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7081 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
7082 return (long)ret_conv;
7085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7086 if ((_res & 1) != 0) return;
7087 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
7089 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7093 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
7094 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7095 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
7096 return (long)ret_conv;
7099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7100 LDKCVec_MonitorEventZ _res_constr;
7101 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7102 if (_res_constr.datalen > 0)
7103 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
7105 _res_constr.data = NULL;
7106 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7107 for (size_t o = 0; o < _res_constr.datalen; o++) {
7108 int64_t arr_conv_14 = _res_vals[o];
7109 LDKMonitorEvent arr_conv_14_conv;
7110 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
7111 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
7112 _res_constr.data[o] = arr_conv_14_conv;
7114 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7115 CVec_MonitorEventZ_free(_res_constr);
7118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7119 LDKCVec_EventZ _res_constr;
7120 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7121 if (_res_constr.datalen > 0)
7122 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
7124 _res_constr.data = NULL;
7125 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7126 for (size_t h = 0; h < _res_constr.datalen; h++) {
7127 int64_t arr_conv_7 = _res_vals[h];
7128 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
7129 FREE((void*)arr_conv_7);
7130 _res_constr.data[h] = arr_conv_7_conv;
7132 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7133 CVec_EventZ_free(_res_constr);
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7138 o_conv.inner = (void*)(o & (~1));
7139 o_conv.is_owned = (o & 1) || (o == 0);
7140 o_conv = OutPoint_clone(&o_conv);
7141 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7142 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
7143 return (long)ret_conv;
7146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7147 LDKDecodeError e_conv;
7148 e_conv.inner = (void*)(e & (~1));
7149 e_conv.is_owned = (e & 1) || (e == 0);
7150 e_conv = DecodeError_clone(&e_conv);
7151 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7152 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
7153 return (long)ret_conv;
7156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7157 if ((_res & 1) != 0) return;
7158 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
7160 CResult_OutPointDecodeErrorZ_free(_res_conv);
7163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7164 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
7165 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
7166 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
7167 return (long)ret_conv;
7170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7171 LDKChannelMonitorUpdate o_conv;
7172 o_conv.inner = (void*)(o & (~1));
7173 o_conv.is_owned = (o & 1) || (o == 0);
7174 o_conv = ChannelMonitorUpdate_clone(&o_conv);
7175 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7176 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
7177 return (long)ret_conv;
7180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7181 LDKDecodeError e_conv;
7182 e_conv.inner = (void*)(e & (~1));
7183 e_conv.is_owned = (e & 1) || (e == 0);
7184 e_conv = DecodeError_clone(&e_conv);
7185 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7186 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
7187 return (long)ret_conv;
7190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7191 if ((_res & 1) != 0) return;
7192 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7194 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
7197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7198 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
7199 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7200 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
7201 return (long)ret_conv;
7204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7205 LDKHTLCUpdate o_conv;
7206 o_conv.inner = (void*)(o & (~1));
7207 o_conv.is_owned = (o & 1) || (o == 0);
7208 o_conv = HTLCUpdate_clone(&o_conv);
7209 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7210 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
7211 return (long)ret_conv;
7214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7215 LDKDecodeError e_conv;
7216 e_conv.inner = (void*)(e & (~1));
7217 e_conv.is_owned = (e & 1) || (e == 0);
7218 e_conv = DecodeError_clone(&e_conv);
7219 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7220 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
7221 return (long)ret_conv;
7224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7225 if ((_res & 1) != 0) return;
7226 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
7228 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
7231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7232 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
7233 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
7234 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
7235 return (long)ret_conv;
7238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
7239 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7240 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
7241 return (long)ret_conv;
7244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7245 LDKMonitorUpdateError e_conv;
7246 e_conv.inner = (void*)(e & (~1));
7247 e_conv.is_owned = (e & 1) || (e == 0);
7248 e_conv = MonitorUpdateError_clone(&e_conv);
7249 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7250 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
7251 return (long)ret_conv;
7254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7255 if ((_res & 1) != 0) return;
7256 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
7258 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
7261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7262 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
7263 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7264 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
7265 return (long)ret_conv;
7268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7269 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
7270 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7271 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
7272 return (long)ret_ref;
7275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
7277 a_conv.inner = (void*)(a & (~1));
7278 a_conv.is_owned = (a & 1) || (a == 0);
7279 a_conv = OutPoint_clone(&a_conv);
7281 b_ref.datalen = (*env)->GetArrayLength(env, b);
7282 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
7283 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
7284 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7285 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
7286 return (long)ret_ref;
7289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7290 if ((_res & 1) != 0) return;
7291 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
7293 C2Tuple_OutPointScriptZ_free(_res_conv);
7296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7297 LDKCVec_TransactionZ _res_constr;
7298 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7299 if (_res_constr.datalen > 0)
7300 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7302 _res_constr.data = NULL;
7303 for (size_t i = 0; i < _res_constr.datalen; i++) {
7304 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
7305 LDKTransaction arr_conv_8_ref;
7306 arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8);
7307 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
7308 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
7309 arr_conv_8_ref.data_is_owned = true;
7310 _res_constr.data[i] = arr_conv_8_ref;
7312 CVec_TransactionZ_free(_res_constr);
7315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7316 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
7317 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7318 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
7319 return (long)ret_ref;
7322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
7323 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
7325 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7326 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
7327 return (long)ret_ref;
7330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7331 if ((_res & 1) != 0) return;
7332 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
7334 C2Tuple_u32TxOutZ_free(_res_conv);
7337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7338 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
7339 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7340 if (_res_constr.datalen > 0)
7341 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7343 _res_constr.data = NULL;
7344 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7345 for (size_t a = 0; a < _res_constr.datalen; a++) {
7346 int64_t arr_conv_26 = _res_vals[a];
7347 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
7348 FREE((void*)arr_conv_26);
7349 _res_constr.data[a] = arr_conv_26_conv;
7351 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7352 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
7355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
7356 LDKThirtyTwoBytes a_ref;
7357 CHECK((*env)->GetArrayLength(env, a) == 32);
7358 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7359 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
7360 b_constr.datalen = (*env)->GetArrayLength(env, b);
7361 if (b_constr.datalen > 0)
7362 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
7364 b_constr.data = NULL;
7365 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
7366 for (size_t a = 0; a < b_constr.datalen; a++) {
7367 int64_t arr_conv_26 = b_vals[a];
7368 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
7369 FREE((void*)arr_conv_26);
7370 b_constr.data[a] = arr_conv_26_conv;
7372 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
7373 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7374 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
7375 return (long)ret_ref;
7378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7379 if ((_res & 1) != 0) return;
7380 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
7382 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
7385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7386 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
7387 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7388 if (_res_constr.datalen > 0)
7389 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
7391 _res_constr.data = NULL;
7392 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7393 for (size_t u = 0; u < _res_constr.datalen; u++) {
7394 int64_t arr_conv_46 = _res_vals[u];
7395 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_46) & ~1);
7396 FREE((void*)arr_conv_46);
7397 _res_constr.data[u] = arr_conv_46_conv;
7399 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7400 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
7403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7404 LDKThirtyTwoBytes a_ref;
7405 CHECK((*env)->GetArrayLength(env, a) == 32);
7406 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7407 LDKChannelMonitor b_conv;
7408 b_conv.inner = (void*)(b & (~1));
7409 b_conv.is_owned = (b & 1) || (b == 0);
7410 b_conv = ChannelMonitor_clone(&b_conv);
7411 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7412 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7413 return (long)ret_ref;
7416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7417 if ((_res & 1) != 0) return;
7418 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7420 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7424 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
7426 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7427 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
7428 return (long)ret_conv;
7431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7432 LDKDecodeError e_conv;
7433 e_conv.inner = (void*)(e & (~1));
7434 e_conv.is_owned = (e & 1) || (e == 0);
7435 e_conv = DecodeError_clone(&e_conv);
7436 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7437 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
7438 return (long)ret_conv;
7441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7442 if ((_res & 1) != 0) return;
7443 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7445 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
7448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7449 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7450 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7451 if (_res_constr.datalen > 0)
7452 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7454 _res_constr.data = NULL;
7455 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7456 for (size_t b = 0; b < _res_constr.datalen; b++) {
7457 int64_t arr_conv_27 = _res_vals[b];
7458 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1);
7459 FREE((void*)arr_conv_27);
7460 _res_constr.data[b] = arr_conv_27_conv;
7462 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7463 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7467 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7469 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7470 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7471 return (long)ret_conv;
7474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7475 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
7476 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7477 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7478 return (long)ret_conv;
7481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7482 if ((_res & 1) != 0) return;
7483 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7485 CResult_TxOutAccessErrorZ_free(_res_conv);
7488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7489 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7490 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7491 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7492 return (long)ret_conv;
7495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
7496 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7497 *ret_conv = CResult_NoneAPIErrorZ_ok();
7498 return (long)ret_conv;
7501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7502 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
7504 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7505 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
7506 return (long)ret_conv;
7509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7510 if ((_res & 1) != 0) return;
7511 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
7513 CResult_NoneAPIErrorZ_free(_res_conv);
7516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7517 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
7518 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7519 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
7520 return (long)ret_conv;
7523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7524 LDKCVec_ChannelDetailsZ _res_constr;
7525 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7526 if (_res_constr.datalen > 0)
7527 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7529 _res_constr.data = NULL;
7530 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7531 for (size_t q = 0; q < _res_constr.datalen; q++) {
7532 int64_t arr_conv_16 = _res_vals[q];
7533 LDKChannelDetails arr_conv_16_conv;
7534 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7535 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7536 _res_constr.data[q] = arr_conv_16_conv;
7538 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7539 CVec_ChannelDetailsZ_free(_res_constr);
7542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
7543 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7544 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
7545 return (long)ret_conv;
7548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7549 LDKPaymentSendFailure e_conv;
7550 e_conv.inner = (void*)(e & (~1));
7551 e_conv.is_owned = (e & 1) || (e == 0);
7552 e_conv = PaymentSendFailure_clone(&e_conv);
7553 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7554 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
7555 return (long)ret_conv;
7558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7559 if ((_res & 1) != 0) return;
7560 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
7562 CResult_NonePaymentSendFailureZ_free(_res_conv);
7565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7566 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
7567 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7568 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
7569 return (long)ret_conv;
7572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7573 LDKCVec_ChannelMonitorZ _res_constr;
7574 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7575 if (_res_constr.datalen > 0)
7576 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7578 _res_constr.data = NULL;
7579 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7580 for (size_t q = 0; q < _res_constr.datalen; q++) {
7581 int64_t arr_conv_16 = _res_vals[q];
7582 LDKChannelMonitor arr_conv_16_conv;
7583 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7584 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7585 _res_constr.data[q] = arr_conv_16_conv;
7587 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7588 CVec_ChannelMonitorZ_free(_res_constr);
7591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
7592 LDKThirtyTwoBytes a_ref;
7593 CHECK((*env)->GetArrayLength(env, a) == 32);
7594 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
7595 LDKChannelManager b_conv;
7596 b_conv.inner = (void*)(b & (~1));
7597 b_conv.is_owned = (b & 1) || (b == 0);
7598 // Warning: we need a move here but no clone is available for LDKChannelManager
7599 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
7600 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
7601 return (long)ret_ref;
7604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7605 if ((_res & 1) != 0) return;
7606 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
7608 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
7611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7612 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
7614 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7615 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
7616 return (long)ret_conv;
7619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7620 LDKDecodeError e_conv;
7621 e_conv.inner = (void*)(e & (~1));
7622 e_conv.is_owned = (e & 1) || (e == 0);
7623 e_conv = DecodeError_clone(&e_conv);
7624 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7625 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
7626 return (long)ret_conv;
7629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7630 if ((_res & 1) != 0) return;
7631 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7633 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
7636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7637 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
7638 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
7639 *ret_ref = C2Tuple_u64u64Z_clone(orig_conv);
7640 return (long)ret_ref;
7643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
7644 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
7645 *ret_ref = C2Tuple_u64u64Z_new(a, b);
7646 return (long)ret_ref;
7649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
7650 if ((_res & 1) != 0) return;
7651 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1);
7653 C2Tuple_u64u64Z_free(_res_conv);
7656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7657 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7659 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7660 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7661 return (long)ret_conv;
7664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7665 LDKDecodeError e_conv;
7666 e_conv.inner = (void*)(e & (~1));
7667 e_conv.is_owned = (e & 1) || (e == 0);
7668 e_conv = DecodeError_clone(&e_conv);
7669 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7670 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7671 return (long)ret_conv;
7674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7675 if ((_res & 1) != 0) return;
7676 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7678 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7682 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7683 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7684 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7685 return (long)ret_conv;
7688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7689 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7690 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7691 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7692 return (long)ret_ref;
7695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
7697 CHECK((*env)->GetArrayLength(env, a) == 64);
7698 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
7699 LDKCVec_SignatureZ b_constr;
7700 b_constr.datalen = (*env)->GetArrayLength(env, b);
7701 if (b_constr.datalen > 0)
7702 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7704 b_constr.data = NULL;
7705 for (size_t i = 0; i < b_constr.datalen; i++) {
7706 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
7707 LDKSignature arr_conv_8_ref;
7708 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
7709 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
7710 b_constr.data[i] = arr_conv_8_ref;
7712 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7713 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7714 return (long)ret_ref;
7717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7718 if ((_res & 1) != 0) return;
7719 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7721 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7725 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7727 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7728 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7729 return (long)ret_conv;
7732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
7733 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7734 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7735 return (long)ret_conv;
7738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7739 if ((_res & 1) != 0) return;
7740 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7742 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7746 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7747 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7748 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7749 return (long)ret_conv;
7752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
7754 CHECK((*env)->GetArrayLength(env, o) == 64);
7755 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
7756 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7757 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7758 return (long)ret_conv;
7761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
7762 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7763 *ret_conv = CResult_SignatureNoneZ_err();
7764 return (long)ret_conv;
7767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7768 if ((_res & 1) != 0) return;
7769 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7771 CResult_SignatureNoneZ_free(_res_conv);
7774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7775 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7776 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7777 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7778 return (long)ret_conv;
7781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7782 LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1);
7783 if (o_conv.free == LDKChannelKeys_JCalls_free) {
7784 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7785 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
7787 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
7788 *ret_conv = CResult_ChannelKeysDecodeErrorZ_ok(o_conv);
7789 return (long)ret_conv;
7792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7793 LDKDecodeError e_conv;
7794 e_conv.inner = (void*)(e & (~1));
7795 e_conv.is_owned = (e & 1) || (e == 0);
7796 e_conv = DecodeError_clone(&e_conv);
7797 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
7798 *ret_conv = CResult_ChannelKeysDecodeErrorZ_err(e_conv);
7799 return (long)ret_conv;
7802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7803 if ((_res & 1) != 0) return;
7804 LDKCResult_ChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7806 CResult_ChannelKeysDecodeErrorZ_free(_res_conv);
7809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7810 LDKCResult_ChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelKeysDecodeErrorZ*)(orig & ~1);
7811 LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ");
7812 *ret_conv = CResult_ChannelKeysDecodeErrorZ_clone(orig_conv);
7813 return (long)ret_conv;
7816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7817 LDKInMemoryChannelKeys o_conv;
7818 o_conv.inner = (void*)(o & (~1));
7819 o_conv.is_owned = (o & 1) || (o == 0);
7820 o_conv = InMemoryChannelKeys_clone(&o_conv);
7821 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
7822 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
7823 return (long)ret_conv;
7826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7827 LDKDecodeError e_conv;
7828 e_conv.inner = (void*)(e & (~1));
7829 e_conv.is_owned = (e & 1) || (e == 0);
7830 e_conv = DecodeError_clone(&e_conv);
7831 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
7832 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
7833 return (long)ret_conv;
7836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7837 if ((_res & 1) != 0) return;
7838 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
7840 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
7843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7844 LDKCResult_InMemoryChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(orig & ~1);
7845 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
7846 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig_conv);
7847 return (long)ret_conv;
7850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7851 LDKCVec_RouteHopZ _res_constr;
7852 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7853 if (_res_constr.datalen > 0)
7854 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7856 _res_constr.data = NULL;
7857 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7858 for (size_t k = 0; k < _res_constr.datalen; k++) {
7859 int64_t arr_conv_10 = _res_vals[k];
7860 LDKRouteHop arr_conv_10_conv;
7861 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7862 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7863 _res_constr.data[k] = arr_conv_10_conv;
7865 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7866 CVec_RouteHopZ_free(_res_constr);
7869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7870 LDKCVec_CVec_RouteHopZZ _res_constr;
7871 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7872 if (_res_constr.datalen > 0)
7873 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7875 _res_constr.data = NULL;
7876 for (size_t m = 0; m < _res_constr.datalen; m++) {
7877 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
7878 LDKCVec_RouteHopZ arr_conv_12_constr;
7879 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
7880 if (arr_conv_12_constr.datalen > 0)
7881 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7883 arr_conv_12_constr.data = NULL;
7884 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
7885 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
7886 int64_t arr_conv_10 = arr_conv_12_vals[k];
7887 LDKRouteHop arr_conv_10_conv;
7888 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7889 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7890 arr_conv_12_constr.data[k] = arr_conv_10_conv;
7892 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
7893 _res_constr.data[m] = arr_conv_12_constr;
7895 CVec_CVec_RouteHopZZ_free(_res_constr);
7898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7900 o_conv.inner = (void*)(o & (~1));
7901 o_conv.is_owned = (o & 1) || (o == 0);
7902 o_conv = Route_clone(&o_conv);
7903 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7904 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7905 return (long)ret_conv;
7908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7909 LDKDecodeError e_conv;
7910 e_conv.inner = (void*)(e & (~1));
7911 e_conv.is_owned = (e & 1) || (e == 0);
7912 e_conv = DecodeError_clone(&e_conv);
7913 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7914 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7915 return (long)ret_conv;
7918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7919 if ((_res & 1) != 0) return;
7920 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7922 CResult_RouteDecodeErrorZ_free(_res_conv);
7925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7926 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7927 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7928 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7929 return (long)ret_conv;
7932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7933 LDKCVec_RouteHintZ _res_constr;
7934 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7935 if (_res_constr.datalen > 0)
7936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7938 _res_constr.data = NULL;
7939 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7940 for (size_t l = 0; l < _res_constr.datalen; l++) {
7941 int64_t arr_conv_11 = _res_vals[l];
7942 LDKRouteHint arr_conv_11_conv;
7943 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7944 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7945 _res_constr.data[l] = arr_conv_11_conv;
7947 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7948 CVec_RouteHintZ_free(_res_constr);
7951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7953 o_conv.inner = (void*)(o & (~1));
7954 o_conv.is_owned = (o & 1) || (o == 0);
7955 o_conv = Route_clone(&o_conv);
7956 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7957 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7958 return (long)ret_conv;
7961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7962 LDKLightningError e_conv;
7963 e_conv.inner = (void*)(e & (~1));
7964 e_conv.is_owned = (e & 1) || (e == 0);
7965 e_conv = LightningError_clone(&e_conv);
7966 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7967 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7968 return (long)ret_conv;
7971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7972 if ((_res & 1) != 0) return;
7973 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7975 CResult_RouteLightningErrorZ_free(_res_conv);
7978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7979 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7980 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7981 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7982 return (long)ret_conv;
7985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
7986 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7988 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7989 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7990 return (long)ret_conv;
7993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
7994 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7995 *ret_conv = CResult_NetAddressu8Z_err(e);
7996 return (long)ret_conv;
7999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8000 if ((_res & 1) != 0) return;
8001 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
8003 CResult_NetAddressu8Z_free(_res_conv);
8006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8007 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
8008 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
8009 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
8010 return (long)ret_conv;
8013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8014 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
8016 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8017 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
8018 return (long)ret_conv;
8021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8022 LDKDecodeError e_conv;
8023 e_conv.inner = (void*)(e & (~1));
8024 e_conv.is_owned = (e & 1) || (e == 0);
8025 e_conv = DecodeError_clone(&e_conv);
8026 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8027 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
8028 return (long)ret_conv;
8031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8032 if ((_res & 1) != 0) return;
8033 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
8035 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
8038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8039 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
8040 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
8041 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
8042 return (long)ret_conv;
8045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8046 LDKCVec_UpdateAddHTLCZ _res_constr;
8047 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8048 if (_res_constr.datalen > 0)
8049 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
8051 _res_constr.data = NULL;
8052 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8053 for (size_t p = 0; p < _res_constr.datalen; p++) {
8054 int64_t arr_conv_15 = _res_vals[p];
8055 LDKUpdateAddHTLC arr_conv_15_conv;
8056 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
8057 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
8058 _res_constr.data[p] = arr_conv_15_conv;
8060 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8061 CVec_UpdateAddHTLCZ_free(_res_constr);
8064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8065 LDKCVec_UpdateFulfillHTLCZ _res_constr;
8066 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8067 if (_res_constr.datalen > 0)
8068 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
8070 _res_constr.data = NULL;
8071 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8072 for (size_t t = 0; t < _res_constr.datalen; t++) {
8073 int64_t arr_conv_19 = _res_vals[t];
8074 LDKUpdateFulfillHTLC arr_conv_19_conv;
8075 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
8076 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
8077 _res_constr.data[t] = arr_conv_19_conv;
8079 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8080 CVec_UpdateFulfillHTLCZ_free(_res_constr);
8083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8084 LDKCVec_UpdateFailHTLCZ _res_constr;
8085 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8086 if (_res_constr.datalen > 0)
8087 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
8089 _res_constr.data = NULL;
8090 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8091 for (size_t q = 0; q < _res_constr.datalen; q++) {
8092 int64_t arr_conv_16 = _res_vals[q];
8093 LDKUpdateFailHTLC arr_conv_16_conv;
8094 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
8095 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
8096 _res_constr.data[q] = arr_conv_16_conv;
8098 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8099 CVec_UpdateFailHTLCZ_free(_res_constr);
8102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
8103 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
8104 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8105 if (_res_constr.datalen > 0)
8106 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
8108 _res_constr.data = NULL;
8109 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
8110 for (size_t z = 0; z < _res_constr.datalen; z++) {
8111 int64_t arr_conv_25 = _res_vals[z];
8112 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
8113 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
8114 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
8115 _res_constr.data[z] = arr_conv_25_conv;
8117 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
8118 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
8121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8122 LDKAcceptChannel o_conv;
8123 o_conv.inner = (void*)(o & (~1));
8124 o_conv.is_owned = (o & 1) || (o == 0);
8125 o_conv = AcceptChannel_clone(&o_conv);
8126 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8127 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
8128 return (long)ret_conv;
8131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8132 LDKDecodeError e_conv;
8133 e_conv.inner = (void*)(e & (~1));
8134 e_conv.is_owned = (e & 1) || (e == 0);
8135 e_conv = DecodeError_clone(&e_conv);
8136 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8137 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
8138 return (long)ret_conv;
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8142 if ((_res & 1) != 0) return;
8143 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8145 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
8148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8149 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
8150 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
8151 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
8152 return (long)ret_conv;
8155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8156 LDKAnnouncementSignatures o_conv;
8157 o_conv.inner = (void*)(o & (~1));
8158 o_conv.is_owned = (o & 1) || (o == 0);
8159 o_conv = AnnouncementSignatures_clone(&o_conv);
8160 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8161 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
8162 return (long)ret_conv;
8165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8166 LDKDecodeError e_conv;
8167 e_conv.inner = (void*)(e & (~1));
8168 e_conv.is_owned = (e & 1) || (e == 0);
8169 e_conv = DecodeError_clone(&e_conv);
8170 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8171 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
8172 return (long)ret_conv;
8175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8176 if ((_res & 1) != 0) return;
8177 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
8179 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
8182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8183 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
8184 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
8185 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
8186 return (long)ret_conv;
8189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8190 LDKChannelReestablish o_conv;
8191 o_conv.inner = (void*)(o & (~1));
8192 o_conv.is_owned = (o & 1) || (o == 0);
8193 o_conv = ChannelReestablish_clone(&o_conv);
8194 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8195 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
8196 return (long)ret_conv;
8199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8200 LDKDecodeError e_conv;
8201 e_conv.inner = (void*)(e & (~1));
8202 e_conv.is_owned = (e & 1) || (e == 0);
8203 e_conv = DecodeError_clone(&e_conv);
8204 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8205 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
8206 return (long)ret_conv;
8209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8210 if ((_res & 1) != 0) return;
8211 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
8213 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
8216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8217 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
8218 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
8219 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
8220 return (long)ret_conv;
8223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8224 LDKClosingSigned o_conv;
8225 o_conv.inner = (void*)(o & (~1));
8226 o_conv.is_owned = (o & 1) || (o == 0);
8227 o_conv = ClosingSigned_clone(&o_conv);
8228 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8229 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
8230 return (long)ret_conv;
8233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8234 LDKDecodeError e_conv;
8235 e_conv.inner = (void*)(e & (~1));
8236 e_conv.is_owned = (e & 1) || (e == 0);
8237 e_conv = DecodeError_clone(&e_conv);
8238 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8239 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
8240 return (long)ret_conv;
8243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8244 if ((_res & 1) != 0) return;
8245 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8247 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
8250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8251 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
8252 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
8253 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
8254 return (long)ret_conv;
8257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8258 LDKCommitmentSigned o_conv;
8259 o_conv.inner = (void*)(o & (~1));
8260 o_conv.is_owned = (o & 1) || (o == 0);
8261 o_conv = CommitmentSigned_clone(&o_conv);
8262 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8263 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
8264 return (long)ret_conv;
8267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8268 LDKDecodeError e_conv;
8269 e_conv.inner = (void*)(e & (~1));
8270 e_conv.is_owned = (e & 1) || (e == 0);
8271 e_conv = DecodeError_clone(&e_conv);
8272 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8273 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
8274 return (long)ret_conv;
8277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8278 if ((_res & 1) != 0) return;
8279 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8281 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
8284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8285 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
8286 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8287 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
8288 return (long)ret_conv;
8291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8292 LDKFundingCreated o_conv;
8293 o_conv.inner = (void*)(o & (~1));
8294 o_conv.is_owned = (o & 1) || (o == 0);
8295 o_conv = FundingCreated_clone(&o_conv);
8296 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8297 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
8298 return (long)ret_conv;
8301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8302 LDKDecodeError e_conv;
8303 e_conv.inner = (void*)(e & (~1));
8304 e_conv.is_owned = (e & 1) || (e == 0);
8305 e_conv = DecodeError_clone(&e_conv);
8306 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8307 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
8308 return (long)ret_conv;
8311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8312 if ((_res & 1) != 0) return;
8313 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8315 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
8318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8319 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
8320 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8321 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
8322 return (long)ret_conv;
8325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8326 LDKFundingSigned o_conv;
8327 o_conv.inner = (void*)(o & (~1));
8328 o_conv.is_owned = (o & 1) || (o == 0);
8329 o_conv = FundingSigned_clone(&o_conv);
8330 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8331 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
8332 return (long)ret_conv;
8335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8336 LDKDecodeError e_conv;
8337 e_conv.inner = (void*)(e & (~1));
8338 e_conv.is_owned = (e & 1) || (e == 0);
8339 e_conv = DecodeError_clone(&e_conv);
8340 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8341 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
8342 return (long)ret_conv;
8345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8346 if ((_res & 1) != 0) return;
8347 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8349 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
8352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8353 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
8354 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8355 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
8356 return (long)ret_conv;
8359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8360 LDKFundingLocked o_conv;
8361 o_conv.inner = (void*)(o & (~1));
8362 o_conv.is_owned = (o & 1) || (o == 0);
8363 o_conv = FundingLocked_clone(&o_conv);
8364 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8365 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
8366 return (long)ret_conv;
8369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8370 LDKDecodeError e_conv;
8371 e_conv.inner = (void*)(e & (~1));
8372 e_conv.is_owned = (e & 1) || (e == 0);
8373 e_conv = DecodeError_clone(&e_conv);
8374 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8375 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
8376 return (long)ret_conv;
8379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8380 if ((_res & 1) != 0) return;
8381 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8383 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
8386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8387 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
8388 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8389 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
8390 return (long)ret_conv;
8393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8395 o_conv.inner = (void*)(o & (~1));
8396 o_conv.is_owned = (o & 1) || (o == 0);
8397 o_conv = Init_clone(&o_conv);
8398 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8399 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
8400 return (long)ret_conv;
8403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8404 LDKDecodeError e_conv;
8405 e_conv.inner = (void*)(e & (~1));
8406 e_conv.is_owned = (e & 1) || (e == 0);
8407 e_conv = DecodeError_clone(&e_conv);
8408 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8409 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
8410 return (long)ret_conv;
8413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8414 if ((_res & 1) != 0) return;
8415 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
8417 CResult_InitDecodeErrorZ_free(_res_conv);
8420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8421 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
8422 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8423 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
8424 return (long)ret_conv;
8427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8428 LDKOpenChannel o_conv;
8429 o_conv.inner = (void*)(o & (~1));
8430 o_conv.is_owned = (o & 1) || (o == 0);
8431 o_conv = OpenChannel_clone(&o_conv);
8432 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8433 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
8434 return (long)ret_conv;
8437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8438 LDKDecodeError e_conv;
8439 e_conv.inner = (void*)(e & (~1));
8440 e_conv.is_owned = (e & 1) || (e == 0);
8441 e_conv = DecodeError_clone(&e_conv);
8442 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8443 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
8444 return (long)ret_conv;
8447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8448 if ((_res & 1) != 0) return;
8449 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8451 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8455 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
8456 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8457 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
8458 return (long)ret_conv;
8461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8462 LDKRevokeAndACK o_conv;
8463 o_conv.inner = (void*)(o & (~1));
8464 o_conv.is_owned = (o & 1) || (o == 0);
8465 o_conv = RevokeAndACK_clone(&o_conv);
8466 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8467 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
8468 return (long)ret_conv;
8471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8472 LDKDecodeError e_conv;
8473 e_conv.inner = (void*)(e & (~1));
8474 e_conv.is_owned = (e & 1) || (e == 0);
8475 e_conv = DecodeError_clone(&e_conv);
8476 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8477 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
8478 return (long)ret_conv;
8481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8482 if ((_res & 1) != 0) return;
8483 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
8485 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
8488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8489 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
8490 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8491 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
8492 return (long)ret_conv;
8495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8497 o_conv.inner = (void*)(o & (~1));
8498 o_conv.is_owned = (o & 1) || (o == 0);
8499 o_conv = Shutdown_clone(&o_conv);
8500 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8501 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
8502 return (long)ret_conv;
8505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8506 LDKDecodeError e_conv;
8507 e_conv.inner = (void*)(e & (~1));
8508 e_conv.is_owned = (e & 1) || (e == 0);
8509 e_conv = DecodeError_clone(&e_conv);
8510 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8511 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
8512 return (long)ret_conv;
8515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8516 if ((_res & 1) != 0) return;
8517 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
8519 CResult_ShutdownDecodeErrorZ_free(_res_conv);
8522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8523 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
8524 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8525 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
8526 return (long)ret_conv;
8529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8530 LDKUpdateFailHTLC o_conv;
8531 o_conv.inner = (void*)(o & (~1));
8532 o_conv.is_owned = (o & 1) || (o == 0);
8533 o_conv = UpdateFailHTLC_clone(&o_conv);
8534 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8535 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
8536 return (long)ret_conv;
8539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8540 LDKDecodeError e_conv;
8541 e_conv.inner = (void*)(e & (~1));
8542 e_conv.is_owned = (e & 1) || (e == 0);
8543 e_conv = DecodeError_clone(&e_conv);
8544 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8545 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
8546 return (long)ret_conv;
8549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8550 if ((_res & 1) != 0) return;
8551 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8553 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
8556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8557 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
8558 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8559 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
8560 return (long)ret_conv;
8563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8564 LDKUpdateFailMalformedHTLC o_conv;
8565 o_conv.inner = (void*)(o & (~1));
8566 o_conv.is_owned = (o & 1) || (o == 0);
8567 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
8568 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8569 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
8570 return (long)ret_conv;
8573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8574 LDKDecodeError e_conv;
8575 e_conv.inner = (void*)(e & (~1));
8576 e_conv.is_owned = (e & 1) || (e == 0);
8577 e_conv = DecodeError_clone(&e_conv);
8578 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8579 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8580 return (long)ret_conv;
8583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8584 if ((_res & 1) != 0) return;
8585 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8587 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8591 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8592 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8593 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8594 return (long)ret_conv;
8597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8598 LDKUpdateFee o_conv;
8599 o_conv.inner = (void*)(o & (~1));
8600 o_conv.is_owned = (o & 1) || (o == 0);
8601 o_conv = UpdateFee_clone(&o_conv);
8602 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8603 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8604 return (long)ret_conv;
8607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8608 LDKDecodeError e_conv;
8609 e_conv.inner = (void*)(e & (~1));
8610 e_conv.is_owned = (e & 1) || (e == 0);
8611 e_conv = DecodeError_clone(&e_conv);
8612 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8613 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8614 return (long)ret_conv;
8617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8618 if ((_res & 1) != 0) return;
8619 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8621 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8625 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8626 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8627 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8628 return (long)ret_conv;
8631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8632 LDKUpdateFulfillHTLC o_conv;
8633 o_conv.inner = (void*)(o & (~1));
8634 o_conv.is_owned = (o & 1) || (o == 0);
8635 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8636 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8637 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8638 return (long)ret_conv;
8641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8642 LDKDecodeError e_conv;
8643 e_conv.inner = (void*)(e & (~1));
8644 e_conv.is_owned = (e & 1) || (e == 0);
8645 e_conv = DecodeError_clone(&e_conv);
8646 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8647 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8648 return (long)ret_conv;
8651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8652 if ((_res & 1) != 0) return;
8653 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8655 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8659 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8660 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8661 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8662 return (long)ret_conv;
8665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8666 LDKUpdateAddHTLC o_conv;
8667 o_conv.inner = (void*)(o & (~1));
8668 o_conv.is_owned = (o & 1) || (o == 0);
8669 o_conv = UpdateAddHTLC_clone(&o_conv);
8670 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8671 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8672 return (long)ret_conv;
8675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8676 LDKDecodeError e_conv;
8677 e_conv.inner = (void*)(e & (~1));
8678 e_conv.is_owned = (e & 1) || (e == 0);
8679 e_conv = DecodeError_clone(&e_conv);
8680 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8681 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8682 return (long)ret_conv;
8685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8686 if ((_res & 1) != 0) return;
8687 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8689 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8693 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8694 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8695 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8696 return (long)ret_conv;
8699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8701 o_conv.inner = (void*)(o & (~1));
8702 o_conv.is_owned = (o & 1) || (o == 0);
8703 o_conv = Ping_clone(&o_conv);
8704 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8705 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8706 return (long)ret_conv;
8709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8710 LDKDecodeError e_conv;
8711 e_conv.inner = (void*)(e & (~1));
8712 e_conv.is_owned = (e & 1) || (e == 0);
8713 e_conv = DecodeError_clone(&e_conv);
8714 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8715 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8716 return (long)ret_conv;
8719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8720 if ((_res & 1) != 0) return;
8721 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8723 CResult_PingDecodeErrorZ_free(_res_conv);
8726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8727 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8728 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8729 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8730 return (long)ret_conv;
8733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8735 o_conv.inner = (void*)(o & (~1));
8736 o_conv.is_owned = (o & 1) || (o == 0);
8737 o_conv = Pong_clone(&o_conv);
8738 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8739 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8740 return (long)ret_conv;
8743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8744 LDKDecodeError e_conv;
8745 e_conv.inner = (void*)(e & (~1));
8746 e_conv.is_owned = (e & 1) || (e == 0);
8747 e_conv = DecodeError_clone(&e_conv);
8748 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8749 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8750 return (long)ret_conv;
8753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8754 if ((_res & 1) != 0) return;
8755 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8757 CResult_PongDecodeErrorZ_free(_res_conv);
8760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8761 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8762 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8763 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8764 return (long)ret_conv;
8767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8768 LDKUnsignedChannelAnnouncement o_conv;
8769 o_conv.inner = (void*)(o & (~1));
8770 o_conv.is_owned = (o & 1) || (o == 0);
8771 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8772 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8773 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8774 return (long)ret_conv;
8777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8778 LDKDecodeError e_conv;
8779 e_conv.inner = (void*)(e & (~1));
8780 e_conv.is_owned = (e & 1) || (e == 0);
8781 e_conv = DecodeError_clone(&e_conv);
8782 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8783 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8784 return (long)ret_conv;
8787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8788 if ((_res & 1) != 0) return;
8789 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8791 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8795 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8796 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8797 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8798 return (long)ret_conv;
8801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8802 LDKChannelAnnouncement o_conv;
8803 o_conv.inner = (void*)(o & (~1));
8804 o_conv.is_owned = (o & 1) || (o == 0);
8805 o_conv = ChannelAnnouncement_clone(&o_conv);
8806 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8807 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8808 return (long)ret_conv;
8811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8812 LDKDecodeError e_conv;
8813 e_conv.inner = (void*)(e & (~1));
8814 e_conv.is_owned = (e & 1) || (e == 0);
8815 e_conv = DecodeError_clone(&e_conv);
8816 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8817 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8818 return (long)ret_conv;
8821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8822 if ((_res & 1) != 0) return;
8823 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8825 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8829 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8830 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8831 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8832 return (long)ret_conv;
8835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8836 LDKUnsignedChannelUpdate o_conv;
8837 o_conv.inner = (void*)(o & (~1));
8838 o_conv.is_owned = (o & 1) || (o == 0);
8839 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8840 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8841 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8842 return (long)ret_conv;
8845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8846 LDKDecodeError e_conv;
8847 e_conv.inner = (void*)(e & (~1));
8848 e_conv.is_owned = (e & 1) || (e == 0);
8849 e_conv = DecodeError_clone(&e_conv);
8850 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8851 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8852 return (long)ret_conv;
8855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8856 if ((_res & 1) != 0) return;
8857 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8859 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8863 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8864 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8865 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8866 return (long)ret_conv;
8869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8870 LDKChannelUpdate o_conv;
8871 o_conv.inner = (void*)(o & (~1));
8872 o_conv.is_owned = (o & 1) || (o == 0);
8873 o_conv = ChannelUpdate_clone(&o_conv);
8874 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8875 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8876 return (long)ret_conv;
8879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8880 LDKDecodeError e_conv;
8881 e_conv.inner = (void*)(e & (~1));
8882 e_conv.is_owned = (e & 1) || (e == 0);
8883 e_conv = DecodeError_clone(&e_conv);
8884 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8885 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8886 return (long)ret_conv;
8889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8890 if ((_res & 1) != 0) return;
8891 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8893 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8897 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8898 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8899 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8900 return (long)ret_conv;
8903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8904 LDKErrorMessage o_conv;
8905 o_conv.inner = (void*)(o & (~1));
8906 o_conv.is_owned = (o & 1) || (o == 0);
8907 o_conv = ErrorMessage_clone(&o_conv);
8908 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8909 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8910 return (long)ret_conv;
8913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8914 LDKDecodeError e_conv;
8915 e_conv.inner = (void*)(e & (~1));
8916 e_conv.is_owned = (e & 1) || (e == 0);
8917 e_conv = DecodeError_clone(&e_conv);
8918 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8919 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8920 return (long)ret_conv;
8923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8924 if ((_res & 1) != 0) return;
8925 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8927 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8931 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8932 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8933 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8934 return (long)ret_conv;
8937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8938 LDKUnsignedNodeAnnouncement o_conv;
8939 o_conv.inner = (void*)(o & (~1));
8940 o_conv.is_owned = (o & 1) || (o == 0);
8941 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8942 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8943 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8944 return (long)ret_conv;
8947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8948 LDKDecodeError e_conv;
8949 e_conv.inner = (void*)(e & (~1));
8950 e_conv.is_owned = (e & 1) || (e == 0);
8951 e_conv = DecodeError_clone(&e_conv);
8952 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8953 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8954 return (long)ret_conv;
8957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8958 if ((_res & 1) != 0) return;
8959 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8961 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8965 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8966 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8967 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8968 return (long)ret_conv;
8971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8972 LDKNodeAnnouncement o_conv;
8973 o_conv.inner = (void*)(o & (~1));
8974 o_conv.is_owned = (o & 1) || (o == 0);
8975 o_conv = NodeAnnouncement_clone(&o_conv);
8976 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8977 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8978 return (long)ret_conv;
8981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8982 LDKDecodeError e_conv;
8983 e_conv.inner = (void*)(e & (~1));
8984 e_conv.is_owned = (e & 1) || (e == 0);
8985 e_conv = DecodeError_clone(&e_conv);
8986 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8987 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8988 return (long)ret_conv;
8991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8992 if ((_res & 1) != 0) return;
8993 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8995 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8999 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
9000 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
9001 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
9002 return (long)ret_conv;
9005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9006 LDKQueryShortChannelIds o_conv;
9007 o_conv.inner = (void*)(o & (~1));
9008 o_conv.is_owned = (o & 1) || (o == 0);
9009 o_conv = QueryShortChannelIds_clone(&o_conv);
9010 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9011 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
9012 return (long)ret_conv;
9015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9016 LDKDecodeError e_conv;
9017 e_conv.inner = (void*)(e & (~1));
9018 e_conv.is_owned = (e & 1) || (e == 0);
9019 e_conv = DecodeError_clone(&e_conv);
9020 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9021 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
9022 return (long)ret_conv;
9025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9026 if ((_res & 1) != 0) return;
9027 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
9029 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
9032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9033 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
9034 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
9035 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
9036 return (long)ret_conv;
9039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9040 LDKReplyShortChannelIdsEnd o_conv;
9041 o_conv.inner = (void*)(o & (~1));
9042 o_conv.is_owned = (o & 1) || (o == 0);
9043 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
9044 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9045 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
9046 return (long)ret_conv;
9049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9050 LDKDecodeError e_conv;
9051 e_conv.inner = (void*)(e & (~1));
9052 e_conv.is_owned = (e & 1) || (e == 0);
9053 e_conv = DecodeError_clone(&e_conv);
9054 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9055 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
9056 return (long)ret_conv;
9059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9060 if ((_res & 1) != 0) return;
9061 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
9063 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
9066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9067 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
9068 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
9069 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
9070 return (long)ret_conv;
9073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9074 LDKQueryChannelRange o_conv;
9075 o_conv.inner = (void*)(o & (~1));
9076 o_conv.is_owned = (o & 1) || (o == 0);
9077 o_conv = QueryChannelRange_clone(&o_conv);
9078 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9079 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
9080 return (long)ret_conv;
9083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9084 LDKDecodeError e_conv;
9085 e_conv.inner = (void*)(e & (~1));
9086 e_conv.is_owned = (e & 1) || (e == 0);
9087 e_conv = DecodeError_clone(&e_conv);
9088 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9089 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
9090 return (long)ret_conv;
9093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9094 if ((_res & 1) != 0) return;
9095 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9097 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
9100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9101 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
9102 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
9103 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
9104 return (long)ret_conv;
9107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9108 LDKReplyChannelRange o_conv;
9109 o_conv.inner = (void*)(o & (~1));
9110 o_conv.is_owned = (o & 1) || (o == 0);
9111 o_conv = ReplyChannelRange_clone(&o_conv);
9112 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9113 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
9114 return (long)ret_conv;
9117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9118 LDKDecodeError e_conv;
9119 e_conv.inner = (void*)(e & (~1));
9120 e_conv.is_owned = (e & 1) || (e == 0);
9121 e_conv = DecodeError_clone(&e_conv);
9122 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9123 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
9124 return (long)ret_conv;
9127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9128 if ((_res & 1) != 0) return;
9129 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
9131 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
9134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9135 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
9136 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
9137 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
9138 return (long)ret_conv;
9141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9142 LDKGossipTimestampFilter o_conv;
9143 o_conv.inner = (void*)(o & (~1));
9144 o_conv.is_owned = (o & 1) || (o == 0);
9145 o_conv = GossipTimestampFilter_clone(&o_conv);
9146 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9147 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
9148 return (long)ret_conv;
9151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9152 LDKDecodeError e_conv;
9153 e_conv.inner = (void*)(e & (~1));
9154 e_conv.is_owned = (e & 1) || (e == 0);
9155 e_conv = DecodeError_clone(&e_conv);
9156 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9157 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
9158 return (long)ret_conv;
9161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9162 if ((_res & 1) != 0) return;
9163 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
9165 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
9168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9169 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
9170 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
9171 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
9172 return (long)ret_conv;
9175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9176 if ((this_ptr & 1) != 0) return;
9177 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
9178 FREE((void*)this_ptr);
9179 Event_free(this_ptr_conv);
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9183 LDKEvent* orig_conv = (LDKEvent*)orig;
9184 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9185 *ret_copy = Event_clone(orig_conv);
9186 long ret_ref = (long)ret_copy;
9190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
9191 LDKEvent* obj_conv = (LDKEvent*)obj;
9192 LDKCVec_u8Z arg_var = Event_write(obj_conv);
9193 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9194 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9195 CVec_u8Z_free(arg_var);
9199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9200 if ((this_ptr & 1) != 0) return;
9201 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
9202 FREE((void*)this_ptr);
9203 MessageSendEvent_free(this_ptr_conv);
9206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9207 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
9208 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9209 *ret_copy = MessageSendEvent_clone(orig_conv);
9210 long ret_ref = (long)ret_copy;
9214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9215 if ((this_ptr & 1) != 0) return;
9216 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
9217 FREE((void*)this_ptr);
9218 MessageSendEventsProvider_free(this_ptr_conv);
9221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9222 if ((this_ptr & 1) != 0) return;
9223 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
9224 FREE((void*)this_ptr);
9225 EventsProvider_free(this_ptr_conv);
9228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9229 if ((this_ptr & 1) != 0) return;
9230 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
9231 FREE((void*)this_ptr);
9232 APIError_free(this_ptr_conv);
9235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9236 LDKAPIError* orig_conv = (LDKAPIError*)orig;
9237 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
9238 *ret_copy = APIError_clone(orig_conv);
9239 long ret_ref = (long)ret_copy;
9243 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9244 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
9245 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
9249 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
9250 jclass ret_conv = LDKLevel_to_java(env, Level_max());
9254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9255 if ((this_ptr & 1) != 0) return;
9256 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
9257 FREE((void*)this_ptr);
9258 Logger_free(this_ptr_conv);
9261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9262 LDKChannelHandshakeConfig this_ptr_conv;
9263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9265 ChannelHandshakeConfig_free(this_ptr_conv);
9268 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9269 LDKChannelHandshakeConfig this_ptr_conv;
9270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9271 this_ptr_conv.is_owned = false;
9272 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9277 LDKChannelHandshakeConfig this_ptr_conv;
9278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9279 this_ptr_conv.is_owned = false;
9280 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9283 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9284 LDKChannelHandshakeConfig this_ptr_conv;
9285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9286 this_ptr_conv.is_owned = false;
9287 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9291 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) {
9292 LDKChannelHandshakeConfig this_ptr_conv;
9293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9294 this_ptr_conv.is_owned = false;
9295 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9299 LDKChannelHandshakeConfig this_ptr_conv;
9300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9301 this_ptr_conv.is_owned = false;
9302 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9306 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) {
9307 LDKChannelHandshakeConfig this_ptr_conv;
9308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9309 this_ptr_conv.is_owned = false;
9310 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9313 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) {
9314 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9317 long ret_ref = (long)ret_var.inner;
9318 if (ret_var.is_owned) {
9324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9325 LDKChannelHandshakeConfig orig_conv;
9326 orig_conv.inner = (void*)(orig & (~1));
9327 orig_conv.is_owned = false;
9328 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9331 long ret_ref = (long)ret_var.inner;
9332 if (ret_var.is_owned) {
9338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
9339 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9340 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9341 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9342 long ret_ref = (long)ret_var.inner;
9343 if (ret_var.is_owned) {
9349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9350 LDKChannelHandshakeLimits this_ptr_conv;
9351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9353 ChannelHandshakeLimits_free(this_ptr_conv);
9356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9357 LDKChannelHandshakeLimits this_ptr_conv;
9358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9359 this_ptr_conv.is_owned = false;
9360 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9365 LDKChannelHandshakeLimits this_ptr_conv;
9366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9367 this_ptr_conv.is_owned = false;
9368 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9372 LDKChannelHandshakeLimits this_ptr_conv;
9373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9374 this_ptr_conv.is_owned = false;
9375 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
9379 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) {
9380 LDKChannelHandshakeLimits this_ptr_conv;
9381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9382 this_ptr_conv.is_owned = false;
9383 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
9386 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) {
9387 LDKChannelHandshakeLimits this_ptr_conv;
9388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9389 this_ptr_conv.is_owned = false;
9390 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
9394 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) {
9395 LDKChannelHandshakeLimits this_ptr_conv;
9396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9397 this_ptr_conv.is_owned = false;
9398 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9402 LDKChannelHandshakeLimits this_ptr_conv;
9403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9404 this_ptr_conv.is_owned = false;
9405 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
9409 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) {
9410 LDKChannelHandshakeLimits this_ptr_conv;
9411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9412 this_ptr_conv.is_owned = false;
9413 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
9416 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9417 LDKChannelHandshakeLimits this_ptr_conv;
9418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9419 this_ptr_conv.is_owned = false;
9420 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9424 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) {
9425 LDKChannelHandshakeLimits this_ptr_conv;
9426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9427 this_ptr_conv.is_owned = false;
9428 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9432 LDKChannelHandshakeLimits this_ptr_conv;
9433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9434 this_ptr_conv.is_owned = false;
9435 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9440 LDKChannelHandshakeLimits this_ptr_conv;
9441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9442 this_ptr_conv.is_owned = false;
9443 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9447 LDKChannelHandshakeLimits this_ptr_conv;
9448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9449 this_ptr_conv.is_owned = false;
9450 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9455 LDKChannelHandshakeLimits this_ptr_conv;
9456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9457 this_ptr_conv.is_owned = false;
9458 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9461 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
9462 LDKChannelHandshakeLimits this_ptr_conv;
9463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9464 this_ptr_conv.is_owned = false;
9465 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9470 LDKChannelHandshakeLimits this_ptr_conv;
9471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9472 this_ptr_conv.is_owned = false;
9473 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
9477 LDKChannelHandshakeLimits this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = false;
9480 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9485 LDKChannelHandshakeLimits this_ptr_conv;
9486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9487 this_ptr_conv.is_owned = false;
9488 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9491 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9492 LDKChannelHandshakeLimits this_ptr_conv;
9493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9494 this_ptr_conv.is_owned = false;
9495 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9499 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) {
9500 LDKChannelHandshakeLimits this_ptr_conv;
9501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9502 this_ptr_conv.is_owned = false;
9503 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
9507 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
9508 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9509 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9510 long ret_ref = (long)ret_var.inner;
9511 if (ret_var.is_owned) {
9517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9518 LDKChannelHandshakeLimits orig_conv;
9519 orig_conv.inner = (void*)(orig & (~1));
9520 orig_conv.is_owned = false;
9521 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9524 long ret_ref = (long)ret_var.inner;
9525 if (ret_var.is_owned) {
9531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
9532 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9533 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9534 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9535 long ret_ref = (long)ret_var.inner;
9536 if (ret_var.is_owned) {
9542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9543 LDKChannelConfig this_ptr_conv;
9544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9546 ChannelConfig_free(this_ptr_conv);
9549 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
9550 LDKChannelConfig this_ptr_conv;
9551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9552 this_ptr_conv.is_owned = false;
9553 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9558 LDKChannelConfig this_ptr_conv;
9559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9560 this_ptr_conv.is_owned = false;
9561 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
9565 LDKChannelConfig this_ptr_conv;
9566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9567 this_ptr_conv.is_owned = false;
9568 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9573 LDKChannelConfig this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = false;
9576 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
9580 LDKChannelConfig this_ptr_conv;
9581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9582 this_ptr_conv.is_owned = false;
9583 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9588 LDKChannelConfig this_ptr_conv;
9589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9590 this_ptr_conv.is_owned = false;
9591 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
9595 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9596 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9597 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9598 long ret_ref = (long)ret_var.inner;
9599 if (ret_var.is_owned) {
9605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9606 LDKChannelConfig orig_conv;
9607 orig_conv.inner = (void*)(orig & (~1));
9608 orig_conv.is_owned = false;
9609 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9612 long ret_ref = (long)ret_var.inner;
9613 if (ret_var.is_owned) {
9619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
9620 LDKChannelConfig ret_var = ChannelConfig_default();
9621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9623 long ret_ref = (long)ret_var.inner;
9624 if (ret_var.is_owned) {
9630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
9631 LDKChannelConfig obj_conv;
9632 obj_conv.inner = (void*)(obj & (~1));
9633 obj_conv.is_owned = false;
9634 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
9635 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9636 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9637 CVec_u8Z_free(arg_var);
9641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
9643 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9644 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9645 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9646 *ret_conv = ChannelConfig_read(ser_ref);
9647 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9648 return (long)ret_conv;
9651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9652 LDKUserConfig this_ptr_conv;
9653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9655 UserConfig_free(this_ptr_conv);
9658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
9659 LDKUserConfig this_ptr_conv;
9660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9661 this_ptr_conv.is_owned = false;
9662 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
9663 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9664 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9665 long ret_ref = (long)ret_var.inner;
9666 if (ret_var.is_owned) {
9672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9673 LDKUserConfig this_ptr_conv;
9674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9675 this_ptr_conv.is_owned = false;
9676 LDKChannelHandshakeConfig val_conv;
9677 val_conv.inner = (void*)(val & (~1));
9678 val_conv.is_owned = (val & 1) || (val == 0);
9679 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9680 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
9684 LDKUserConfig this_ptr_conv;
9685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9686 this_ptr_conv.is_owned = false;
9687 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9690 long ret_ref = (long)ret_var.inner;
9691 if (ret_var.is_owned) {
9697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9698 LDKUserConfig this_ptr_conv;
9699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9700 this_ptr_conv.is_owned = false;
9701 LDKChannelHandshakeLimits val_conv;
9702 val_conv.inner = (void*)(val & (~1));
9703 val_conv.is_owned = (val & 1) || (val == 0);
9704 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9705 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
9709 LDKUserConfig this_ptr_conv;
9710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9711 this_ptr_conv.is_owned = false;
9712 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9715 long ret_ref = (long)ret_var.inner;
9716 if (ret_var.is_owned) {
9722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9723 LDKUserConfig this_ptr_conv;
9724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9725 this_ptr_conv.is_owned = false;
9726 LDKChannelConfig val_conv;
9727 val_conv.inner = (void*)(val & (~1));
9728 val_conv.is_owned = (val & 1) || (val == 0);
9729 val_conv = ChannelConfig_clone(&val_conv);
9730 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg) {
9734 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9735 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9736 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9737 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9738 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9739 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9740 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9741 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9742 LDKChannelConfig channel_options_arg_conv;
9743 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9744 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9745 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9746 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 long ret_ref = (long)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9757 LDKUserConfig orig_conv;
9758 orig_conv.inner = (void*)(orig & (~1));
9759 orig_conv.is_owned = false;
9760 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9761 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9762 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9763 long ret_ref = (long)ret_var.inner;
9764 if (ret_var.is_owned) {
9770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
9771 LDKUserConfig ret_var = UserConfig_default();
9772 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9773 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9774 long ret_ref = (long)ret_var.inner;
9775 if (ret_var.is_owned) {
9781 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9782 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9783 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9788 if ((this_ptr & 1) != 0) return;
9789 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9790 FREE((void*)this_ptr);
9791 Access_free(this_ptr_conv);
9794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9795 if ((this_ptr & 1) != 0) return;
9796 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9797 FREE((void*)this_ptr);
9798 Watch_free(this_ptr_conv);
9801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9802 if ((this_ptr & 1) != 0) return;
9803 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9804 FREE((void*)this_ptr);
9805 Filter_free(this_ptr_conv);
9808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9809 if ((this_ptr & 1) != 0) return;
9810 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9811 FREE((void*)this_ptr);
9812 BroadcasterInterface_free(this_ptr_conv);
9815 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9816 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9817 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
9821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9822 if ((this_ptr & 1) != 0) return;
9823 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9824 FREE((void*)this_ptr);
9825 FeeEstimator_free(this_ptr_conv);
9828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9829 LDKChainMonitor this_ptr_conv;
9830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9832 ChainMonitor_free(this_ptr_conv);
9835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
9836 LDKChainMonitor this_arg_conv;
9837 this_arg_conv.inner = (void*)(this_arg & (~1));
9838 this_arg_conv.is_owned = false;
9839 unsigned char header_arr[80];
9840 CHECK((*env)->GetArrayLength(env, header) == 80);
9841 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9842 unsigned char (*header_ref)[80] = &header_arr;
9843 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9844 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9845 if (txdata_constr.datalen > 0)
9846 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9848 txdata_constr.data = NULL;
9849 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9850 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9851 int64_t arr_conv_24 = txdata_vals[y];
9852 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
9853 FREE((void*)arr_conv_24);
9854 txdata_constr.data[y] = arr_conv_24_conv;
9856 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9857 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t disconnected_height) {
9861 LDKChainMonitor this_arg_conv;
9862 this_arg_conv.inner = (void*)(this_arg & (~1));
9863 this_arg_conv.is_owned = false;
9864 unsigned char header_arr[80];
9865 CHECK((*env)->GetArrayLength(env, header) == 80);
9866 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9867 unsigned char (*header_ref)[80] = &header_arr;
9868 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9871 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) {
9872 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
9873 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9874 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9876 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
9878 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9879 if (logger_conv.free == LDKLogger_JCalls_free) {
9880 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9881 LDKLogger_JCalls_clone(logger_conv.this_arg);
9883 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
9884 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
9885 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9886 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
9888 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
9889 if (persister_conv.free == LDKPersist_JCalls_free) {
9890 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9891 LDKPersist_JCalls_clone(persister_conv.this_arg);
9893 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
9894 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9895 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9896 long ret_ref = (long)ret_var.inner;
9897 if (ret_var.is_owned) {
9903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
9904 LDKChainMonitor this_arg_conv;
9905 this_arg_conv.inner = (void*)(this_arg & (~1));
9906 this_arg_conv.is_owned = false;
9907 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
9908 *ret = ChainMonitor_as_Watch(&this_arg_conv);
9912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9913 LDKChainMonitor this_arg_conv;
9914 this_arg_conv.inner = (void*)(this_arg & (~1));
9915 this_arg_conv.is_owned = false;
9916 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9917 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
9921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9922 LDKChannelMonitorUpdate this_ptr_conv;
9923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9925 ChannelMonitorUpdate_free(this_ptr_conv);
9928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9929 LDKChannelMonitorUpdate this_ptr_conv;
9930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9931 this_ptr_conv.is_owned = false;
9932 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
9936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9937 LDKChannelMonitorUpdate this_ptr_conv;
9938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9939 this_ptr_conv.is_owned = false;
9940 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
9943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9944 LDKChannelMonitorUpdate orig_conv;
9945 orig_conv.inner = (void*)(orig & (~1));
9946 orig_conv.is_owned = false;
9947 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
9948 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9949 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9950 long ret_ref = (long)ret_var.inner;
9951 if (ret_var.is_owned) {
9957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
9958 LDKChannelMonitorUpdate obj_conv;
9959 obj_conv.inner = (void*)(obj & (~1));
9960 obj_conv.is_owned = false;
9961 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
9962 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9963 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9964 CVec_u8Z_free(arg_var);
9968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
9970 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9971 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9972 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9973 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
9974 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9975 return (long)ret_conv;
9978 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9979 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
9980 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
9984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9985 LDKMonitorUpdateError this_ptr_conv;
9986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9988 MonitorUpdateError_free(this_ptr_conv);
9991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9992 LDKMonitorUpdateError orig_conv;
9993 orig_conv.inner = (void*)(orig & (~1));
9994 orig_conv.is_owned = false;
9995 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
9996 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9997 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9998 long ret_ref = (long)ret_var.inner;
9999 if (ret_var.is_owned) {
10005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10006 LDKMonitorEvent this_ptr_conv;
10007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10009 MonitorEvent_free(this_ptr_conv);
10012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10013 LDKMonitorEvent orig_conv;
10014 orig_conv.inner = (void*)(orig & (~1));
10015 orig_conv.is_owned = false;
10016 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
10017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10019 long ret_ref = (long)ret_var.inner;
10020 if (ret_var.is_owned) {
10026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10027 LDKHTLCUpdate this_ptr_conv;
10028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10030 HTLCUpdate_free(this_ptr_conv);
10033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10034 LDKHTLCUpdate orig_conv;
10035 orig_conv.inner = (void*)(orig & (~1));
10036 orig_conv.is_owned = false;
10037 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
10038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10040 long ret_ref = (long)ret_var.inner;
10041 if (ret_var.is_owned) {
10047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
10048 LDKHTLCUpdate obj_conv;
10049 obj_conv.inner = (void*)(obj & (~1));
10050 obj_conv.is_owned = false;
10051 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
10052 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10053 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10054 CVec_u8Z_free(arg_var);
10058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10059 LDKu8slice ser_ref;
10060 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10061 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10062 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10063 *ret_conv = HTLCUpdate_read(ser_ref);
10064 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10065 return (long)ret_conv;
10068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10069 LDKChannelMonitor this_ptr_conv;
10070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10072 ChannelMonitor_free(this_ptr_conv);
10075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10076 LDKChannelMonitor orig_conv;
10077 orig_conv.inner = (void*)(orig & (~1));
10078 orig_conv.is_owned = false;
10079 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
10080 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10081 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10082 long ret_ref = (long)ret_var.inner;
10083 if (ret_var.is_owned) {
10089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
10090 LDKChannelMonitor obj_conv;
10091 obj_conv.inner = (void*)(obj & (~1));
10092 obj_conv.is_owned = false;
10093 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
10094 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10095 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10096 CVec_u8Z_free(arg_var);
10100 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) {
10101 LDKChannelMonitor this_arg_conv;
10102 this_arg_conv.inner = (void*)(this_arg & (~1));
10103 this_arg_conv.is_owned = false;
10104 LDKChannelMonitorUpdate updates_conv;
10105 updates_conv.inner = (void*)(updates & (~1));
10106 updates_conv.is_owned = false;
10107 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
10108 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
10109 LDKLogger* logger_conv = (LDKLogger*)logger;
10110 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10111 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
10112 return (long)ret_conv;
10115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10116 LDKChannelMonitor this_arg_conv;
10117 this_arg_conv.inner = (void*)(this_arg & (~1));
10118 this_arg_conv.is_owned = false;
10119 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
10123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
10124 LDKChannelMonitor this_arg_conv;
10125 this_arg_conv.inner = (void*)(this_arg & (~1));
10126 this_arg_conv.is_owned = false;
10127 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10128 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
10129 return (long)ret_ref;
10132 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10133 LDKChannelMonitor this_arg_conv;
10134 this_arg_conv.inner = (void*)(this_arg & (~1));
10135 this_arg_conv.is_owned = false;
10136 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
10137 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10138 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10139 for (size_t o = 0; o < ret_var.datalen; o++) {
10140 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
10141 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10142 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10143 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
10144 if (arr_conv_14_var.is_owned) {
10145 arr_conv_14_ref |= 1;
10147 ret_arr_ptr[o] = arr_conv_14_ref;
10149 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10150 FREE(ret_var.data);
10154 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10155 LDKChannelMonitor this_arg_conv;
10156 this_arg_conv.inner = (void*)(this_arg & (~1));
10157 this_arg_conv.is_owned = false;
10158 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10159 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10160 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10161 for (size_t h = 0; h < ret_var.datalen; h++) {
10162 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10163 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
10164 long arr_conv_7_ref = (long)arr_conv_7_copy;
10165 ret_arr_ptr[h] = arr_conv_7_ref;
10167 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10168 FREE(ret_var.data);
10172 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) {
10173 LDKChannelMonitor this_arg_conv;
10174 this_arg_conv.inner = (void*)(this_arg & (~1));
10175 this_arg_conv.is_owned = false;
10176 LDKLogger* logger_conv = (LDKLogger*)logger;
10177 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10178 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10180 for (size_t i = 0; i < ret_var.datalen; i++) {
10181 LDKTransaction arr_conv_8_var = ret_var.data[i];
10182 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen);
10183 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
10184 Transaction_free(arr_conv_8_var);
10185 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
10187 FREE(ret_var.data);
10191 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) {
10192 LDKChannelMonitor this_arg_conv;
10193 this_arg_conv.inner = (void*)(this_arg & (~1));
10194 this_arg_conv.is_owned = false;
10195 unsigned char header_arr[80];
10196 CHECK((*env)->GetArrayLength(env, header) == 80);
10197 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10198 unsigned char (*header_ref)[80] = &header_arr;
10199 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10200 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10201 if (txdata_constr.datalen > 0)
10202 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10204 txdata_constr.data = NULL;
10205 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10206 for (size_t y = 0; y < txdata_constr.datalen; y++) {
10207 int64_t arr_conv_24 = txdata_vals[y];
10208 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
10209 FREE((void*)arr_conv_24);
10210 txdata_constr.data[y] = arr_conv_24_conv;
10212 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10213 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10214 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10215 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10216 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10218 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10219 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10220 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10221 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10223 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10224 if (logger_conv.free == LDKLogger_JCalls_free) {
10225 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10226 LDKLogger_JCalls_clone(logger_conv.this_arg);
10228 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);
10229 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10230 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10231 for (size_t u = 0; u < ret_var.datalen; u++) {
10232 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10233 *arr_conv_46_ref = ret_var.data[u];
10234 ret_arr_ptr[u] = (long)arr_conv_46_ref;
10236 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10237 FREE(ret_var.data);
10241 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) {
10242 LDKChannelMonitor this_arg_conv;
10243 this_arg_conv.inner = (void*)(this_arg & (~1));
10244 this_arg_conv.is_owned = false;
10245 unsigned char header_arr[80];
10246 CHECK((*env)->GetArrayLength(env, header) == 80);
10247 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10248 unsigned char (*header_ref)[80] = &header_arr;
10249 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10250 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10251 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10252 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
10254 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10255 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
10256 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10257 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
10259 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10260 if (logger_conv.free == LDKLogger_JCalls_free) {
10261 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10262 LDKLogger_JCalls_clone(logger_conv.this_arg);
10264 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10268 if ((this_ptr & 1) != 0) return;
10269 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10270 FREE((void*)this_ptr);
10271 Persist_free(this_ptr_conv);
10274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
10275 LDKu8slice ser_ref;
10276 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10277 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10278 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
10279 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10280 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10281 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10282 return (long)ret_conv;
10285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10286 LDKOutPoint this_ptr_conv;
10287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10289 OutPoint_free(this_ptr_conv);
10292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10293 LDKOutPoint this_ptr_conv;
10294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10295 this_ptr_conv.is_owned = false;
10296 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10297 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10302 LDKOutPoint this_ptr_conv;
10303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10304 this_ptr_conv.is_owned = false;
10305 LDKThirtyTwoBytes val_ref;
10306 CHECK((*env)->GetArrayLength(env, val) == 32);
10307 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10308 OutPoint_set_txid(&this_ptr_conv, val_ref);
10311 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10312 LDKOutPoint this_ptr_conv;
10313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10314 this_ptr_conv.is_owned = false;
10315 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10320 LDKOutPoint this_ptr_conv;
10321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10322 this_ptr_conv.is_owned = false;
10323 OutPoint_set_index(&this_ptr_conv, val);
10326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
10327 LDKThirtyTwoBytes txid_arg_ref;
10328 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
10329 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
10330 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10331 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10332 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10333 long ret_ref = (long)ret_var.inner;
10334 if (ret_var.is_owned) {
10340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10341 LDKOutPoint orig_conv;
10342 orig_conv.inner = (void*)(orig & (~1));
10343 orig_conv.is_owned = false;
10344 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
10345 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10346 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10347 long ret_ref = (long)ret_var.inner;
10348 if (ret_var.is_owned) {
10354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10355 LDKOutPoint this_arg_conv;
10356 this_arg_conv.inner = (void*)(this_arg & (~1));
10357 this_arg_conv.is_owned = false;
10358 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
10359 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
10363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
10364 LDKOutPoint obj_conv;
10365 obj_conv.inner = (void*)(obj & (~1));
10366 obj_conv.is_owned = false;
10367 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
10368 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10369 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10370 CVec_u8Z_free(arg_var);
10374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10375 LDKu8slice ser_ref;
10376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10378 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10379 *ret_conv = OutPoint_read(ser_ref);
10380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10381 return (long)ret_conv;
10384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10385 if ((this_ptr & 1) != 0) return;
10386 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
10387 FREE((void*)this_ptr);
10388 SpendableOutputDescriptor_free(this_ptr_conv);
10391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10392 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10393 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10394 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10395 long ret_ref = (long)ret_copy;
10399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
10400 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10401 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
10402 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10403 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10404 CVec_u8Z_free(arg_var);
10408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10409 LDKu8slice ser_ref;
10410 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10411 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10412 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10413 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10414 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10415 return (long)ret_conv;
10418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10419 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
10420 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
10421 *ret = ChannelKeys_clone(orig_conv);
10425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10426 if ((this_ptr & 1) != 0) return;
10427 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1);
10428 FREE((void*)this_ptr);
10429 ChannelKeys_free(this_ptr_conv);
10432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10433 if ((this_ptr & 1) != 0) return;
10434 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10435 FREE((void*)this_ptr);
10436 KeysInterface_free(this_ptr_conv);
10439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10440 LDKInMemoryChannelKeys this_ptr_conv;
10441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10443 InMemoryChannelKeys_free(this_ptr_conv);
10446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
10447 LDKInMemoryChannelKeys this_ptr_conv;
10448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10449 this_ptr_conv.is_owned = false;
10450 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10451 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
10455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10456 LDKInMemoryChannelKeys this_ptr_conv;
10457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10458 this_ptr_conv.is_owned = false;
10459 LDKSecretKey val_ref;
10460 CHECK((*env)->GetArrayLength(env, val) == 32);
10461 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
10462 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
10465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
10466 LDKInMemoryChannelKeys this_ptr_conv;
10467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10468 this_ptr_conv.is_owned = false;
10469 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
10474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10475 LDKInMemoryChannelKeys this_ptr_conv;
10476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10477 this_ptr_conv.is_owned = false;
10478 LDKSecretKey val_ref;
10479 CHECK((*env)->GetArrayLength(env, val) == 32);
10480 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
10481 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
10484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
10485 LDKInMemoryChannelKeys this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = false;
10488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
10493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10494 LDKInMemoryChannelKeys this_ptr_conv;
10495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10496 this_ptr_conv.is_owned = false;
10497 LDKSecretKey val_ref;
10498 CHECK((*env)->GetArrayLength(env, val) == 32);
10499 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
10500 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
10503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
10504 LDKInMemoryChannelKeys this_ptr_conv;
10505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10506 this_ptr_conv.is_owned = false;
10507 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10508 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
10512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10513 LDKInMemoryChannelKeys this_ptr_conv;
10514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10515 this_ptr_conv.is_owned = false;
10516 LDKSecretKey val_ref;
10517 CHECK((*env)->GetArrayLength(env, val) == 32);
10518 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
10519 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
10523 LDKInMemoryChannelKeys this_ptr_conv;
10524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10525 this_ptr_conv.is_owned = false;
10526 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
10531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10532 LDKInMemoryChannelKeys this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = false;
10535 LDKSecretKey val_ref;
10536 CHECK((*env)->GetArrayLength(env, val) == 32);
10537 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
10538 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
10541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
10542 LDKInMemoryChannelKeys this_ptr_conv;
10543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10544 this_ptr_conv.is_owned = false;
10545 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
10550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10551 LDKInMemoryChannelKeys this_ptr_conv;
10552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10553 this_ptr_conv.is_owned = false;
10554 LDKThirtyTwoBytes val_ref;
10555 CHECK((*env)->GetArrayLength(env, val) == 32);
10556 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10557 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10561 LDKInMemoryChannelKeys orig_conv;
10562 orig_conv.inner = (void*)(orig & (~1));
10563 orig_conv.is_owned = false;
10564 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
10565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10567 long ret_ref = (long)ret_var.inner;
10568 if (ret_var.is_owned) {
10574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv *env, jclass clz, 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, int64_t key_derivation_params) {
10575 LDKSecretKey funding_key_ref;
10576 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
10577 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
10578 LDKSecretKey revocation_base_key_ref;
10579 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
10580 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
10581 LDKSecretKey payment_key_ref;
10582 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
10583 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
10584 LDKSecretKey delayed_payment_base_key_ref;
10585 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
10586 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
10587 LDKSecretKey htlc_base_key_ref;
10588 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
10589 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
10590 LDKThirtyTwoBytes commitment_seed_ref;
10591 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
10592 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
10593 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1);
10594 FREE((void*)key_derivation_params);
10595 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(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, key_derivation_params_conv);
10596 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10597 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10598 long ret_ref = (long)ret_var.inner;
10599 if (ret_var.is_owned) {
10605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
10606 LDKInMemoryChannelKeys this_arg_conv;
10607 this_arg_conv.inner = (void*)(this_arg & (~1));
10608 this_arg_conv.is_owned = false;
10609 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
10610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10612 long ret_ref = (long)ret_var.inner;
10613 if (ret_var.is_owned) {
10619 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
10620 LDKInMemoryChannelKeys this_arg_conv;
10621 this_arg_conv.inner = (void*)(this_arg & (~1));
10622 this_arg_conv.is_owned = false;
10623 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
10627 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
10628 LDKInMemoryChannelKeys this_arg_conv;
10629 this_arg_conv.inner = (void*)(this_arg & (~1));
10630 this_arg_conv.is_owned = false;
10631 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
10635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
10636 LDKInMemoryChannelKeys this_arg_conv;
10637 this_arg_conv.inner = (void*)(this_arg & (~1));
10638 this_arg_conv.is_owned = false;
10639 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
10643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
10644 LDKInMemoryChannelKeys this_arg_conv;
10645 this_arg_conv.inner = (void*)(this_arg & (~1));
10646 this_arg_conv.is_owned = false;
10647 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
10648 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10649 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10650 long ret_ref = (long)ret_var.inner;
10651 if (ret_var.is_owned) {
10657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
10658 LDKInMemoryChannelKeys this_arg_conv;
10659 this_arg_conv.inner = (void*)(this_arg & (~1));
10660 this_arg_conv.is_owned = false;
10661 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
10662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10664 long ret_ref = (long)ret_var.inner;
10665 if (ret_var.is_owned) {
10671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) {
10672 LDKInMemoryChannelKeys this_arg_conv;
10673 this_arg_conv.inner = (void*)(this_arg & (~1));
10674 this_arg_conv.is_owned = false;
10675 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
10676 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
10680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
10681 LDKInMemoryChannelKeys obj_conv;
10682 obj_conv.inner = (void*)(obj & (~1));
10683 obj_conv.is_owned = false;
10684 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
10685 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10686 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10687 CVec_u8Z_free(arg_var);
10691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
10692 LDKu8slice ser_ref;
10693 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
10694 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
10695 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
10696 *ret_conv = InMemoryChannelKeys_read(ser_ref);
10697 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
10698 return (long)ret_conv;
10701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10702 LDKKeysManager this_ptr_conv;
10703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10705 KeysManager_free(this_ptr_conv);
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, jclass network, int64_t starting_time_secs, int32_t starting_time_nanos) {
10709 unsigned char seed_arr[32];
10710 CHECK((*env)->GetArrayLength(env, seed) == 32);
10711 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
10712 unsigned char (*seed_ref)[32] = &seed_arr;
10713 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
10714 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
10715 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10716 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10717 long ret_ref = (long)ret_var.inner;
10718 if (ret_var.is_owned) {
10724 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, int64_t params_1, int64_t params_2) {
10725 LDKKeysManager this_arg_conv;
10726 this_arg_conv.inner = (void*)(this_arg & (~1));
10727 this_arg_conv.is_owned = false;
10728 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
10729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10731 long ret_ref = (long)ret_var.inner;
10732 if (ret_var.is_owned) {
10738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
10739 LDKKeysManager this_arg_conv;
10740 this_arg_conv.inner = (void*)(this_arg & (~1));
10741 this_arg_conv.is_owned = false;
10742 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
10743 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
10747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10748 LDKChannelManager this_ptr_conv;
10749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10751 ChannelManager_free(this_ptr_conv);
10754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10755 LDKChannelDetails this_ptr_conv;
10756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10758 ChannelDetails_free(this_ptr_conv);
10761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10762 LDKChannelDetails this_ptr_conv;
10763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10764 this_ptr_conv.is_owned = false;
10765 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
10770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10771 LDKChannelDetails this_ptr_conv;
10772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10773 this_ptr_conv.is_owned = false;
10774 LDKThirtyTwoBytes val_ref;
10775 CHECK((*env)->GetArrayLength(env, val) == 32);
10776 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10777 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
10780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10781 LDKChannelDetails this_ptr_conv;
10782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10783 this_ptr_conv.is_owned = false;
10784 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10785 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
10789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10790 LDKChannelDetails this_ptr_conv;
10791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10792 this_ptr_conv.is_owned = false;
10793 LDKPublicKey val_ref;
10794 CHECK((*env)->GetArrayLength(env, val) == 33);
10795 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10796 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
10799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
10800 LDKChannelDetails this_ptr_conv;
10801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10802 this_ptr_conv.is_owned = false;
10803 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
10804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10806 long ret_ref = (long)ret_var.inner;
10807 if (ret_var.is_owned) {
10813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10814 LDKChannelDetails this_ptr_conv;
10815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10816 this_ptr_conv.is_owned = false;
10817 LDKInitFeatures val_conv;
10818 val_conv.inner = (void*)(val & (~1));
10819 val_conv.is_owned = (val & 1) || (val == 0);
10820 val_conv = InitFeatures_clone(&val_conv);
10821 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
10824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10825 LDKChannelDetails this_ptr_conv;
10826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10827 this_ptr_conv.is_owned = false;
10828 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
10832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10833 LDKChannelDetails this_ptr_conv;
10834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10835 this_ptr_conv.is_owned = false;
10836 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
10839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10840 LDKChannelDetails this_ptr_conv;
10841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10842 this_ptr_conv.is_owned = false;
10843 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
10847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10848 LDKChannelDetails this_ptr_conv;
10849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10850 this_ptr_conv.is_owned = false;
10851 ChannelDetails_set_user_id(&this_ptr_conv, val);
10854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10855 LDKChannelDetails this_ptr_conv;
10856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10857 this_ptr_conv.is_owned = false;
10858 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
10862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10863 LDKChannelDetails this_ptr_conv;
10864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10865 this_ptr_conv.is_owned = false;
10866 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
10869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10870 LDKChannelDetails this_ptr_conv;
10871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10872 this_ptr_conv.is_owned = false;
10873 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
10877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10878 LDKChannelDetails this_ptr_conv;
10879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10880 this_ptr_conv.is_owned = false;
10881 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
10884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
10885 LDKChannelDetails this_ptr_conv;
10886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10887 this_ptr_conv.is_owned = false;
10888 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
10892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
10893 LDKChannelDetails this_ptr_conv;
10894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10895 this_ptr_conv.is_owned = false;
10896 ChannelDetails_set_is_live(&this_ptr_conv, val);
10899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10900 LDKChannelDetails orig_conv;
10901 orig_conv.inner = (void*)(orig & (~1));
10902 orig_conv.is_owned = false;
10903 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
10904 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10905 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10906 long ret_ref = (long)ret_var.inner;
10907 if (ret_var.is_owned) {
10913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10914 LDKPaymentSendFailure this_ptr_conv;
10915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10917 PaymentSendFailure_free(this_ptr_conv);
10920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10921 LDKPaymentSendFailure orig_conv;
10922 orig_conv.inner = (void*)(orig & (~1));
10923 orig_conv.is_owned = false;
10924 LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv);
10925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10927 long ret_ref = (long)ret_var.inner;
10928 if (ret_var.is_owned) {
10934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, jclass network, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t current_blockchain_height) {
10935 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
10936 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
10937 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
10938 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10939 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
10941 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
10942 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
10943 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10944 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
10946 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
10947 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
10948 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10949 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
10951 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10952 if (logger_conv.free == LDKLogger_JCalls_free) {
10953 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10954 LDKLogger_JCalls_clone(logger_conv.this_arg);
10956 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
10957 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
10958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10959 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
10961 LDKUserConfig config_conv;
10962 config_conv.inner = (void*)(config & (~1));
10963 config_conv.is_owned = (config & 1) || (config == 0);
10964 config_conv = UserConfig_clone(&config_conv);
10965 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
10966 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10967 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10968 long ret_ref = (long)ret_var.inner;
10969 if (ret_var.is_owned) {
10975 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_id, int64_t override_config) {
10976 LDKChannelManager this_arg_conv;
10977 this_arg_conv.inner = (void*)(this_arg & (~1));
10978 this_arg_conv.is_owned = false;
10979 LDKPublicKey their_network_key_ref;
10980 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
10981 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
10982 LDKUserConfig override_config_conv;
10983 override_config_conv.inner = (void*)(override_config & (~1));
10984 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
10985 override_config_conv = UserConfig_clone(&override_config_conv);
10986 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10987 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
10988 return (long)ret_conv;
10991 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
10992 LDKChannelManager this_arg_conv;
10993 this_arg_conv.inner = (void*)(this_arg & (~1));
10994 this_arg_conv.is_owned = false;
10995 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
10996 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10997 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10998 for (size_t q = 0; q < ret_var.datalen; q++) {
10999 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
11000 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11001 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11002 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
11003 if (arr_conv_16_var.is_owned) {
11004 arr_conv_16_ref |= 1;
11006 ret_arr_ptr[q] = arr_conv_16_ref;
11008 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11009 FREE(ret_var.data);
11013 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
11014 LDKChannelManager this_arg_conv;
11015 this_arg_conv.inner = (void*)(this_arg & (~1));
11016 this_arg_conv.is_owned = false;
11017 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
11018 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11019 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11020 for (size_t q = 0; q < ret_var.datalen; q++) {
11021 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
11022 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11023 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11024 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
11025 if (arr_conv_16_var.is_owned) {
11026 arr_conv_16_ref |= 1;
11028 ret_arr_ptr[q] = arr_conv_16_ref;
11030 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11031 FREE(ret_var.data);
11035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
11036 LDKChannelManager this_arg_conv;
11037 this_arg_conv.inner = (void*)(this_arg & (~1));
11038 this_arg_conv.is_owned = false;
11039 unsigned char channel_id_arr[32];
11040 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
11041 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
11042 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11043 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11044 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11045 return (long)ret_conv;
11048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
11049 LDKChannelManager this_arg_conv;
11050 this_arg_conv.inner = (void*)(this_arg & (~1));
11051 this_arg_conv.is_owned = false;
11052 unsigned char channel_id_arr[32];
11053 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
11054 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
11055 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11056 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11057 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11058 return (long)ret_conv;
11061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
11062 LDKChannelManager this_arg_conv;
11063 this_arg_conv.inner = (void*)(this_arg & (~1));
11064 this_arg_conv.is_owned = false;
11065 ChannelManager_force_close_all_channels(&this_arg_conv);
11068 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) {
11069 LDKChannelManager this_arg_conv;
11070 this_arg_conv.inner = (void*)(this_arg & (~1));
11071 this_arg_conv.is_owned = false;
11072 LDKRoute route_conv;
11073 route_conv.inner = (void*)(route & (~1));
11074 route_conv.is_owned = false;
11075 LDKThirtyTwoBytes payment_hash_ref;
11076 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11077 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
11078 LDKThirtyTwoBytes payment_secret_ref;
11079 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11080 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11081 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11082 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11083 return (long)ret_conv;
11086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t funding_txo) {
11087 LDKChannelManager this_arg_conv;
11088 this_arg_conv.inner = (void*)(this_arg & (~1));
11089 this_arg_conv.is_owned = false;
11090 unsigned char temporary_channel_id_arr[32];
11091 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
11092 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
11093 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11094 LDKOutPoint funding_txo_conv;
11095 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11096 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
11097 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
11098 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
11101 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) {
11102 LDKChannelManager this_arg_conv;
11103 this_arg_conv.inner = (void*)(this_arg & (~1));
11104 this_arg_conv.is_owned = false;
11105 LDKThreeBytes rgb_ref;
11106 CHECK((*env)->GetArrayLength(env, rgb) == 3);
11107 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
11108 LDKThirtyTwoBytes alias_ref;
11109 CHECK((*env)->GetArrayLength(env, alias) == 32);
11110 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
11111 LDKCVec_NetAddressZ addresses_constr;
11112 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
11113 if (addresses_constr.datalen > 0)
11114 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11116 addresses_constr.data = NULL;
11117 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
11118 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11119 int64_t arr_conv_12 = addresses_vals[m];
11120 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
11121 FREE((void*)arr_conv_12);
11122 addresses_constr.data[m] = arr_conv_12_conv;
11124 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
11125 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
11129 LDKChannelManager this_arg_conv;
11130 this_arg_conv.inner = (void*)(this_arg & (~1));
11131 this_arg_conv.is_owned = false;
11132 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
11136 LDKChannelManager this_arg_conv;
11137 this_arg_conv.inner = (void*)(this_arg & (~1));
11138 this_arg_conv.is_owned = false;
11139 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
11142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
11143 LDKChannelManager this_arg_conv;
11144 this_arg_conv.inner = (void*)(this_arg & (~1));
11145 this_arg_conv.is_owned = false;
11146 unsigned char payment_hash_arr[32];
11147 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11148 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
11149 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11150 LDKThirtyTwoBytes payment_secret_ref;
11151 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11152 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11153 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
11158 LDKChannelManager this_arg_conv;
11159 this_arg_conv.inner = (void*)(this_arg & (~1));
11160 this_arg_conv.is_owned = false;
11161 LDKThirtyTwoBytes payment_preimage_ref;
11162 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
11163 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
11164 LDKThirtyTwoBytes payment_secret_ref;
11165 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11166 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11167 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11172 LDKChannelManager this_arg_conv;
11173 this_arg_conv.inner = (void*)(this_arg & (~1));
11174 this_arg_conv.is_owned = false;
11175 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11176 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
11180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
11181 LDKChannelManager this_arg_conv;
11182 this_arg_conv.inner = (void*)(this_arg & (~1));
11183 this_arg_conv.is_owned = false;
11184 LDKOutPoint funding_txo_conv;
11185 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11186 funding_txo_conv.is_owned = false;
11187 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
11191 LDKChannelManager this_arg_conv;
11192 this_arg_conv.inner = (void*)(this_arg & (~1));
11193 this_arg_conv.is_owned = false;
11194 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11195 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
11199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
11200 LDKChannelManager this_arg_conv;
11201 this_arg_conv.inner = (void*)(this_arg & (~1));
11202 this_arg_conv.is_owned = false;
11203 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11204 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
11208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
11209 LDKChannelManager this_arg_conv;
11210 this_arg_conv.inner = (void*)(this_arg & (~1));
11211 this_arg_conv.is_owned = false;
11212 unsigned char header_arr[80];
11213 CHECK((*env)->GetArrayLength(env, header) == 80);
11214 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11215 unsigned char (*header_ref)[80] = &header_arr;
11216 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11217 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11218 if (txdata_constr.datalen > 0)
11219 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11221 txdata_constr.data = NULL;
11222 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11223 for (size_t y = 0; y < txdata_constr.datalen; y++) {
11224 int64_t arr_conv_24 = txdata_vals[y];
11225 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
11226 FREE((void*)arr_conv_24);
11227 txdata_constr.data[y] = arr_conv_24_conv;
11229 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11230 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
11233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
11234 LDKChannelManager this_arg_conv;
11235 this_arg_conv.inner = (void*)(this_arg & (~1));
11236 this_arg_conv.is_owned = false;
11237 unsigned char header_arr[80];
11238 CHECK((*env)->GetArrayLength(env, header) == 80);
11239 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11240 unsigned char (*header_ref)[80] = &header_arr;
11241 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
11244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
11245 LDKChannelManager this_arg_conv;
11246 this_arg_conv.inner = (void*)(this_arg & (~1));
11247 this_arg_conv.is_owned = false;
11248 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11249 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
11253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
11254 LDKChannelManager obj_conv;
11255 obj_conv.inner = (void*)(obj & (~1));
11256 obj_conv.is_owned = false;
11257 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
11258 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
11259 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
11260 CVec_u8Z_free(arg_var);
11264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11265 LDKChannelManagerReadArgs this_ptr_conv;
11266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11268 ChannelManagerReadArgs_free(this_ptr_conv);
11271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
11272 LDKChannelManagerReadArgs this_ptr_conv;
11273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11274 this_ptr_conv.is_owned = false;
11275 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
11279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11280 LDKChannelManagerReadArgs this_ptr_conv;
11281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11282 this_ptr_conv.is_owned = false;
11283 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
11284 if (val_conv.free == LDKKeysInterface_JCalls_free) {
11285 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11286 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
11288 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
11291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
11292 LDKChannelManagerReadArgs this_ptr_conv;
11293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11294 this_ptr_conv.is_owned = false;
11295 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
11299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11300 LDKChannelManagerReadArgs this_ptr_conv;
11301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11302 this_ptr_conv.is_owned = false;
11303 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
11304 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
11305 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11306 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
11308 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
11311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
11312 LDKChannelManagerReadArgs this_ptr_conv;
11313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11314 this_ptr_conv.is_owned = false;
11315 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
11319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11320 LDKChannelManagerReadArgs this_ptr_conv;
11321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11322 this_ptr_conv.is_owned = false;
11323 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
11324 if (val_conv.free == LDKWatch_JCalls_free) {
11325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11326 LDKWatch_JCalls_clone(val_conv.this_arg);
11328 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
11331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
11332 LDKChannelManagerReadArgs this_ptr_conv;
11333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11334 this_ptr_conv.is_owned = false;
11335 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
11339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11340 LDKChannelManagerReadArgs this_ptr_conv;
11341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11342 this_ptr_conv.is_owned = false;
11343 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
11344 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
11345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11346 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
11348 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
11351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
11352 LDKChannelManagerReadArgs this_ptr_conv;
11353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11354 this_ptr_conv.is_owned = false;
11355 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
11359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11360 LDKChannelManagerReadArgs this_ptr_conv;
11361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11362 this_ptr_conv.is_owned = false;
11363 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
11364 if (val_conv.free == LDKLogger_JCalls_free) {
11365 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11366 LDKLogger_JCalls_clone(val_conv.this_arg);
11368 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
11371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
11372 LDKChannelManagerReadArgs this_ptr_conv;
11373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11374 this_ptr_conv.is_owned = false;
11375 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
11376 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11377 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11378 long ret_ref = (long)ret_var.inner;
11379 if (ret_var.is_owned) {
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11386 LDKChannelManagerReadArgs this_ptr_conv;
11387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11388 this_ptr_conv.is_owned = false;
11389 LDKUserConfig val_conv;
11390 val_conv.inner = (void*)(val & (~1));
11391 val_conv.is_owned = (val & 1) || (val == 0);
11392 val_conv = UserConfig_clone(&val_conv);
11393 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
11396 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) {
11397 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11398 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
11399 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11400 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
11402 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11403 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
11404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11405 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
11407 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11408 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
11409 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11410 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
11412 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11413 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
11414 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11415 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
11417 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11418 if (logger_conv.free == LDKLogger_JCalls_free) {
11419 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11420 LDKLogger_JCalls_clone(logger_conv.this_arg);
11422 LDKUserConfig default_config_conv;
11423 default_config_conv.inner = (void*)(default_config & (~1));
11424 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
11425 default_config_conv = UserConfig_clone(&default_config_conv);
11426 LDKCVec_ChannelMonitorZ channel_monitors_constr;
11427 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
11428 if (channel_monitors_constr.datalen > 0)
11429 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11431 channel_monitors_constr.data = NULL;
11432 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
11433 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
11434 int64_t arr_conv_16 = channel_monitors_vals[q];
11435 LDKChannelMonitor arr_conv_16_conv;
11436 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11437 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11438 channel_monitors_constr.data[q] = arr_conv_16_conv;
11440 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
11441 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);
11442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11444 long ret_ref = (long)ret_var.inner;
11445 if (ret_var.is_owned) {
11451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
11452 LDKu8slice ser_ref;
11453 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11454 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11455 LDKChannelManagerReadArgs arg_conv;
11456 arg_conv.inner = (void*)(arg & (~1));
11457 arg_conv.is_owned = (arg & 1) || (arg == 0);
11458 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
11459 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11460 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
11461 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11462 return (long)ret_conv;
11465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11466 LDKDecodeError this_ptr_conv;
11467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11469 DecodeError_free(this_ptr_conv);
11472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11473 LDKDecodeError orig_conv;
11474 orig_conv.inner = (void*)(orig & (~1));
11475 orig_conv.is_owned = false;
11476 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
11477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11479 long ret_ref = (long)ret_var.inner;
11480 if (ret_var.is_owned) {
11486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11487 LDKInit this_ptr_conv;
11488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11490 Init_free(this_ptr_conv);
11493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11495 orig_conv.inner = (void*)(orig & (~1));
11496 orig_conv.is_owned = false;
11497 LDKInit ret_var = Init_clone(&orig_conv);
11498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11500 long ret_ref = (long)ret_var.inner;
11501 if (ret_var.is_owned) {
11507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11508 LDKErrorMessage this_ptr_conv;
11509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11511 ErrorMessage_free(this_ptr_conv);
11514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11515 LDKErrorMessage this_ptr_conv;
11516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11517 this_ptr_conv.is_owned = false;
11518 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
11523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11524 LDKErrorMessage this_ptr_conv;
11525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11526 this_ptr_conv.is_owned = false;
11527 LDKThirtyTwoBytes val_ref;
11528 CHECK((*env)->GetArrayLength(env, val) == 32);
11529 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11530 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
11533 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
11534 LDKErrorMessage this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = false;
11537 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
11538 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
11542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11543 LDKErrorMessage this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 LDKCVec_u8Z val_ref;
11547 val_ref.datalen = (*env)->GetArrayLength(env, val);
11548 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11549 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
11550 ErrorMessage_set_data(&this_ptr_conv, val_ref);
11553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
11554 LDKThirtyTwoBytes channel_id_arg_ref;
11555 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11556 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11557 LDKCVec_u8Z data_arg_ref;
11558 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
11559 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11560 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
11561 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
11562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11564 long ret_ref = (long)ret_var.inner;
11565 if (ret_var.is_owned) {
11571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11572 LDKErrorMessage orig_conv;
11573 orig_conv.inner = (void*)(orig & (~1));
11574 orig_conv.is_owned = false;
11575 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
11576 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11577 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11578 long ret_ref = (long)ret_var.inner;
11579 if (ret_var.is_owned) {
11585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11586 LDKPing this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11589 Ping_free(this_ptr_conv);
11592 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
11593 LDKPing this_ptr_conv;
11594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11595 this_ptr_conv.is_owned = false;
11596 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
11600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11601 LDKPing this_ptr_conv;
11602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11603 this_ptr_conv.is_owned = false;
11604 Ping_set_ponglen(&this_ptr_conv, val);
11607 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
11608 LDKPing this_ptr_conv;
11609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11610 this_ptr_conv.is_owned = false;
11611 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
11615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11616 LDKPing this_ptr_conv;
11617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11618 this_ptr_conv.is_owned = false;
11619 Ping_set_byteslen(&this_ptr_conv, val);
11622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
11623 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
11624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11626 long ret_ref = (long)ret_var.inner;
11627 if (ret_var.is_owned) {
11633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11635 orig_conv.inner = (void*)(orig & (~1));
11636 orig_conv.is_owned = false;
11637 LDKPing ret_var = Ping_clone(&orig_conv);
11638 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11639 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11640 long ret_ref = (long)ret_var.inner;
11641 if (ret_var.is_owned) {
11647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11648 LDKPong this_ptr_conv;
11649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11651 Pong_free(this_ptr_conv);
11654 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
11655 LDKPong this_ptr_conv;
11656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11657 this_ptr_conv.is_owned = false;
11658 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
11662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11663 LDKPong this_ptr_conv;
11664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11665 this_ptr_conv.is_owned = false;
11666 Pong_set_byteslen(&this_ptr_conv, val);
11669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
11670 LDKPong ret_var = Pong_new(byteslen_arg);
11671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11673 long ret_ref = (long)ret_var.inner;
11674 if (ret_var.is_owned) {
11680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11682 orig_conv.inner = (void*)(orig & (~1));
11683 orig_conv.is_owned = false;
11684 LDKPong ret_var = Pong_clone(&orig_conv);
11685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11687 long ret_ref = (long)ret_var.inner;
11688 if (ret_var.is_owned) {
11694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11695 LDKOpenChannel this_ptr_conv;
11696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11698 OpenChannel_free(this_ptr_conv);
11701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11702 LDKOpenChannel this_ptr_conv;
11703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11704 this_ptr_conv.is_owned = false;
11705 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
11710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11711 LDKOpenChannel this_ptr_conv;
11712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11713 this_ptr_conv.is_owned = false;
11714 LDKThirtyTwoBytes val_ref;
11715 CHECK((*env)->GetArrayLength(env, val) == 32);
11716 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11717 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
11720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11721 LDKOpenChannel this_ptr_conv;
11722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11723 this_ptr_conv.is_owned = false;
11724 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11725 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
11729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11730 LDKOpenChannel this_ptr_conv;
11731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11732 this_ptr_conv.is_owned = false;
11733 LDKThirtyTwoBytes val_ref;
11734 CHECK((*env)->GetArrayLength(env, val) == 32);
11735 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11736 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11740 LDKOpenChannel this_ptr_conv;
11741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11742 this_ptr_conv.is_owned = false;
11743 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
11747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11748 LDKOpenChannel this_ptr_conv;
11749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11750 this_ptr_conv.is_owned = false;
11751 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
11754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11755 LDKOpenChannel this_ptr_conv;
11756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11757 this_ptr_conv.is_owned = false;
11758 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
11762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11763 LDKOpenChannel this_ptr_conv;
11764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11765 this_ptr_conv.is_owned = false;
11766 OpenChannel_set_push_msat(&this_ptr_conv, val);
11769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11770 LDKOpenChannel this_ptr_conv;
11771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11772 this_ptr_conv.is_owned = false;
11773 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
11777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11778 LDKOpenChannel this_ptr_conv;
11779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11780 this_ptr_conv.is_owned = false;
11781 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11784 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) {
11785 LDKOpenChannel this_ptr_conv;
11786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11787 this_ptr_conv.is_owned = false;
11788 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11792 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) {
11793 LDKOpenChannel this_ptr_conv;
11794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11795 this_ptr_conv.is_owned = false;
11796 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
11800 LDKOpenChannel this_ptr_conv;
11801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11802 this_ptr_conv.is_owned = false;
11803 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11808 LDKOpenChannel this_ptr_conv;
11809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11810 this_ptr_conv.is_owned = false;
11811 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
11815 LDKOpenChannel this_ptr_conv;
11816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11817 this_ptr_conv.is_owned = false;
11818 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
11822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11823 LDKOpenChannel this_ptr_conv;
11824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11825 this_ptr_conv.is_owned = false;
11826 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11829 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
11830 LDKOpenChannel this_ptr_conv;
11831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11832 this_ptr_conv.is_owned = false;
11833 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
11837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11838 LDKOpenChannel this_ptr_conv;
11839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11840 this_ptr_conv.is_owned = false;
11841 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
11844 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
11845 LDKOpenChannel this_ptr_conv;
11846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11847 this_ptr_conv.is_owned = false;
11848 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
11852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11853 LDKOpenChannel this_ptr_conv;
11854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11855 this_ptr_conv.is_owned = false;
11856 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
11859 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
11860 LDKOpenChannel this_ptr_conv;
11861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11862 this_ptr_conv.is_owned = false;
11863 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
11867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11868 LDKOpenChannel this_ptr_conv;
11869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11870 this_ptr_conv.is_owned = false;
11871 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
11875 LDKOpenChannel this_ptr_conv;
11876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11877 this_ptr_conv.is_owned = false;
11878 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11879 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
11883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11884 LDKOpenChannel this_ptr_conv;
11885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11886 this_ptr_conv.is_owned = false;
11887 LDKPublicKey val_ref;
11888 CHECK((*env)->GetArrayLength(env, val) == 33);
11889 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11890 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11894 LDKOpenChannel this_ptr_conv;
11895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11896 this_ptr_conv.is_owned = false;
11897 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11898 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11903 LDKOpenChannel this_ptr_conv;
11904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11905 this_ptr_conv.is_owned = false;
11906 LDKPublicKey val_ref;
11907 CHECK((*env)->GetArrayLength(env, val) == 33);
11908 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11909 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11913 LDKOpenChannel this_ptr_conv;
11914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11915 this_ptr_conv.is_owned = false;
11916 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11917 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
11921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11922 LDKOpenChannel this_ptr_conv;
11923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11924 this_ptr_conv.is_owned = false;
11925 LDKPublicKey val_ref;
11926 CHECK((*env)->GetArrayLength(env, val) == 33);
11927 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11928 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
11931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11932 LDKOpenChannel this_ptr_conv;
11933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11934 this_ptr_conv.is_owned = false;
11935 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11936 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11941 LDKOpenChannel this_ptr_conv;
11942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11943 this_ptr_conv.is_owned = false;
11944 LDKPublicKey val_ref;
11945 CHECK((*env)->GetArrayLength(env, val) == 33);
11946 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11947 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
11951 LDKOpenChannel this_ptr_conv;
11952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11953 this_ptr_conv.is_owned = false;
11954 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11955 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
11959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11960 LDKOpenChannel this_ptr_conv;
11961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11962 this_ptr_conv.is_owned = false;
11963 LDKPublicKey val_ref;
11964 CHECK((*env)->GetArrayLength(env, val) == 33);
11965 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11966 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11970 LDKOpenChannel this_ptr_conv;
11971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11972 this_ptr_conv.is_owned = false;
11973 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11974 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
11978 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) {
11979 LDKOpenChannel this_ptr_conv;
11980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11981 this_ptr_conv.is_owned = false;
11982 LDKPublicKey val_ref;
11983 CHECK((*env)->GetArrayLength(env, val) == 33);
11984 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11985 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11988 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
11989 LDKOpenChannel this_ptr_conv;
11990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11991 this_ptr_conv.is_owned = false;
11992 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
11996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
11997 LDKOpenChannel this_ptr_conv;
11998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11999 this_ptr_conv.is_owned = false;
12000 OpenChannel_set_channel_flags(&this_ptr_conv, val);
12003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12004 LDKOpenChannel orig_conv;
12005 orig_conv.inner = (void*)(orig & (~1));
12006 orig_conv.is_owned = false;
12007 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
12008 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12009 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12010 long ret_ref = (long)ret_var.inner;
12011 if (ret_var.is_owned) {
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12018 LDKAcceptChannel this_ptr_conv;
12019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12021 AcceptChannel_free(this_ptr_conv);
12024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12025 LDKAcceptChannel this_ptr_conv;
12026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12027 this_ptr_conv.is_owned = false;
12028 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12029 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
12033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12034 LDKAcceptChannel this_ptr_conv;
12035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12036 this_ptr_conv.is_owned = false;
12037 LDKThirtyTwoBytes val_ref;
12038 CHECK((*env)->GetArrayLength(env, val) == 32);
12039 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12040 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12044 LDKAcceptChannel this_ptr_conv;
12045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12046 this_ptr_conv.is_owned = false;
12047 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12052 LDKAcceptChannel this_ptr_conv;
12053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12054 this_ptr_conv.is_owned = false;
12055 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12058 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) {
12059 LDKAcceptChannel this_ptr_conv;
12060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12061 this_ptr_conv.is_owned = false;
12062 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12066 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) {
12067 LDKAcceptChannel this_ptr_conv;
12068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12069 this_ptr_conv.is_owned = false;
12070 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12074 LDKAcceptChannel this_ptr_conv;
12075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12076 this_ptr_conv.is_owned = false;
12077 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12082 LDKAcceptChannel this_ptr_conv;
12083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12084 this_ptr_conv.is_owned = false;
12085 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12089 LDKAcceptChannel this_ptr_conv;
12090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12091 this_ptr_conv.is_owned = false;
12092 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12097 LDKAcceptChannel this_ptr_conv;
12098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12099 this_ptr_conv.is_owned = false;
12100 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12103 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
12104 LDKAcceptChannel this_ptr_conv;
12105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12106 this_ptr_conv.is_owned = false;
12107 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12112 LDKAcceptChannel this_ptr_conv;
12113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12114 this_ptr_conv.is_owned = false;
12115 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12118 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
12119 LDKAcceptChannel this_ptr_conv;
12120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12121 this_ptr_conv.is_owned = false;
12122 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12127 LDKAcceptChannel this_ptr_conv;
12128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12129 this_ptr_conv.is_owned = false;
12130 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12133 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
12134 LDKAcceptChannel this_ptr_conv;
12135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12136 this_ptr_conv.is_owned = false;
12137 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
12141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12142 LDKAcceptChannel this_ptr_conv;
12143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12144 this_ptr_conv.is_owned = false;
12145 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
12149 LDKAcceptChannel this_ptr_conv;
12150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12151 this_ptr_conv.is_owned = false;
12152 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12153 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
12157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12158 LDKAcceptChannel this_ptr_conv;
12159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12160 this_ptr_conv.is_owned = false;
12161 LDKPublicKey val_ref;
12162 CHECK((*env)->GetArrayLength(env, val) == 33);
12163 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12164 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12168 LDKAcceptChannel this_ptr_conv;
12169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12170 this_ptr_conv.is_owned = false;
12171 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12172 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12177 LDKAcceptChannel this_ptr_conv;
12178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12179 this_ptr_conv.is_owned = false;
12180 LDKPublicKey val_ref;
12181 CHECK((*env)->GetArrayLength(env, val) == 33);
12182 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12183 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
12187 LDKAcceptChannel this_ptr_conv;
12188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12189 this_ptr_conv.is_owned = false;
12190 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12191 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
12195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12196 LDKAcceptChannel this_ptr_conv;
12197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12198 this_ptr_conv.is_owned = false;
12199 LDKPublicKey val_ref;
12200 CHECK((*env)->GetArrayLength(env, val) == 33);
12201 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12202 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
12205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12206 LDKAcceptChannel this_ptr_conv;
12207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12208 this_ptr_conv.is_owned = false;
12209 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12210 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12215 LDKAcceptChannel this_ptr_conv;
12216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12217 this_ptr_conv.is_owned = false;
12218 LDKPublicKey val_ref;
12219 CHECK((*env)->GetArrayLength(env, val) == 33);
12220 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12221 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
12225 LDKAcceptChannel this_ptr_conv;
12226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12227 this_ptr_conv.is_owned = false;
12228 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12229 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12234 LDKAcceptChannel this_ptr_conv;
12235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12236 this_ptr_conv.is_owned = false;
12237 LDKPublicKey val_ref;
12238 CHECK((*env)->GetArrayLength(env, val) == 33);
12239 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12240 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
12244 LDKAcceptChannel this_ptr_conv;
12245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12246 this_ptr_conv.is_owned = false;
12247 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12248 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
12252 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) {
12253 LDKAcceptChannel this_ptr_conv;
12254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12255 this_ptr_conv.is_owned = false;
12256 LDKPublicKey val_ref;
12257 CHECK((*env)->GetArrayLength(env, val) == 33);
12258 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12259 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12263 LDKAcceptChannel orig_conv;
12264 orig_conv.inner = (void*)(orig & (~1));
12265 orig_conv.is_owned = false;
12266 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
12267 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12268 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12269 long ret_ref = (long)ret_var.inner;
12270 if (ret_var.is_owned) {
12276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12277 LDKFundingCreated this_ptr_conv;
12278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12280 FundingCreated_free(this_ptr_conv);
12283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12284 LDKFundingCreated this_ptr_conv;
12285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12286 this_ptr_conv.is_owned = false;
12287 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
12292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12293 LDKFundingCreated this_ptr_conv;
12294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12295 this_ptr_conv.is_owned = false;
12296 LDKThirtyTwoBytes val_ref;
12297 CHECK((*env)->GetArrayLength(env, val) == 32);
12298 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12299 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
12302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
12303 LDKFundingCreated this_ptr_conv;
12304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12305 this_ptr_conv.is_owned = false;
12306 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12307 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
12311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12312 LDKFundingCreated this_ptr_conv;
12313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12314 this_ptr_conv.is_owned = false;
12315 LDKThirtyTwoBytes val_ref;
12316 CHECK((*env)->GetArrayLength(env, val) == 32);
12317 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12318 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
12321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
12322 LDKFundingCreated this_ptr_conv;
12323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12324 this_ptr_conv.is_owned = false;
12325 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
12329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12330 LDKFundingCreated this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
12336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12337 LDKFundingCreated this_ptr_conv;
12338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12339 this_ptr_conv.is_owned = false;
12340 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12341 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
12345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12346 LDKFundingCreated this_ptr_conv;
12347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12348 this_ptr_conv.is_owned = false;
12349 LDKSignature val_ref;
12350 CHECK((*env)->GetArrayLength(env, val) == 64);
12351 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12352 FundingCreated_set_signature(&this_ptr_conv, val_ref);
12355 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) {
12356 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
12357 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
12358 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
12359 LDKThirtyTwoBytes funding_txid_arg_ref;
12360 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
12361 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
12362 LDKSignature signature_arg_ref;
12363 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12364 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12365 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
12366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12368 long ret_ref = (long)ret_var.inner;
12369 if (ret_var.is_owned) {
12375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12376 LDKFundingCreated orig_conv;
12377 orig_conv.inner = (void*)(orig & (~1));
12378 orig_conv.is_owned = false;
12379 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
12380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12382 long ret_ref = (long)ret_var.inner;
12383 if (ret_var.is_owned) {
12389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12390 LDKFundingSigned this_ptr_conv;
12391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12393 FundingSigned_free(this_ptr_conv);
12396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12397 LDKFundingSigned this_ptr_conv;
12398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12399 this_ptr_conv.is_owned = false;
12400 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12401 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
12405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12406 LDKFundingSigned this_ptr_conv;
12407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12408 this_ptr_conv.is_owned = false;
12409 LDKThirtyTwoBytes val_ref;
12410 CHECK((*env)->GetArrayLength(env, val) == 32);
12411 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12412 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
12415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12416 LDKFundingSigned this_ptr_conv;
12417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12418 this_ptr_conv.is_owned = false;
12419 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12420 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
12424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12425 LDKFundingSigned this_ptr_conv;
12426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12427 this_ptr_conv.is_owned = false;
12428 LDKSignature val_ref;
12429 CHECK((*env)->GetArrayLength(env, val) == 64);
12430 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12431 FundingSigned_set_signature(&this_ptr_conv, val_ref);
12434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
12435 LDKThirtyTwoBytes channel_id_arg_ref;
12436 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12437 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12438 LDKSignature signature_arg_ref;
12439 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12440 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12441 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
12442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12444 long ret_ref = (long)ret_var.inner;
12445 if (ret_var.is_owned) {
12451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12452 LDKFundingSigned orig_conv;
12453 orig_conv.inner = (void*)(orig & (~1));
12454 orig_conv.is_owned = false;
12455 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
12456 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12457 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12458 long ret_ref = (long)ret_var.inner;
12459 if (ret_var.is_owned) {
12465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12466 LDKFundingLocked this_ptr_conv;
12467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12469 FundingLocked_free(this_ptr_conv);
12472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12473 LDKFundingLocked this_ptr_conv;
12474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12475 this_ptr_conv.is_owned = false;
12476 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12477 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
12481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12482 LDKFundingLocked this_ptr_conv;
12483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12484 this_ptr_conv.is_owned = false;
12485 LDKThirtyTwoBytes val_ref;
12486 CHECK((*env)->GetArrayLength(env, val) == 32);
12487 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12488 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
12491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
12492 LDKFundingLocked this_ptr_conv;
12493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12494 this_ptr_conv.is_owned = false;
12495 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12496 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
12500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12501 LDKFundingLocked this_ptr_conv;
12502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12503 this_ptr_conv.is_owned = false;
12504 LDKPublicKey val_ref;
12505 CHECK((*env)->GetArrayLength(env, val) == 33);
12506 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12507 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
12511 LDKThirtyTwoBytes channel_id_arg_ref;
12512 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12513 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12514 LDKPublicKey next_per_commitment_point_arg_ref;
12515 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
12516 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
12517 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
12518 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12519 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12520 long ret_ref = (long)ret_var.inner;
12521 if (ret_var.is_owned) {
12527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12528 LDKFundingLocked orig_conv;
12529 orig_conv.inner = (void*)(orig & (~1));
12530 orig_conv.is_owned = false;
12531 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
12532 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12533 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12534 long ret_ref = (long)ret_var.inner;
12535 if (ret_var.is_owned) {
12541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12542 LDKShutdown this_ptr_conv;
12543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12545 Shutdown_free(this_ptr_conv);
12548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12549 LDKShutdown this_ptr_conv;
12550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12551 this_ptr_conv.is_owned = false;
12552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
12557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12558 LDKShutdown this_ptr_conv;
12559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12560 this_ptr_conv.is_owned = false;
12561 LDKThirtyTwoBytes val_ref;
12562 CHECK((*env)->GetArrayLength(env, val) == 32);
12563 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12564 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
12567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
12568 LDKShutdown this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
12572 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
12573 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
12577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12578 LDKShutdown this_ptr_conv;
12579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12580 this_ptr_conv.is_owned = false;
12581 LDKCVec_u8Z val_ref;
12582 val_ref.datalen = (*env)->GetArrayLength(env, val);
12583 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12584 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12585 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
12588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
12589 LDKThirtyTwoBytes channel_id_arg_ref;
12590 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12591 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12592 LDKCVec_u8Z scriptpubkey_arg_ref;
12593 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
12594 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12595 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
12596 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
12597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12599 long ret_ref = (long)ret_var.inner;
12600 if (ret_var.is_owned) {
12606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12607 LDKShutdown orig_conv;
12608 orig_conv.inner = (void*)(orig & (~1));
12609 orig_conv.is_owned = false;
12610 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
12611 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12612 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12613 long ret_ref = (long)ret_var.inner;
12614 if (ret_var.is_owned) {
12620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12621 LDKClosingSigned this_ptr_conv;
12622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12624 ClosingSigned_free(this_ptr_conv);
12627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12628 LDKClosingSigned this_ptr_conv;
12629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12630 this_ptr_conv.is_owned = false;
12631 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12632 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
12636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12637 LDKClosingSigned this_ptr_conv;
12638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12639 this_ptr_conv.is_owned = false;
12640 LDKThirtyTwoBytes val_ref;
12641 CHECK((*env)->GetArrayLength(env, val) == 32);
12642 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12643 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
12646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
12647 LDKClosingSigned this_ptr_conv;
12648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12649 this_ptr_conv.is_owned = false;
12650 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
12654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12655 LDKClosingSigned this_ptr_conv;
12656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12657 this_ptr_conv.is_owned = false;
12658 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
12661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12662 LDKClosingSigned this_ptr_conv;
12663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12664 this_ptr_conv.is_owned = false;
12665 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12666 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
12670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12671 LDKClosingSigned this_ptr_conv;
12672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12673 this_ptr_conv.is_owned = false;
12674 LDKSignature val_ref;
12675 CHECK((*env)->GetArrayLength(env, val) == 64);
12676 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12677 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
12680 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) {
12681 LDKThirtyTwoBytes channel_id_arg_ref;
12682 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12683 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12684 LDKSignature signature_arg_ref;
12685 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12686 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12687 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
12688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12690 long ret_ref = (long)ret_var.inner;
12691 if (ret_var.is_owned) {
12697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12698 LDKClosingSigned orig_conv;
12699 orig_conv.inner = (void*)(orig & (~1));
12700 orig_conv.is_owned = false;
12701 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
12702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12704 long ret_ref = (long)ret_var.inner;
12705 if (ret_var.is_owned) {
12711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12712 LDKUpdateAddHTLC this_ptr_conv;
12713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12715 UpdateAddHTLC_free(this_ptr_conv);
12718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12719 LDKUpdateAddHTLC this_ptr_conv;
12720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12721 this_ptr_conv.is_owned = false;
12722 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12723 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
12727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12728 LDKUpdateAddHTLC this_ptr_conv;
12729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12730 this_ptr_conv.is_owned = false;
12731 LDKThirtyTwoBytes val_ref;
12732 CHECK((*env)->GetArrayLength(env, val) == 32);
12733 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12734 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
12737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12738 LDKUpdateAddHTLC this_ptr_conv;
12739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12740 this_ptr_conv.is_owned = false;
12741 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
12745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12746 LDKUpdateAddHTLC this_ptr_conv;
12747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12748 this_ptr_conv.is_owned = false;
12749 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
12752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12753 LDKUpdateAddHTLC this_ptr_conv;
12754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12755 this_ptr_conv.is_owned = false;
12756 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
12760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12761 LDKUpdateAddHTLC this_ptr_conv;
12762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12763 this_ptr_conv.is_owned = false;
12764 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
12767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12768 LDKUpdateAddHTLC this_ptr_conv;
12769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12770 this_ptr_conv.is_owned = false;
12771 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12772 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
12776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12777 LDKUpdateAddHTLC this_ptr_conv;
12778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12779 this_ptr_conv.is_owned = false;
12780 LDKThirtyTwoBytes val_ref;
12781 CHECK((*env)->GetArrayLength(env, val) == 32);
12782 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12783 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
12786 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
12787 LDKUpdateAddHTLC this_ptr_conv;
12788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12789 this_ptr_conv.is_owned = false;
12790 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
12794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12795 LDKUpdateAddHTLC this_ptr_conv;
12796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12797 this_ptr_conv.is_owned = false;
12798 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
12801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12802 LDKUpdateAddHTLC orig_conv;
12803 orig_conv.inner = (void*)(orig & (~1));
12804 orig_conv.is_owned = false;
12805 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
12806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12808 long ret_ref = (long)ret_var.inner;
12809 if (ret_var.is_owned) {
12815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12816 LDKUpdateFulfillHTLC this_ptr_conv;
12817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12819 UpdateFulfillHTLC_free(this_ptr_conv);
12822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12823 LDKUpdateFulfillHTLC this_ptr_conv;
12824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12825 this_ptr_conv.is_owned = false;
12826 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12827 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
12831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12832 LDKUpdateFulfillHTLC this_ptr_conv;
12833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12834 this_ptr_conv.is_owned = false;
12835 LDKThirtyTwoBytes val_ref;
12836 CHECK((*env)->GetArrayLength(env, val) == 32);
12837 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12838 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12842 LDKUpdateFulfillHTLC this_ptr_conv;
12843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12844 this_ptr_conv.is_owned = false;
12845 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
12849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12850 LDKUpdateFulfillHTLC this_ptr_conv;
12851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12852 this_ptr_conv.is_owned = false;
12853 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
12856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
12857 LDKUpdateFulfillHTLC this_ptr_conv;
12858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12859 this_ptr_conv.is_owned = false;
12860 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12861 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
12865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12866 LDKUpdateFulfillHTLC this_ptr_conv;
12867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12868 this_ptr_conv.is_owned = false;
12869 LDKThirtyTwoBytes val_ref;
12870 CHECK((*env)->GetArrayLength(env, val) == 32);
12871 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12872 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
12875 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) {
12876 LDKThirtyTwoBytes channel_id_arg_ref;
12877 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
12878 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
12879 LDKThirtyTwoBytes payment_preimage_arg_ref;
12880 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
12881 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
12882 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
12883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12885 long ret_ref = (long)ret_var.inner;
12886 if (ret_var.is_owned) {
12892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12893 LDKUpdateFulfillHTLC orig_conv;
12894 orig_conv.inner = (void*)(orig & (~1));
12895 orig_conv.is_owned = false;
12896 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
12897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12899 long ret_ref = (long)ret_var.inner;
12900 if (ret_var.is_owned) {
12906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12907 LDKUpdateFailHTLC this_ptr_conv;
12908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12910 UpdateFailHTLC_free(this_ptr_conv);
12913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12914 LDKUpdateFailHTLC this_ptr_conv;
12915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12916 this_ptr_conv.is_owned = false;
12917 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12918 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
12922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12923 LDKUpdateFailHTLC this_ptr_conv;
12924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12925 this_ptr_conv.is_owned = false;
12926 LDKThirtyTwoBytes val_ref;
12927 CHECK((*env)->GetArrayLength(env, val) == 32);
12928 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12929 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
12932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12933 LDKUpdateFailHTLC this_ptr_conv;
12934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12935 this_ptr_conv.is_owned = false;
12936 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
12940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12941 LDKUpdateFailHTLC this_ptr_conv;
12942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12943 this_ptr_conv.is_owned = false;
12944 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
12947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12948 LDKUpdateFailHTLC orig_conv;
12949 orig_conv.inner = (void*)(orig & (~1));
12950 orig_conv.is_owned = false;
12951 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
12952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12954 long ret_ref = (long)ret_var.inner;
12955 if (ret_var.is_owned) {
12961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12962 LDKUpdateFailMalformedHTLC this_ptr_conv;
12963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12965 UpdateFailMalformedHTLC_free(this_ptr_conv);
12968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12969 LDKUpdateFailMalformedHTLC this_ptr_conv;
12970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12971 this_ptr_conv.is_owned = false;
12972 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
12977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12978 LDKUpdateFailMalformedHTLC this_ptr_conv;
12979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12980 this_ptr_conv.is_owned = false;
12981 LDKThirtyTwoBytes val_ref;
12982 CHECK((*env)->GetArrayLength(env, val) == 32);
12983 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12984 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
12987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12988 LDKUpdateFailMalformedHTLC this_ptr_conv;
12989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12990 this_ptr_conv.is_owned = false;
12991 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
12995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12996 LDKUpdateFailMalformedHTLC this_ptr_conv;
12997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12998 this_ptr_conv.is_owned = false;
12999 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
13002 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
13003 LDKUpdateFailMalformedHTLC this_ptr_conv;
13004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13005 this_ptr_conv.is_owned = false;
13006 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
13010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13011 LDKUpdateFailMalformedHTLC this_ptr_conv;
13012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13013 this_ptr_conv.is_owned = false;
13014 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13018 LDKUpdateFailMalformedHTLC orig_conv;
13019 orig_conv.inner = (void*)(orig & (~1));
13020 orig_conv.is_owned = false;
13021 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
13022 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13023 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13024 long ret_ref = (long)ret_var.inner;
13025 if (ret_var.is_owned) {
13031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13032 LDKCommitmentSigned this_ptr_conv;
13033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13035 CommitmentSigned_free(this_ptr_conv);
13038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13039 LDKCommitmentSigned this_ptr_conv;
13040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13041 this_ptr_conv.is_owned = false;
13042 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13043 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
13047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13048 LDKCommitmentSigned this_ptr_conv;
13049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13050 this_ptr_conv.is_owned = false;
13051 LDKThirtyTwoBytes val_ref;
13052 CHECK((*env)->GetArrayLength(env, val) == 32);
13053 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13054 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13058 LDKCommitmentSigned this_ptr_conv;
13059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13060 this_ptr_conv.is_owned = false;
13061 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
13062 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
13066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13067 LDKCommitmentSigned this_ptr_conv;
13068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13069 this_ptr_conv.is_owned = false;
13070 LDKSignature val_ref;
13071 CHECK((*env)->GetArrayLength(env, val) == 64);
13072 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13073 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
13077 LDKCommitmentSigned this_ptr_conv;
13078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13079 this_ptr_conv.is_owned = false;
13080 LDKCVec_SignatureZ val_constr;
13081 val_constr.datalen = (*env)->GetArrayLength(env, val);
13082 if (val_constr.datalen > 0)
13083 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13085 val_constr.data = NULL;
13086 for (size_t i = 0; i < val_constr.datalen; i++) {
13087 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
13088 LDKSignature arr_conv_8_ref;
13089 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
13090 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
13091 val_constr.data[i] = arr_conv_8_ref;
13093 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13096 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) {
13097 LDKThirtyTwoBytes channel_id_arg_ref;
13098 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13099 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13100 LDKSignature signature_arg_ref;
13101 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13102 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13103 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13104 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
13105 if (htlc_signatures_arg_constr.datalen > 0)
13106 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13108 htlc_signatures_arg_constr.data = NULL;
13109 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
13110 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
13111 LDKSignature arr_conv_8_ref;
13112 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
13113 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
13114 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
13116 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13117 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13118 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13119 long ret_ref = (long)ret_var.inner;
13120 if (ret_var.is_owned) {
13126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13127 LDKCommitmentSigned orig_conv;
13128 orig_conv.inner = (void*)(orig & (~1));
13129 orig_conv.is_owned = false;
13130 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13133 long ret_ref = (long)ret_var.inner;
13134 if (ret_var.is_owned) {
13140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13141 LDKRevokeAndACK this_ptr_conv;
13142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13144 RevokeAndACK_free(this_ptr_conv);
13147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13148 LDKRevokeAndACK this_ptr_conv;
13149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13150 this_ptr_conv.is_owned = false;
13151 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13152 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
13156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13157 LDKRevokeAndACK this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = false;
13160 LDKThirtyTwoBytes val_ref;
13161 CHECK((*env)->GetArrayLength(env, val) == 32);
13162 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13163 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
13166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
13167 LDKRevokeAndACK this_ptr_conv;
13168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13169 this_ptr_conv.is_owned = false;
13170 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13171 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
13175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13176 LDKRevokeAndACK this_ptr_conv;
13177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13178 this_ptr_conv.is_owned = false;
13179 LDKThirtyTwoBytes val_ref;
13180 CHECK((*env)->GetArrayLength(env, val) == 32);
13181 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13182 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
13185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13186 LDKRevokeAndACK this_ptr_conv;
13187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13188 this_ptr_conv.is_owned = false;
13189 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13190 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
13194 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) {
13195 LDKRevokeAndACK this_ptr_conv;
13196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13197 this_ptr_conv.is_owned = false;
13198 LDKPublicKey val_ref;
13199 CHECK((*env)->GetArrayLength(env, val) == 33);
13200 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13201 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13204 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) {
13205 LDKThirtyTwoBytes channel_id_arg_ref;
13206 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13207 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13208 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
13209 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
13210 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
13211 LDKPublicKey next_per_commitment_point_arg_ref;
13212 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
13213 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
13214 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
13215 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13216 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13217 long ret_ref = (long)ret_var.inner;
13218 if (ret_var.is_owned) {
13224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13225 LDKRevokeAndACK orig_conv;
13226 orig_conv.inner = (void*)(orig & (~1));
13227 orig_conv.is_owned = false;
13228 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
13229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13231 long ret_ref = (long)ret_var.inner;
13232 if (ret_var.is_owned) {
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13239 LDKUpdateFee this_ptr_conv;
13240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13242 UpdateFee_free(this_ptr_conv);
13245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13246 LDKUpdateFee this_ptr_conv;
13247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13248 this_ptr_conv.is_owned = false;
13249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
13254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13255 LDKUpdateFee this_ptr_conv;
13256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13257 this_ptr_conv.is_owned = false;
13258 LDKThirtyTwoBytes val_ref;
13259 CHECK((*env)->GetArrayLength(env, val) == 32);
13260 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13261 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
13264 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
13265 LDKUpdateFee this_ptr_conv;
13266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13267 this_ptr_conv.is_owned = false;
13268 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
13272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13273 LDKUpdateFee this_ptr_conv;
13274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13275 this_ptr_conv.is_owned = false;
13276 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
13279 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) {
13280 LDKThirtyTwoBytes channel_id_arg_ref;
13281 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13282 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13283 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
13284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13286 long ret_ref = (long)ret_var.inner;
13287 if (ret_var.is_owned) {
13293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13294 LDKUpdateFee orig_conv;
13295 orig_conv.inner = (void*)(orig & (~1));
13296 orig_conv.is_owned = false;
13297 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
13298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13300 long ret_ref = (long)ret_var.inner;
13301 if (ret_var.is_owned) {
13307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13308 LDKDataLossProtect this_ptr_conv;
13309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13311 DataLossProtect_free(this_ptr_conv);
13314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
13315 LDKDataLossProtect this_ptr_conv;
13316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13317 this_ptr_conv.is_owned = false;
13318 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13319 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
13323 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) {
13324 LDKDataLossProtect this_ptr_conv;
13325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13326 this_ptr_conv.is_owned = false;
13327 LDKThirtyTwoBytes val_ref;
13328 CHECK((*env)->GetArrayLength(env, val) == 32);
13329 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13330 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
13333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
13334 LDKDataLossProtect this_ptr_conv;
13335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13336 this_ptr_conv.is_owned = false;
13337 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13338 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
13342 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) {
13343 LDKDataLossProtect this_ptr_conv;
13344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13345 this_ptr_conv.is_owned = false;
13346 LDKPublicKey val_ref;
13347 CHECK((*env)->GetArrayLength(env, val) == 33);
13348 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13349 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
13352 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) {
13353 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
13354 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
13355 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
13356 LDKPublicKey my_current_per_commitment_point_arg_ref;
13357 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
13358 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
13359 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
13360 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13361 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13362 long ret_ref = (long)ret_var.inner;
13363 if (ret_var.is_owned) {
13369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13370 LDKDataLossProtect orig_conv;
13371 orig_conv.inner = (void*)(orig & (~1));
13372 orig_conv.is_owned = false;
13373 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
13374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13376 long ret_ref = (long)ret_var.inner;
13377 if (ret_var.is_owned) {
13383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13384 LDKChannelReestablish this_ptr_conv;
13385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13387 ChannelReestablish_free(this_ptr_conv);
13390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13391 LDKChannelReestablish this_ptr_conv;
13392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13393 this_ptr_conv.is_owned = false;
13394 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13395 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
13399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13400 LDKChannelReestablish this_ptr_conv;
13401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13402 this_ptr_conv.is_owned = false;
13403 LDKThirtyTwoBytes val_ref;
13404 CHECK((*env)->GetArrayLength(env, val) == 32);
13405 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13406 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
13409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
13410 LDKChannelReestablish this_ptr_conv;
13411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13412 this_ptr_conv.is_owned = false;
13413 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
13417 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) {
13418 LDKChannelReestablish this_ptr_conv;
13419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13420 this_ptr_conv.is_owned = false;
13421 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
13424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
13425 LDKChannelReestablish this_ptr_conv;
13426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13427 this_ptr_conv.is_owned = false;
13428 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
13432 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) {
13433 LDKChannelReestablish this_ptr_conv;
13434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13435 this_ptr_conv.is_owned = false;
13436 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
13439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13440 LDKChannelReestablish orig_conv;
13441 orig_conv.inner = (void*)(orig & (~1));
13442 orig_conv.is_owned = false;
13443 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
13444 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13445 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13446 long ret_ref = (long)ret_var.inner;
13447 if (ret_var.is_owned) {
13453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13454 LDKAnnouncementSignatures this_ptr_conv;
13455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13457 AnnouncementSignatures_free(this_ptr_conv);
13460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13461 LDKAnnouncementSignatures this_ptr_conv;
13462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13463 this_ptr_conv.is_owned = false;
13464 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13465 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
13469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13470 LDKAnnouncementSignatures this_ptr_conv;
13471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13472 this_ptr_conv.is_owned = false;
13473 LDKThirtyTwoBytes val_ref;
13474 CHECK((*env)->GetArrayLength(env, val) == 32);
13475 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13476 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
13479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13480 LDKAnnouncementSignatures this_ptr_conv;
13481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13482 this_ptr_conv.is_owned = false;
13483 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
13487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13488 LDKAnnouncementSignatures this_ptr_conv;
13489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13490 this_ptr_conv.is_owned = false;
13491 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
13494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13495 LDKAnnouncementSignatures this_ptr_conv;
13496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13497 this_ptr_conv.is_owned = false;
13498 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
13499 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
13503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13504 LDKAnnouncementSignatures this_ptr_conv;
13505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13506 this_ptr_conv.is_owned = false;
13507 LDKSignature val_ref;
13508 CHECK((*env)->GetArrayLength(env, val) == 64);
13509 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13510 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
13513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13514 LDKAnnouncementSignatures this_ptr_conv;
13515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13516 this_ptr_conv.is_owned = false;
13517 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
13518 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
13522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13523 LDKAnnouncementSignatures this_ptr_conv;
13524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13525 this_ptr_conv.is_owned = false;
13526 LDKSignature val_ref;
13527 CHECK((*env)->GetArrayLength(env, val) == 64);
13528 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13529 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
13532 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) {
13533 LDKThirtyTwoBytes channel_id_arg_ref;
13534 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
13535 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
13536 LDKSignature node_signature_arg_ref;
13537 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
13538 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
13539 LDKSignature bitcoin_signature_arg_ref;
13540 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
13541 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
13542 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
13543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13545 long ret_ref = (long)ret_var.inner;
13546 if (ret_var.is_owned) {
13552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13553 LDKAnnouncementSignatures orig_conv;
13554 orig_conv.inner = (void*)(orig & (~1));
13555 orig_conv.is_owned = false;
13556 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
13557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13559 long ret_ref = (long)ret_var.inner;
13560 if (ret_var.is_owned) {
13566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13567 if ((this_ptr & 1) != 0) return;
13568 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
13569 FREE((void*)this_ptr);
13570 NetAddress_free(this_ptr_conv);
13573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13574 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
13575 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
13576 *ret_copy = NetAddress_clone(orig_conv);
13577 long ret_ref = (long)ret_copy;
13581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
13582 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
13583 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
13584 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13585 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13586 CVec_u8Z_free(arg_var);
13590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13591 LDKu8slice ser_ref;
13592 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13593 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13594 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13595 *ret_conv = Result_read(ser_ref);
13596 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13597 return (long)ret_conv;
13600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13601 LDKUnsignedNodeAnnouncement this_ptr_conv;
13602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13604 UnsignedNodeAnnouncement_free(this_ptr_conv);
13607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
13608 LDKUnsignedNodeAnnouncement this_ptr_conv;
13609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13610 this_ptr_conv.is_owned = false;
13611 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
13612 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13613 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13614 long ret_ref = (long)ret_var.inner;
13615 if (ret_var.is_owned) {
13621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13622 LDKUnsignedNodeAnnouncement this_ptr_conv;
13623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13624 this_ptr_conv.is_owned = false;
13625 LDKNodeFeatures val_conv;
13626 val_conv.inner = (void*)(val & (~1));
13627 val_conv.is_owned = (val & 1) || (val == 0);
13628 val_conv = NodeFeatures_clone(&val_conv);
13629 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
13632 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
13633 LDKUnsignedNodeAnnouncement this_ptr_conv;
13634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13635 this_ptr_conv.is_owned = false;
13636 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
13640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13641 LDKUnsignedNodeAnnouncement this_ptr_conv;
13642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13643 this_ptr_conv.is_owned = false;
13644 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
13647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13648 LDKUnsignedNodeAnnouncement this_ptr_conv;
13649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13650 this_ptr_conv.is_owned = false;
13651 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13652 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
13656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13657 LDKUnsignedNodeAnnouncement this_ptr_conv;
13658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13659 this_ptr_conv.is_owned = false;
13660 LDKPublicKey val_ref;
13661 CHECK((*env)->GetArrayLength(env, val) == 33);
13662 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13663 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
13666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
13667 LDKUnsignedNodeAnnouncement this_ptr_conv;
13668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13669 this_ptr_conv.is_owned = false;
13670 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
13671 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
13675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13676 LDKUnsignedNodeAnnouncement this_ptr_conv;
13677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13678 this_ptr_conv.is_owned = false;
13679 LDKThreeBytes val_ref;
13680 CHECK((*env)->GetArrayLength(env, val) == 3);
13681 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
13682 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
13685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
13686 LDKUnsignedNodeAnnouncement this_ptr_conv;
13687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13688 this_ptr_conv.is_owned = false;
13689 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
13694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13695 LDKUnsignedNodeAnnouncement this_ptr_conv;
13696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13697 this_ptr_conv.is_owned = false;
13698 LDKThirtyTwoBytes val_ref;
13699 CHECK((*env)->GetArrayLength(env, val) == 32);
13700 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13701 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
13704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13705 LDKUnsignedNodeAnnouncement this_ptr_conv;
13706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13707 this_ptr_conv.is_owned = false;
13708 LDKCVec_NetAddressZ val_constr;
13709 val_constr.datalen = (*env)->GetArrayLength(env, val);
13710 if (val_constr.datalen > 0)
13711 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13713 val_constr.data = NULL;
13714 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13715 for (size_t m = 0; m < val_constr.datalen; m++) {
13716 int64_t arr_conv_12 = val_vals[m];
13717 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
13718 FREE((void*)arr_conv_12);
13719 val_constr.data[m] = arr_conv_12_conv;
13721 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13722 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
13725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13726 LDKUnsignedNodeAnnouncement orig_conv;
13727 orig_conv.inner = (void*)(orig & (~1));
13728 orig_conv.is_owned = false;
13729 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
13730 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13731 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13732 long ret_ref = (long)ret_var.inner;
13733 if (ret_var.is_owned) {
13739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13740 LDKNodeAnnouncement this_ptr_conv;
13741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13743 NodeAnnouncement_free(this_ptr_conv);
13746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
13747 LDKNodeAnnouncement this_ptr_conv;
13748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13749 this_ptr_conv.is_owned = false;
13750 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
13751 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
13755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13756 LDKNodeAnnouncement this_ptr_conv;
13757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13758 this_ptr_conv.is_owned = false;
13759 LDKSignature val_ref;
13760 CHECK((*env)->GetArrayLength(env, val) == 64);
13761 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
13762 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
13765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
13766 LDKNodeAnnouncement this_ptr_conv;
13767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13768 this_ptr_conv.is_owned = false;
13769 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
13770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13772 long ret_ref = (long)ret_var.inner;
13773 if (ret_var.is_owned) {
13779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13780 LDKNodeAnnouncement this_ptr_conv;
13781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13782 this_ptr_conv.is_owned = false;
13783 LDKUnsignedNodeAnnouncement val_conv;
13784 val_conv.inner = (void*)(val & (~1));
13785 val_conv.is_owned = (val & 1) || (val == 0);
13786 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
13787 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
13790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
13791 LDKSignature signature_arg_ref;
13792 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
13793 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
13794 LDKUnsignedNodeAnnouncement contents_arg_conv;
13795 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13796 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13797 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
13798 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
13799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13801 long ret_ref = (long)ret_var.inner;
13802 if (ret_var.is_owned) {
13808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13809 LDKNodeAnnouncement orig_conv;
13810 orig_conv.inner = (void*)(orig & (~1));
13811 orig_conv.is_owned = false;
13812 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
13813 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13814 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13815 long ret_ref = (long)ret_var.inner;
13816 if (ret_var.is_owned) {
13822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13823 LDKUnsignedChannelAnnouncement this_ptr_conv;
13824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13826 UnsignedChannelAnnouncement_free(this_ptr_conv);
13829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
13830 LDKUnsignedChannelAnnouncement this_ptr_conv;
13831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13832 this_ptr_conv.is_owned = false;
13833 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
13834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13836 long ret_ref = (long)ret_var.inner;
13837 if (ret_var.is_owned) {
13843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13844 LDKUnsignedChannelAnnouncement this_ptr_conv;
13845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13846 this_ptr_conv.is_owned = false;
13847 LDKChannelFeatures val_conv;
13848 val_conv.inner = (void*)(val & (~1));
13849 val_conv.is_owned = (val & 1) || (val == 0);
13850 val_conv = ChannelFeatures_clone(&val_conv);
13851 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
13854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13855 LDKUnsignedChannelAnnouncement this_ptr_conv;
13856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13857 this_ptr_conv.is_owned = false;
13858 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13859 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
13863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13864 LDKUnsignedChannelAnnouncement this_ptr_conv;
13865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13866 this_ptr_conv.is_owned = false;
13867 LDKThirtyTwoBytes val_ref;
13868 CHECK((*env)->GetArrayLength(env, val) == 32);
13869 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13870 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
13873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13874 LDKUnsignedChannelAnnouncement this_ptr_conv;
13875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13876 this_ptr_conv.is_owned = false;
13877 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
13881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13882 LDKUnsignedChannelAnnouncement this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
13888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
13889 LDKUnsignedChannelAnnouncement this_ptr_conv;
13890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13891 this_ptr_conv.is_owned = false;
13892 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13893 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
13897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13898 LDKUnsignedChannelAnnouncement this_ptr_conv;
13899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13900 this_ptr_conv.is_owned = false;
13901 LDKPublicKey val_ref;
13902 CHECK((*env)->GetArrayLength(env, val) == 33);
13903 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13904 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
13907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
13908 LDKUnsignedChannelAnnouncement this_ptr_conv;
13909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13910 this_ptr_conv.is_owned = false;
13911 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13912 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
13916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13917 LDKUnsignedChannelAnnouncement this_ptr_conv;
13918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13919 this_ptr_conv.is_owned = false;
13920 LDKPublicKey val_ref;
13921 CHECK((*env)->GetArrayLength(env, val) == 33);
13922 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13923 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
13926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
13927 LDKUnsignedChannelAnnouncement this_ptr_conv;
13928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13929 this_ptr_conv.is_owned = false;
13930 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13931 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
13935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13936 LDKUnsignedChannelAnnouncement this_ptr_conv;
13937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13938 this_ptr_conv.is_owned = false;
13939 LDKPublicKey val_ref;
13940 CHECK((*env)->GetArrayLength(env, val) == 33);
13941 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13942 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
13945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
13946 LDKUnsignedChannelAnnouncement this_ptr_conv;
13947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13948 this_ptr_conv.is_owned = false;
13949 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
13950 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
13954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13955 LDKUnsignedChannelAnnouncement this_ptr_conv;
13956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13957 this_ptr_conv.is_owned = false;
13958 LDKPublicKey val_ref;
13959 CHECK((*env)->GetArrayLength(env, val) == 33);
13960 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
13961 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
13964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13965 LDKUnsignedChannelAnnouncement orig_conv;
13966 orig_conv.inner = (void*)(orig & (~1));
13967 orig_conv.is_owned = false;
13968 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
13969 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13970 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13971 long ret_ref = (long)ret_var.inner;
13972 if (ret_var.is_owned) {
13978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13979 LDKChannelAnnouncement this_ptr_conv;
13980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13982 ChannelAnnouncement_free(this_ptr_conv);
13985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
13986 LDKChannelAnnouncement this_ptr_conv;
13987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13988 this_ptr_conv.is_owned = false;
13989 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
13990 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
13994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13995 LDKChannelAnnouncement this_ptr_conv;
13996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13997 this_ptr_conv.is_owned = false;
13998 LDKSignature val_ref;
13999 CHECK((*env)->GetArrayLength(env, val) == 64);
14000 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14001 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
14004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14005 LDKChannelAnnouncement this_ptr_conv;
14006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14007 this_ptr_conv.is_owned = false;
14008 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
14009 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
14013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14014 LDKChannelAnnouncement this_ptr_conv;
14015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14016 this_ptr_conv.is_owned = false;
14017 LDKSignature val_ref;
14018 CHECK((*env)->GetArrayLength(env, val) == 64);
14019 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14020 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
14024 LDKChannelAnnouncement this_ptr_conv;
14025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14026 this_ptr_conv.is_owned = false;
14027 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
14028 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
14032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14033 LDKChannelAnnouncement this_ptr_conv;
14034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14035 this_ptr_conv.is_owned = false;
14036 LDKSignature val_ref;
14037 CHECK((*env)->GetArrayLength(env, val) == 64);
14038 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14039 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
14043 LDKChannelAnnouncement this_ptr_conv;
14044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14045 this_ptr_conv.is_owned = false;
14046 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
14047 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
14051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14052 LDKChannelAnnouncement this_ptr_conv;
14053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14054 this_ptr_conv.is_owned = false;
14055 LDKSignature val_ref;
14056 CHECK((*env)->GetArrayLength(env, val) == 64);
14057 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14058 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14062 LDKChannelAnnouncement this_ptr_conv;
14063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14064 this_ptr_conv.is_owned = false;
14065 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14066 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14067 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14068 long ret_ref = (long)ret_var.inner;
14069 if (ret_var.is_owned) {
14075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14076 LDKChannelAnnouncement this_ptr_conv;
14077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14078 this_ptr_conv.is_owned = false;
14079 LDKUnsignedChannelAnnouncement val_conv;
14080 val_conv.inner = (void*)(val & (~1));
14081 val_conv.is_owned = (val & 1) || (val == 0);
14082 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14083 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14086 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) {
14087 LDKSignature node_signature_1_arg_ref;
14088 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
14089 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
14090 LDKSignature node_signature_2_arg_ref;
14091 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
14092 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
14093 LDKSignature bitcoin_signature_1_arg_ref;
14094 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
14095 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
14096 LDKSignature bitcoin_signature_2_arg_ref;
14097 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
14098 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
14099 LDKUnsignedChannelAnnouncement contents_arg_conv;
14100 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14101 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14102 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14103 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);
14104 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14105 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14106 long ret_ref = (long)ret_var.inner;
14107 if (ret_var.is_owned) {
14113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14114 LDKChannelAnnouncement orig_conv;
14115 orig_conv.inner = (void*)(orig & (~1));
14116 orig_conv.is_owned = false;
14117 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14118 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14119 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14120 long ret_ref = (long)ret_var.inner;
14121 if (ret_var.is_owned) {
14127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14128 LDKUnsignedChannelUpdate this_ptr_conv;
14129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14131 UnsignedChannelUpdate_free(this_ptr_conv);
14134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14135 LDKUnsignedChannelUpdate this_ptr_conv;
14136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14137 this_ptr_conv.is_owned = false;
14138 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
14143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14144 LDKUnsignedChannelUpdate this_ptr_conv;
14145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14146 this_ptr_conv.is_owned = false;
14147 LDKThirtyTwoBytes val_ref;
14148 CHECK((*env)->GetArrayLength(env, val) == 32);
14149 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14150 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
14153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14154 LDKUnsignedChannelUpdate this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = false;
14157 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14162 LDKUnsignedChannelUpdate this_ptr_conv;
14163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14164 this_ptr_conv.is_owned = false;
14165 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
14168 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
14169 LDKUnsignedChannelUpdate this_ptr_conv;
14170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14171 this_ptr_conv.is_owned = false;
14172 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
14176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14177 LDKUnsignedChannelUpdate this_ptr_conv;
14178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14179 this_ptr_conv.is_owned = false;
14180 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
14183 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
14184 LDKUnsignedChannelUpdate this_ptr_conv;
14185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14186 this_ptr_conv.is_owned = false;
14187 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
14191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
14192 LDKUnsignedChannelUpdate this_ptr_conv;
14193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14194 this_ptr_conv.is_owned = false;
14195 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
14198 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
14199 LDKUnsignedChannelUpdate this_ptr_conv;
14200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14201 this_ptr_conv.is_owned = false;
14202 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
14206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14207 LDKUnsignedChannelUpdate this_ptr_conv;
14208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14209 this_ptr_conv.is_owned = false;
14210 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
14213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14214 LDKUnsignedChannelUpdate this_ptr_conv;
14215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14216 this_ptr_conv.is_owned = false;
14217 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
14221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14222 LDKUnsignedChannelUpdate this_ptr_conv;
14223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14224 this_ptr_conv.is_owned = false;
14225 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
14228 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14229 LDKUnsignedChannelUpdate this_ptr_conv;
14230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14231 this_ptr_conv.is_owned = false;
14232 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
14236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14237 LDKUnsignedChannelUpdate this_ptr_conv;
14238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14239 this_ptr_conv.is_owned = false;
14240 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
14243 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
14244 LDKUnsignedChannelUpdate this_ptr_conv;
14245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14246 this_ptr_conv.is_owned = false;
14247 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
14251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14252 LDKUnsignedChannelUpdate this_ptr_conv;
14253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14254 this_ptr_conv.is_owned = false;
14255 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
14258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14259 LDKUnsignedChannelUpdate orig_conv;
14260 orig_conv.inner = (void*)(orig & (~1));
14261 orig_conv.is_owned = false;
14262 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
14263 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14264 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14265 long ret_ref = (long)ret_var.inner;
14266 if (ret_var.is_owned) {
14272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14273 LDKChannelUpdate this_ptr_conv;
14274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14276 ChannelUpdate_free(this_ptr_conv);
14279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
14280 LDKChannelUpdate this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
14284 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
14288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14289 LDKChannelUpdate this_ptr_conv;
14290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14291 this_ptr_conv.is_owned = false;
14292 LDKSignature val_ref;
14293 CHECK((*env)->GetArrayLength(env, val) == 64);
14294 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
14295 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
14298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
14299 LDKChannelUpdate this_ptr_conv;
14300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14301 this_ptr_conv.is_owned = false;
14302 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
14303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14305 long ret_ref = (long)ret_var.inner;
14306 if (ret_var.is_owned) {
14312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14313 LDKChannelUpdate this_ptr_conv;
14314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14315 this_ptr_conv.is_owned = false;
14316 LDKUnsignedChannelUpdate val_conv;
14317 val_conv.inner = (void*)(val & (~1));
14318 val_conv.is_owned = (val & 1) || (val == 0);
14319 val_conv = UnsignedChannelUpdate_clone(&val_conv);
14320 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
14323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
14324 LDKSignature signature_arg_ref;
14325 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
14326 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
14327 LDKUnsignedChannelUpdate contents_arg_conv;
14328 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14329 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14330 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
14331 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
14332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14334 long ret_ref = (long)ret_var.inner;
14335 if (ret_var.is_owned) {
14341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14342 LDKChannelUpdate orig_conv;
14343 orig_conv.inner = (void*)(orig & (~1));
14344 orig_conv.is_owned = false;
14345 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
14346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14348 long ret_ref = (long)ret_var.inner;
14349 if (ret_var.is_owned) {
14355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14356 LDKQueryChannelRange this_ptr_conv;
14357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14359 QueryChannelRange_free(this_ptr_conv);
14362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14363 LDKQueryChannelRange this_ptr_conv;
14364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14365 this_ptr_conv.is_owned = false;
14366 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14367 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
14371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14372 LDKQueryChannelRange this_ptr_conv;
14373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14374 this_ptr_conv.is_owned = false;
14375 LDKThirtyTwoBytes val_ref;
14376 CHECK((*env)->GetArrayLength(env, val) == 32);
14377 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14378 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14381 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
14382 LDKQueryChannelRange this_ptr_conv;
14383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14384 this_ptr_conv.is_owned = false;
14385 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
14389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14390 LDKQueryChannelRange this_ptr_conv;
14391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14392 this_ptr_conv.is_owned = false;
14393 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
14396 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
14397 LDKQueryChannelRange this_ptr_conv;
14398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14399 this_ptr_conv.is_owned = false;
14400 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
14404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14405 LDKQueryChannelRange this_ptr_conv;
14406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14407 this_ptr_conv.is_owned = false;
14408 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14411 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) {
14412 LDKThirtyTwoBytes chain_hash_arg_ref;
14413 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
14414 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
14415 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
14416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14418 long ret_ref = (long)ret_var.inner;
14419 if (ret_var.is_owned) {
14425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14426 LDKQueryChannelRange orig_conv;
14427 orig_conv.inner = (void*)(orig & (~1));
14428 orig_conv.is_owned = false;
14429 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
14430 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14431 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14432 long ret_ref = (long)ret_var.inner;
14433 if (ret_var.is_owned) {
14439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14440 LDKReplyChannelRange this_ptr_conv;
14441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14443 ReplyChannelRange_free(this_ptr_conv);
14446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14447 LDKReplyChannelRange this_ptr_conv;
14448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14449 this_ptr_conv.is_owned = false;
14450 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14451 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
14455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14456 LDKReplyChannelRange this_ptr_conv;
14457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14458 this_ptr_conv.is_owned = false;
14459 LDKThirtyTwoBytes val_ref;
14460 CHECK((*env)->GetArrayLength(env, val) == 32);
14461 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14462 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14465 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
14466 LDKReplyChannelRange this_ptr_conv;
14467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14468 this_ptr_conv.is_owned = false;
14469 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
14473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14474 LDKReplyChannelRange this_ptr_conv;
14475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14476 this_ptr_conv.is_owned = false;
14477 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
14480 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
14481 LDKReplyChannelRange this_ptr_conv;
14482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14483 this_ptr_conv.is_owned = false;
14484 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
14488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14489 LDKReplyChannelRange this_ptr_conv;
14490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14491 this_ptr_conv.is_owned = false;
14492 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
14496 LDKReplyChannelRange this_ptr_conv;
14497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14498 this_ptr_conv.is_owned = false;
14499 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
14503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14504 LDKReplyChannelRange this_ptr_conv;
14505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14506 this_ptr_conv.is_owned = false;
14507 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
14510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14511 LDKReplyChannelRange this_ptr_conv;
14512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14513 this_ptr_conv.is_owned = false;
14514 LDKCVec_u64Z val_constr;
14515 val_constr.datalen = (*env)->GetArrayLength(env, val);
14516 if (val_constr.datalen > 0)
14517 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14519 val_constr.data = NULL;
14520 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14521 for (size_t g = 0; g < val_constr.datalen; g++) {
14522 int64_t arr_conv_6 = val_vals[g];
14523 val_constr.data[g] = arr_conv_6;
14525 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14526 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
14529 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) {
14530 LDKThirtyTwoBytes chain_hash_arg_ref;
14531 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
14532 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
14533 LDKCVec_u64Z short_channel_ids_arg_constr;
14534 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
14535 if (short_channel_ids_arg_constr.datalen > 0)
14536 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14538 short_channel_ids_arg_constr.data = NULL;
14539 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
14540 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
14541 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
14542 short_channel_ids_arg_constr.data[g] = arr_conv_6;
14544 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
14545 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
14546 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14547 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14548 long ret_ref = (long)ret_var.inner;
14549 if (ret_var.is_owned) {
14555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14556 LDKReplyChannelRange orig_conv;
14557 orig_conv.inner = (void*)(orig & (~1));
14558 orig_conv.is_owned = false;
14559 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
14560 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14561 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14562 long ret_ref = (long)ret_var.inner;
14563 if (ret_var.is_owned) {
14569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14570 LDKQueryShortChannelIds this_ptr_conv;
14571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14573 QueryShortChannelIds_free(this_ptr_conv);
14576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14577 LDKQueryShortChannelIds this_ptr_conv;
14578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14579 this_ptr_conv.is_owned = false;
14580 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14581 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
14585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14586 LDKQueryShortChannelIds this_ptr_conv;
14587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14588 this_ptr_conv.is_owned = false;
14589 LDKThirtyTwoBytes val_ref;
14590 CHECK((*env)->GetArrayLength(env, val) == 32);
14591 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14592 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
14595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14596 LDKQueryShortChannelIds this_ptr_conv;
14597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14598 this_ptr_conv.is_owned = false;
14599 LDKCVec_u64Z val_constr;
14600 val_constr.datalen = (*env)->GetArrayLength(env, val);
14601 if (val_constr.datalen > 0)
14602 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14604 val_constr.data = NULL;
14605 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14606 for (size_t g = 0; g < val_constr.datalen; g++) {
14607 int64_t arr_conv_6 = val_vals[g];
14608 val_constr.data[g] = arr_conv_6;
14610 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14611 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
14614 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) {
14615 LDKThirtyTwoBytes chain_hash_arg_ref;
14616 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
14617 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
14618 LDKCVec_u64Z short_channel_ids_arg_constr;
14619 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
14620 if (short_channel_ids_arg_constr.datalen > 0)
14621 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14623 short_channel_ids_arg_constr.data = NULL;
14624 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
14625 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
14626 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
14627 short_channel_ids_arg_constr.data[g] = arr_conv_6;
14629 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
14630 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
14631 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14632 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14633 long ret_ref = (long)ret_var.inner;
14634 if (ret_var.is_owned) {
14640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14641 LDKQueryShortChannelIds orig_conv;
14642 orig_conv.inner = (void*)(orig & (~1));
14643 orig_conv.is_owned = false;
14644 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
14645 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14646 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14647 long ret_ref = (long)ret_var.inner;
14648 if (ret_var.is_owned) {
14654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14655 LDKReplyShortChannelIdsEnd this_ptr_conv;
14656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14658 ReplyShortChannelIdsEnd_free(this_ptr_conv);
14661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14662 LDKReplyShortChannelIdsEnd this_ptr_conv;
14663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14664 this_ptr_conv.is_owned = false;
14665 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14666 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
14670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14671 LDKReplyShortChannelIdsEnd this_ptr_conv;
14672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14673 this_ptr_conv.is_owned = false;
14674 LDKThirtyTwoBytes val_ref;
14675 CHECK((*env)->GetArrayLength(env, val) == 32);
14676 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14677 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
14680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
14681 LDKReplyShortChannelIdsEnd this_ptr_conv;
14682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14683 this_ptr_conv.is_owned = false;
14684 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
14688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14689 LDKReplyShortChannelIdsEnd this_ptr_conv;
14690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14691 this_ptr_conv.is_owned = false;
14692 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
14695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
14696 LDKThirtyTwoBytes chain_hash_arg_ref;
14697 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
14698 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
14699 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
14700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14702 long ret_ref = (long)ret_var.inner;
14703 if (ret_var.is_owned) {
14709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14710 LDKReplyShortChannelIdsEnd orig_conv;
14711 orig_conv.inner = (void*)(orig & (~1));
14712 orig_conv.is_owned = false;
14713 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
14714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14716 long ret_ref = (long)ret_var.inner;
14717 if (ret_var.is_owned) {
14723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14724 LDKGossipTimestampFilter this_ptr_conv;
14725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14727 GossipTimestampFilter_free(this_ptr_conv);
14730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14731 LDKGossipTimestampFilter this_ptr_conv;
14732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14733 this_ptr_conv.is_owned = false;
14734 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14735 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
14739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14740 LDKGossipTimestampFilter this_ptr_conv;
14741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14742 this_ptr_conv.is_owned = false;
14743 LDKThirtyTwoBytes val_ref;
14744 CHECK((*env)->GetArrayLength(env, val) == 32);
14745 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14746 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
14749 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
14750 LDKGossipTimestampFilter this_ptr_conv;
14751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14752 this_ptr_conv.is_owned = false;
14753 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
14757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14758 LDKGossipTimestampFilter this_ptr_conv;
14759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14760 this_ptr_conv.is_owned = false;
14761 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
14764 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
14765 LDKGossipTimestampFilter this_ptr_conv;
14766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14767 this_ptr_conv.is_owned = false;
14768 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
14772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14773 LDKGossipTimestampFilter this_ptr_conv;
14774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14775 this_ptr_conv.is_owned = false;
14776 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
14779 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) {
14780 LDKThirtyTwoBytes chain_hash_arg_ref;
14781 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
14782 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
14783 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
14784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14786 long ret_ref = (long)ret_var.inner;
14787 if (ret_var.is_owned) {
14793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14794 LDKGossipTimestampFilter orig_conv;
14795 orig_conv.inner = (void*)(orig & (~1));
14796 orig_conv.is_owned = false;
14797 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
14798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14800 long ret_ref = (long)ret_var.inner;
14801 if (ret_var.is_owned) {
14807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14808 if ((this_ptr & 1) != 0) return;
14809 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
14810 FREE((void*)this_ptr);
14811 ErrorAction_free(this_ptr_conv);
14814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14815 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
14816 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14817 *ret_copy = ErrorAction_clone(orig_conv);
14818 long ret_ref = (long)ret_copy;
14822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14823 LDKLightningError this_ptr_conv;
14824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14826 LightningError_free(this_ptr_conv);
14829 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
14830 LDKLightningError this_ptr_conv;
14831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14832 this_ptr_conv.is_owned = false;
14833 LDKStr _str = LightningError_get_err(&this_ptr_conv);
14834 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
14838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14839 LDKLightningError this_ptr_conv;
14840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14841 this_ptr_conv.is_owned = false;
14842 LDKCVec_u8Z val_ref;
14843 val_ref.datalen = (*env)->GetArrayLength(env, val);
14844 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14845 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
14846 LightningError_set_err(&this_ptr_conv, val_ref);
14849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
14850 LDKLightningError this_ptr_conv;
14851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14852 this_ptr_conv.is_owned = false;
14853 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14854 *ret_copy = LightningError_get_action(&this_ptr_conv);
14855 long ret_ref = (long)ret_copy;
14859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14860 LDKLightningError this_ptr_conv;
14861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14862 this_ptr_conv.is_owned = false;
14863 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
14865 LightningError_set_action(&this_ptr_conv, val_conv);
14868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
14869 LDKCVec_u8Z err_arg_ref;
14870 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
14871 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14872 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
14873 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
14874 FREE((void*)action_arg);
14875 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
14876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14878 long ret_ref = (long)ret_var.inner;
14879 if (ret_var.is_owned) {
14885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14886 LDKLightningError orig_conv;
14887 orig_conv.inner = (void*)(orig & (~1));
14888 orig_conv.is_owned = false;
14889 LDKLightningError ret_var = LightningError_clone(&orig_conv);
14890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14892 long ret_ref = (long)ret_var.inner;
14893 if (ret_var.is_owned) {
14899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14900 LDKCommitmentUpdate this_ptr_conv;
14901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14903 CommitmentUpdate_free(this_ptr_conv);
14906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14907 LDKCommitmentUpdate this_ptr_conv;
14908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14909 this_ptr_conv.is_owned = false;
14910 LDKCVec_UpdateAddHTLCZ val_constr;
14911 val_constr.datalen = (*env)->GetArrayLength(env, val);
14912 if (val_constr.datalen > 0)
14913 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14915 val_constr.data = NULL;
14916 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14917 for (size_t p = 0; p < val_constr.datalen; p++) {
14918 int64_t arr_conv_15 = val_vals[p];
14919 LDKUpdateAddHTLC arr_conv_15_conv;
14920 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
14921 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
14922 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
14923 val_constr.data[p] = arr_conv_15_conv;
14925 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14926 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
14929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14930 LDKCommitmentUpdate this_ptr_conv;
14931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14932 this_ptr_conv.is_owned = false;
14933 LDKCVec_UpdateFulfillHTLCZ val_constr;
14934 val_constr.datalen = (*env)->GetArrayLength(env, val);
14935 if (val_constr.datalen > 0)
14936 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14938 val_constr.data = NULL;
14939 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14940 for (size_t t = 0; t < val_constr.datalen; t++) {
14941 int64_t arr_conv_19 = val_vals[t];
14942 LDKUpdateFulfillHTLC arr_conv_19_conv;
14943 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
14944 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
14945 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
14946 val_constr.data[t] = arr_conv_19_conv;
14948 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14949 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
14952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
14953 LDKCommitmentUpdate this_ptr_conv;
14954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14955 this_ptr_conv.is_owned = false;
14956 LDKCVec_UpdateFailHTLCZ val_constr;
14957 val_constr.datalen = (*env)->GetArrayLength(env, val);
14958 if (val_constr.datalen > 0)
14959 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14961 val_constr.data = NULL;
14962 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14963 for (size_t q = 0; q < val_constr.datalen; q++) {
14964 int64_t arr_conv_16 = val_vals[q];
14965 LDKUpdateFailHTLC arr_conv_16_conv;
14966 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
14967 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
14968 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
14969 val_constr.data[q] = arr_conv_16_conv;
14971 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14972 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
14975 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) {
14976 LDKCommitmentUpdate this_ptr_conv;
14977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14978 this_ptr_conv.is_owned = false;
14979 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
14980 val_constr.datalen = (*env)->GetArrayLength(env, val);
14981 if (val_constr.datalen > 0)
14982 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14984 val_constr.data = NULL;
14985 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
14986 for (size_t z = 0; z < val_constr.datalen; z++) {
14987 int64_t arr_conv_25 = val_vals[z];
14988 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
14989 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
14990 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
14991 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
14992 val_constr.data[z] = arr_conv_25_conv;
14994 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
14995 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
14998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
14999 LDKCommitmentUpdate this_ptr_conv;
15000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15001 this_ptr_conv.is_owned = false;
15002 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
15003 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15004 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15005 long ret_ref = (long)ret_var.inner;
15006 if (ret_var.is_owned) {
15012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15013 LDKCommitmentUpdate this_ptr_conv;
15014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15015 this_ptr_conv.is_owned = false;
15016 LDKUpdateFee val_conv;
15017 val_conv.inner = (void*)(val & (~1));
15018 val_conv.is_owned = (val & 1) || (val == 0);
15019 val_conv = UpdateFee_clone(&val_conv);
15020 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
15023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
15024 LDKCommitmentUpdate this_ptr_conv;
15025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15026 this_ptr_conv.is_owned = false;
15027 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15030 long ret_ref = (long)ret_var.inner;
15031 if (ret_var.is_owned) {
15037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15038 LDKCommitmentUpdate this_ptr_conv;
15039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15040 this_ptr_conv.is_owned = false;
15041 LDKCommitmentSigned val_conv;
15042 val_conv.inner = (void*)(val & (~1));
15043 val_conv.is_owned = (val & 1) || (val == 0);
15044 val_conv = CommitmentSigned_clone(&val_conv);
15045 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15048 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) {
15049 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15050 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
15051 if (update_add_htlcs_arg_constr.datalen > 0)
15052 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15054 update_add_htlcs_arg_constr.data = NULL;
15055 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
15056 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15057 int64_t arr_conv_15 = update_add_htlcs_arg_vals[p];
15058 LDKUpdateAddHTLC arr_conv_15_conv;
15059 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
15060 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
15061 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
15062 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
15064 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
15065 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15066 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
15067 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15068 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15070 update_fulfill_htlcs_arg_constr.data = NULL;
15071 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
15072 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15073 int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
15074 LDKUpdateFulfillHTLC arr_conv_19_conv;
15075 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
15076 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
15077 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
15078 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
15080 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
15081 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15082 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
15083 if (update_fail_htlcs_arg_constr.datalen > 0)
15084 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15086 update_fail_htlcs_arg_constr.data = NULL;
15087 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
15088 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15089 int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
15090 LDKUpdateFailHTLC arr_conv_16_conv;
15091 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
15092 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
15093 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
15094 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
15096 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
15097 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15098 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
15099 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15100 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15102 update_fail_malformed_htlcs_arg_constr.data = NULL;
15103 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
15104 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15105 int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15106 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
15107 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
15108 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
15109 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
15110 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
15112 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
15113 LDKUpdateFee update_fee_arg_conv;
15114 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15115 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15116 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15117 LDKCommitmentSigned commitment_signed_arg_conv;
15118 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15119 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15120 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15121 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);
15122 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15123 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15124 long ret_ref = (long)ret_var.inner;
15125 if (ret_var.is_owned) {
15131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15132 LDKCommitmentUpdate orig_conv;
15133 orig_conv.inner = (void*)(orig & (~1));
15134 orig_conv.is_owned = false;
15135 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15138 long ret_ref = (long)ret_var.inner;
15139 if (ret_var.is_owned) {
15145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15146 if ((this_ptr & 1) != 0) return;
15147 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
15148 FREE((void*)this_ptr);
15149 HTLCFailChannelUpdate_free(this_ptr_conv);
15152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15153 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
15154 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
15155 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
15156 long ret_ref = (long)ret_copy;
15160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15161 if ((this_ptr & 1) != 0) return;
15162 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
15163 FREE((void*)this_ptr);
15164 ChannelMessageHandler_free(this_ptr_conv);
15167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15168 if ((this_ptr & 1) != 0) return;
15169 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
15170 FREE((void*)this_ptr);
15171 RoutingMessageHandler_free(this_ptr_conv);
15174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
15175 LDKAcceptChannel obj_conv;
15176 obj_conv.inner = (void*)(obj & (~1));
15177 obj_conv.is_owned = false;
15178 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
15179 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15180 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15181 CVec_u8Z_free(arg_var);
15185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15186 LDKu8slice ser_ref;
15187 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15188 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15189 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15190 *ret_conv = AcceptChannel_read(ser_ref);
15191 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15192 return (long)ret_conv;
15195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
15196 LDKAnnouncementSignatures obj_conv;
15197 obj_conv.inner = (void*)(obj & (~1));
15198 obj_conv.is_owned = false;
15199 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
15200 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15201 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15202 CVec_u8Z_free(arg_var);
15206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15207 LDKu8slice ser_ref;
15208 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15209 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15210 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15211 *ret_conv = AnnouncementSignatures_read(ser_ref);
15212 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15213 return (long)ret_conv;
15216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
15217 LDKChannelReestablish obj_conv;
15218 obj_conv.inner = (void*)(obj & (~1));
15219 obj_conv.is_owned = false;
15220 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
15221 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15222 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15223 CVec_u8Z_free(arg_var);
15227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15228 LDKu8slice ser_ref;
15229 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15230 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15231 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15232 *ret_conv = ChannelReestablish_read(ser_ref);
15233 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15234 return (long)ret_conv;
15237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
15238 LDKClosingSigned obj_conv;
15239 obj_conv.inner = (void*)(obj & (~1));
15240 obj_conv.is_owned = false;
15241 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
15242 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15243 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15244 CVec_u8Z_free(arg_var);
15248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15249 LDKu8slice ser_ref;
15250 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15251 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15252 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15253 *ret_conv = ClosingSigned_read(ser_ref);
15254 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15255 return (long)ret_conv;
15258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
15259 LDKCommitmentSigned obj_conv;
15260 obj_conv.inner = (void*)(obj & (~1));
15261 obj_conv.is_owned = false;
15262 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
15263 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15264 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15265 CVec_u8Z_free(arg_var);
15269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15270 LDKu8slice ser_ref;
15271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15273 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15274 *ret_conv = CommitmentSigned_read(ser_ref);
15275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15276 return (long)ret_conv;
15279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
15280 LDKFundingCreated obj_conv;
15281 obj_conv.inner = (void*)(obj & (~1));
15282 obj_conv.is_owned = false;
15283 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
15284 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15285 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15286 CVec_u8Z_free(arg_var);
15290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15291 LDKu8slice ser_ref;
15292 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15293 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15294 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15295 *ret_conv = FundingCreated_read(ser_ref);
15296 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15297 return (long)ret_conv;
15300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
15301 LDKFundingSigned obj_conv;
15302 obj_conv.inner = (void*)(obj & (~1));
15303 obj_conv.is_owned = false;
15304 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
15305 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15306 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15307 CVec_u8Z_free(arg_var);
15311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15312 LDKu8slice ser_ref;
15313 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15314 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15315 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
15316 *ret_conv = FundingSigned_read(ser_ref);
15317 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15318 return (long)ret_conv;
15321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
15322 LDKFundingLocked obj_conv;
15323 obj_conv.inner = (void*)(obj & (~1));
15324 obj_conv.is_owned = false;
15325 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
15326 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15327 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15328 CVec_u8Z_free(arg_var);
15332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15333 LDKu8slice ser_ref;
15334 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15335 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15336 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15337 *ret_conv = FundingLocked_read(ser_ref);
15338 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15339 return (long)ret_conv;
15342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
15344 obj_conv.inner = (void*)(obj & (~1));
15345 obj_conv.is_owned = false;
15346 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
15347 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15348 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15349 CVec_u8Z_free(arg_var);
15353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15354 LDKu8slice ser_ref;
15355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15357 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15358 *ret_conv = Init_read(ser_ref);
15359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15360 return (long)ret_conv;
15363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
15364 LDKOpenChannel obj_conv;
15365 obj_conv.inner = (void*)(obj & (~1));
15366 obj_conv.is_owned = false;
15367 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
15368 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15369 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15370 CVec_u8Z_free(arg_var);
15374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15375 LDKu8slice ser_ref;
15376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15378 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15379 *ret_conv = OpenChannel_read(ser_ref);
15380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15381 return (long)ret_conv;
15384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
15385 LDKRevokeAndACK obj_conv;
15386 obj_conv.inner = (void*)(obj & (~1));
15387 obj_conv.is_owned = false;
15388 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
15389 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15390 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15391 CVec_u8Z_free(arg_var);
15395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15396 LDKu8slice ser_ref;
15397 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15398 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15399 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15400 *ret_conv = RevokeAndACK_read(ser_ref);
15401 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15402 return (long)ret_conv;
15405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
15406 LDKShutdown obj_conv;
15407 obj_conv.inner = (void*)(obj & (~1));
15408 obj_conv.is_owned = false;
15409 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
15410 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15411 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15412 CVec_u8Z_free(arg_var);
15416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15417 LDKu8slice ser_ref;
15418 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15419 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15420 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15421 *ret_conv = Shutdown_read(ser_ref);
15422 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15423 return (long)ret_conv;
15426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
15427 LDKUpdateFailHTLC obj_conv;
15428 obj_conv.inner = (void*)(obj & (~1));
15429 obj_conv.is_owned = false;
15430 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
15431 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15432 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15433 CVec_u8Z_free(arg_var);
15437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15438 LDKu8slice ser_ref;
15439 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15440 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15441 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15442 *ret_conv = UpdateFailHTLC_read(ser_ref);
15443 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15444 return (long)ret_conv;
15447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
15448 LDKUpdateFailMalformedHTLC obj_conv;
15449 obj_conv.inner = (void*)(obj & (~1));
15450 obj_conv.is_owned = false;
15451 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
15452 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15453 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15454 CVec_u8Z_free(arg_var);
15458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15459 LDKu8slice ser_ref;
15460 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15461 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15462 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15463 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
15464 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15465 return (long)ret_conv;
15468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
15469 LDKUpdateFee obj_conv;
15470 obj_conv.inner = (void*)(obj & (~1));
15471 obj_conv.is_owned = false;
15472 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
15473 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15474 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15475 CVec_u8Z_free(arg_var);
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15480 LDKu8slice ser_ref;
15481 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15482 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15483 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15484 *ret_conv = UpdateFee_read(ser_ref);
15485 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15486 return (long)ret_conv;
15489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
15490 LDKUpdateFulfillHTLC obj_conv;
15491 obj_conv.inner = (void*)(obj & (~1));
15492 obj_conv.is_owned = false;
15493 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
15494 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15495 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15496 CVec_u8Z_free(arg_var);
15500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15501 LDKu8slice ser_ref;
15502 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15503 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15504 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15505 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
15506 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15507 return (long)ret_conv;
15510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
15511 LDKUpdateAddHTLC obj_conv;
15512 obj_conv.inner = (void*)(obj & (~1));
15513 obj_conv.is_owned = false;
15514 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
15515 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15516 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15517 CVec_u8Z_free(arg_var);
15521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15522 LDKu8slice ser_ref;
15523 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15524 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15525 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15526 *ret_conv = UpdateAddHTLC_read(ser_ref);
15527 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15528 return (long)ret_conv;
15531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
15533 obj_conv.inner = (void*)(obj & (~1));
15534 obj_conv.is_owned = false;
15535 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
15536 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15537 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15538 CVec_u8Z_free(arg_var);
15542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15543 LDKu8slice ser_ref;
15544 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15545 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15546 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15547 *ret_conv = Ping_read(ser_ref);
15548 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15549 return (long)ret_conv;
15552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
15554 obj_conv.inner = (void*)(obj & (~1));
15555 obj_conv.is_owned = false;
15556 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
15557 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15558 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15559 CVec_u8Z_free(arg_var);
15563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15564 LDKu8slice ser_ref;
15565 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15566 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15567 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15568 *ret_conv = Pong_read(ser_ref);
15569 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15570 return (long)ret_conv;
15573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
15574 LDKUnsignedChannelAnnouncement obj_conv;
15575 obj_conv.inner = (void*)(obj & (~1));
15576 obj_conv.is_owned = false;
15577 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
15578 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15579 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15580 CVec_u8Z_free(arg_var);
15584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15585 LDKu8slice ser_ref;
15586 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15587 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15588 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15589 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
15590 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15591 return (long)ret_conv;
15594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
15595 LDKChannelAnnouncement obj_conv;
15596 obj_conv.inner = (void*)(obj & (~1));
15597 obj_conv.is_owned = false;
15598 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
15599 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15600 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15601 CVec_u8Z_free(arg_var);
15605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15606 LDKu8slice ser_ref;
15607 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15608 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15609 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15610 *ret_conv = ChannelAnnouncement_read(ser_ref);
15611 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15612 return (long)ret_conv;
15615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15616 LDKUnsignedChannelUpdate obj_conv;
15617 obj_conv.inner = (void*)(obj & (~1));
15618 obj_conv.is_owned = false;
15619 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
15620 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15621 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15622 CVec_u8Z_free(arg_var);
15626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15627 LDKu8slice ser_ref;
15628 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15629 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15630 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15631 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
15632 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15633 return (long)ret_conv;
15636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15637 LDKChannelUpdate obj_conv;
15638 obj_conv.inner = (void*)(obj & (~1));
15639 obj_conv.is_owned = false;
15640 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
15641 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15642 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15643 CVec_u8Z_free(arg_var);
15647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15648 LDKu8slice ser_ref;
15649 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15650 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15651 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15652 *ret_conv = ChannelUpdate_read(ser_ref);
15653 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15654 return (long)ret_conv;
15657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
15658 LDKErrorMessage obj_conv;
15659 obj_conv.inner = (void*)(obj & (~1));
15660 obj_conv.is_owned = false;
15661 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
15662 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15663 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15664 CVec_u8Z_free(arg_var);
15668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15669 LDKu8slice ser_ref;
15670 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15671 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15672 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15673 *ret_conv = ErrorMessage_read(ser_ref);
15674 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15675 return (long)ret_conv;
15678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
15679 LDKUnsignedNodeAnnouncement obj_conv;
15680 obj_conv.inner = (void*)(obj & (~1));
15681 obj_conv.is_owned = false;
15682 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
15683 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15684 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15685 CVec_u8Z_free(arg_var);
15689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15690 LDKu8slice ser_ref;
15691 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15692 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15693 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15694 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
15695 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15696 return (long)ret_conv;
15699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
15700 LDKNodeAnnouncement obj_conv;
15701 obj_conv.inner = (void*)(obj & (~1));
15702 obj_conv.is_owned = false;
15703 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
15704 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15705 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15706 CVec_u8Z_free(arg_var);
15710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15711 LDKu8slice ser_ref;
15712 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15713 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15714 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15715 *ret_conv = NodeAnnouncement_read(ser_ref);
15716 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15717 return (long)ret_conv;
15720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15721 LDKu8slice ser_ref;
15722 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15723 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15724 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15725 *ret_conv = QueryShortChannelIds_read(ser_ref);
15726 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15727 return (long)ret_conv;
15730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
15731 LDKQueryShortChannelIds obj_conv;
15732 obj_conv.inner = (void*)(obj & (~1));
15733 obj_conv.is_owned = false;
15734 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
15735 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15736 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15737 CVec_u8Z_free(arg_var);
15741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15742 LDKu8slice ser_ref;
15743 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15744 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15745 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15746 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
15747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15748 return (long)ret_conv;
15751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
15752 LDKReplyShortChannelIdsEnd obj_conv;
15753 obj_conv.inner = (void*)(obj & (~1));
15754 obj_conv.is_owned = false;
15755 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
15756 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15757 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15758 CVec_u8Z_free(arg_var);
15762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15763 LDKu8slice ser_ref;
15764 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15765 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15766 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15767 *ret_conv = QueryChannelRange_read(ser_ref);
15768 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15769 return (long)ret_conv;
15772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
15773 LDKQueryChannelRange obj_conv;
15774 obj_conv.inner = (void*)(obj & (~1));
15775 obj_conv.is_owned = false;
15776 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
15777 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15778 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15779 CVec_u8Z_free(arg_var);
15783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15784 LDKu8slice ser_ref;
15785 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15786 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15787 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15788 *ret_conv = ReplyChannelRange_read(ser_ref);
15789 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15790 return (long)ret_conv;
15793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
15794 LDKReplyChannelRange obj_conv;
15795 obj_conv.inner = (void*)(obj & (~1));
15796 obj_conv.is_owned = false;
15797 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
15798 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15799 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15800 CVec_u8Z_free(arg_var);
15804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15805 LDKu8slice ser_ref;
15806 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15807 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15808 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15809 *ret_conv = GossipTimestampFilter_read(ser_ref);
15810 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15811 return (long)ret_conv;
15814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
15815 LDKGossipTimestampFilter obj_conv;
15816 obj_conv.inner = (void*)(obj & (~1));
15817 obj_conv.is_owned = false;
15818 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
15819 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15820 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15821 CVec_u8Z_free(arg_var);
15825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15826 LDKMessageHandler this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15829 MessageHandler_free(this_ptr_conv);
15832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
15833 LDKMessageHandler this_ptr_conv;
15834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15835 this_ptr_conv.is_owned = false;
15836 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
15840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15841 LDKMessageHandler this_ptr_conv;
15842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15843 this_ptr_conv.is_owned = false;
15844 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
15845 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
15846 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15847 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
15849 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
15852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
15853 LDKMessageHandler this_ptr_conv;
15854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15855 this_ptr_conv.is_owned = false;
15856 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
15860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15861 LDKMessageHandler this_ptr_conv;
15862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15863 this_ptr_conv.is_owned = false;
15864 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
15865 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
15866 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15867 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
15869 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
15872 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) {
15873 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
15874 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
15875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15876 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
15878 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
15879 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
15880 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15881 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
15883 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
15884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15886 long ret_ref = (long)ret_var.inner;
15887 if (ret_var.is_owned) {
15893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15894 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
15895 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15896 *ret = SocketDescriptor_clone(orig_conv);
15900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15901 if ((this_ptr & 1) != 0) return;
15902 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
15903 FREE((void*)this_ptr);
15904 SocketDescriptor_free(this_ptr_conv);
15907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15908 LDKPeerHandleError this_ptr_conv;
15909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15911 PeerHandleError_free(this_ptr_conv);
15914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
15915 LDKPeerHandleError this_ptr_conv;
15916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15917 this_ptr_conv.is_owned = false;
15918 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
15922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15923 LDKPeerHandleError this_ptr_conv;
15924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15925 this_ptr_conv.is_owned = false;
15926 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
15929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
15930 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
15931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15933 long ret_ref = (long)ret_var.inner;
15934 if (ret_var.is_owned) {
15940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15941 LDKPeerHandleError orig_conv;
15942 orig_conv.inner = (void*)(orig & (~1));
15943 orig_conv.is_owned = false;
15944 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
15945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15947 long ret_ref = (long)ret_var.inner;
15948 if (ret_var.is_owned) {
15954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15955 LDKPeerManager this_ptr_conv;
15956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15958 PeerManager_free(this_ptr_conv);
15961 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) {
15962 LDKMessageHandler message_handler_conv;
15963 message_handler_conv.inner = (void*)(message_handler & (~1));
15964 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
15965 // Warning: we need a move here but no clone is available for LDKMessageHandler
15966 LDKSecretKey our_node_secret_ref;
15967 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
15968 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
15969 unsigned char ephemeral_random_data_arr[32];
15970 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
15971 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
15972 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
15973 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15974 if (logger_conv.free == LDKLogger_JCalls_free) {
15975 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15976 LDKLogger_JCalls_clone(logger_conv.this_arg);
15978 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
15979 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15980 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15981 long ret_ref = (long)ret_var.inner;
15982 if (ret_var.is_owned) {
15988 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
15989 LDKPeerManager this_arg_conv;
15990 this_arg_conv.inner = (void*)(this_arg & (~1));
15991 this_arg_conv.is_owned = false;
15992 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
15993 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
15995 for (size_t i = 0; i < ret_var.datalen; i++) {
15996 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33);
15997 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
15998 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
16000 FREE(ret_var.data);
16004 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) {
16005 LDKPeerManager this_arg_conv;
16006 this_arg_conv.inner = (void*)(this_arg & (~1));
16007 this_arg_conv.is_owned = false;
16008 LDKPublicKey their_node_id_ref;
16009 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16010 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16011 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16012 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
16013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16014 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
16016 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16017 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16018 return (long)ret_conv;
16021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
16022 LDKPeerManager this_arg_conv;
16023 this_arg_conv.inner = (void*)(this_arg & (~1));
16024 this_arg_conv.is_owned = false;
16025 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16026 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
16027 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16028 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
16030 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16031 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16032 return (long)ret_conv;
16035 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) {
16036 LDKPeerManager this_arg_conv;
16037 this_arg_conv.inner = (void*)(this_arg & (~1));
16038 this_arg_conv.is_owned = false;
16039 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
16040 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16041 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16042 return (long)ret_conv;
16045 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) {
16046 LDKPeerManager this_arg_conv;
16047 this_arg_conv.inner = (void*)(this_arg & (~1));
16048 this_arg_conv.is_owned = false;
16049 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
16050 LDKu8slice data_ref;
16051 data_ref.datalen = (*env)->GetArrayLength(env, data);
16052 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
16053 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16054 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16055 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
16056 return (long)ret_conv;
16059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16060 LDKPeerManager this_arg_conv;
16061 this_arg_conv.inner = (void*)(this_arg & (~1));
16062 this_arg_conv.is_owned = false;
16063 PeerManager_process_events(&this_arg_conv);
16066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
16067 LDKPeerManager this_arg_conv;
16068 this_arg_conv.inner = (void*)(this_arg & (~1));
16069 this_arg_conv.is_owned = false;
16070 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
16071 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
16074 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) {
16075 LDKPeerManager this_arg_conv;
16076 this_arg_conv.inner = (void*)(this_arg & (~1));
16077 this_arg_conv.is_owned = false;
16078 LDKPublicKey node_id_ref;
16079 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16080 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16081 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
16084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
16085 LDKPeerManager this_arg_conv;
16086 this_arg_conv.inner = (void*)(this_arg & (~1));
16087 this_arg_conv.is_owned = false;
16088 PeerManager_timer_tick_occured(&this_arg_conv);
16091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
16092 unsigned char commitment_seed_arr[32];
16093 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
16094 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
16095 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
16096 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
16097 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
16101 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) {
16102 LDKPublicKey per_commitment_point_ref;
16103 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
16104 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
16105 unsigned char base_secret_arr[32];
16106 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
16107 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
16108 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
16109 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16110 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
16111 return (long)ret_conv;
16114 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) {
16115 LDKPublicKey per_commitment_point_ref;
16116 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
16117 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
16118 LDKPublicKey base_point_ref;
16119 CHECK((*env)->GetArrayLength(env, base_point) == 33);
16120 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
16121 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16122 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
16123 return (long)ret_conv;
16126 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) {
16127 unsigned char per_commitment_secret_arr[32];
16128 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
16129 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
16130 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
16131 unsigned char countersignatory_revocation_base_secret_arr[32];
16132 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
16133 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
16134 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
16135 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16136 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
16137 return (long)ret_conv;
16140 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) {
16141 LDKPublicKey per_commitment_point_ref;
16142 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
16143 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
16144 LDKPublicKey countersignatory_revocation_base_point_ref;
16145 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
16146 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
16147 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16148 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
16149 return (long)ret_conv;
16152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16153 LDKTxCreationKeys this_ptr_conv;
16154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16156 TxCreationKeys_free(this_ptr_conv);
16159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16160 LDKTxCreationKeys this_ptr_conv;
16161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16162 this_ptr_conv.is_owned = false;
16163 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16164 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
16168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16169 LDKTxCreationKeys this_ptr_conv;
16170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16171 this_ptr_conv.is_owned = false;
16172 LDKPublicKey val_ref;
16173 CHECK((*env)->GetArrayLength(env, val) == 33);
16174 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16175 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
16178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16179 LDKTxCreationKeys this_ptr_conv;
16180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16181 this_ptr_conv.is_owned = false;
16182 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16183 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
16187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16188 LDKTxCreationKeys this_ptr_conv;
16189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16190 this_ptr_conv.is_owned = false;
16191 LDKPublicKey val_ref;
16192 CHECK((*env)->GetArrayLength(env, val) == 33);
16193 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16194 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
16197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16198 LDKTxCreationKeys this_ptr_conv;
16199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16200 this_ptr_conv.is_owned = false;
16201 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16202 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
16206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16207 LDKTxCreationKeys this_ptr_conv;
16208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16209 this_ptr_conv.is_owned = false;
16210 LDKPublicKey val_ref;
16211 CHECK((*env)->GetArrayLength(env, val) == 33);
16212 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16213 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
16216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16217 LDKTxCreationKeys this_ptr_conv;
16218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16219 this_ptr_conv.is_owned = false;
16220 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16221 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
16225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16226 LDKTxCreationKeys this_ptr_conv;
16227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16228 this_ptr_conv.is_owned = false;
16229 LDKPublicKey val_ref;
16230 CHECK((*env)->GetArrayLength(env, val) == 33);
16231 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16232 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
16235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16236 LDKTxCreationKeys this_ptr_conv;
16237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16238 this_ptr_conv.is_owned = false;
16239 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16240 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
16244 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) {
16245 LDKTxCreationKeys this_ptr_conv;
16246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16247 this_ptr_conv.is_owned = false;
16248 LDKPublicKey val_ref;
16249 CHECK((*env)->GetArrayLength(env, val) == 33);
16250 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16251 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
16254 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) {
16255 LDKPublicKey per_commitment_point_arg_ref;
16256 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
16257 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
16258 LDKPublicKey revocation_key_arg_ref;
16259 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
16260 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
16261 LDKPublicKey broadcaster_htlc_key_arg_ref;
16262 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
16263 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
16264 LDKPublicKey countersignatory_htlc_key_arg_ref;
16265 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
16266 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
16267 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
16268 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
16269 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
16270 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);
16271 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16272 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16273 long ret_ref = (long)ret_var.inner;
16274 if (ret_var.is_owned) {
16280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16281 LDKTxCreationKeys orig_conv;
16282 orig_conv.inner = (void*)(orig & (~1));
16283 orig_conv.is_owned = false;
16284 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
16285 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16286 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16287 long ret_ref = (long)ret_var.inner;
16288 if (ret_var.is_owned) {
16294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
16295 LDKTxCreationKeys obj_conv;
16296 obj_conv.inner = (void*)(obj & (~1));
16297 obj_conv.is_owned = false;
16298 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
16299 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16300 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16301 CVec_u8Z_free(arg_var);
16305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16306 LDKu8slice ser_ref;
16307 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16308 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16309 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16310 *ret_conv = TxCreationKeys_read(ser_ref);
16311 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16312 return (long)ret_conv;
16315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16316 LDKChannelPublicKeys this_ptr_conv;
16317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16319 ChannelPublicKeys_free(this_ptr_conv);
16322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16323 LDKChannelPublicKeys this_ptr_conv;
16324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16325 this_ptr_conv.is_owned = false;
16326 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16327 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
16331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16332 LDKChannelPublicKeys this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 LDKPublicKey val_ref;
16336 CHECK((*env)->GetArrayLength(env, val) == 33);
16337 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16338 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
16341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16342 LDKChannelPublicKeys this_ptr_conv;
16343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16344 this_ptr_conv.is_owned = false;
16345 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16346 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16351 LDKChannelPublicKeys this_ptr_conv;
16352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16353 this_ptr_conv.is_owned = false;
16354 LDKPublicKey val_ref;
16355 CHECK((*env)->GetArrayLength(env, val) == 33);
16356 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16357 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
16360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16361 LDKChannelPublicKeys this_ptr_conv;
16362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16363 this_ptr_conv.is_owned = false;
16364 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16365 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
16369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16370 LDKChannelPublicKeys this_ptr_conv;
16371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16372 this_ptr_conv.is_owned = false;
16373 LDKPublicKey val_ref;
16374 CHECK((*env)->GetArrayLength(env, val) == 33);
16375 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16376 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
16379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16380 LDKChannelPublicKeys this_ptr_conv;
16381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16382 this_ptr_conv.is_owned = false;
16383 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16384 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16389 LDKChannelPublicKeys this_ptr_conv;
16390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16391 this_ptr_conv.is_owned = false;
16392 LDKPublicKey val_ref;
16393 CHECK((*env)->GetArrayLength(env, val) == 33);
16394 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16395 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16399 LDKChannelPublicKeys this_ptr_conv;
16400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16401 this_ptr_conv.is_owned = false;
16402 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16403 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16408 LDKChannelPublicKeys this_ptr_conv;
16409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16410 this_ptr_conv.is_owned = false;
16411 LDKPublicKey val_ref;
16412 CHECK((*env)->GetArrayLength(env, val) == 33);
16413 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16414 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
16417 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) {
16418 LDKPublicKey funding_pubkey_arg_ref;
16419 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
16420 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
16421 LDKPublicKey revocation_basepoint_arg_ref;
16422 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
16423 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
16424 LDKPublicKey payment_point_arg_ref;
16425 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
16426 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
16427 LDKPublicKey delayed_payment_basepoint_arg_ref;
16428 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
16429 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
16430 LDKPublicKey htlc_basepoint_arg_ref;
16431 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
16432 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
16433 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);
16434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16436 long ret_ref = (long)ret_var.inner;
16437 if (ret_var.is_owned) {
16443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16444 LDKChannelPublicKeys orig_conv;
16445 orig_conv.inner = (void*)(orig & (~1));
16446 orig_conv.is_owned = false;
16447 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
16448 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16449 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16450 long ret_ref = (long)ret_var.inner;
16451 if (ret_var.is_owned) {
16457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
16458 LDKChannelPublicKeys obj_conv;
16459 obj_conv.inner = (void*)(obj & (~1));
16460 obj_conv.is_owned = false;
16461 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
16462 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16463 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16464 CVec_u8Z_free(arg_var);
16468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16469 LDKu8slice ser_ref;
16470 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16471 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16472 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16473 *ret_conv = ChannelPublicKeys_read(ser_ref);
16474 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16475 return (long)ret_conv;
16478 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) {
16479 LDKPublicKey per_commitment_point_ref;
16480 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
16481 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
16482 LDKPublicKey broadcaster_delayed_payment_base_ref;
16483 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
16484 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
16485 LDKPublicKey broadcaster_htlc_base_ref;
16486 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
16487 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
16488 LDKPublicKey countersignatory_revocation_base_ref;
16489 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
16490 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
16491 LDKPublicKey countersignatory_htlc_base_ref;
16492 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
16493 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
16494 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16495 *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);
16496 return (long)ret_conv;
16499 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) {
16500 LDKPublicKey per_commitment_point_ref;
16501 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
16502 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
16503 LDKChannelPublicKeys broadcaster_keys_conv;
16504 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16505 broadcaster_keys_conv.is_owned = false;
16506 LDKChannelPublicKeys countersignatory_keys_conv;
16507 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16508 countersignatory_keys_conv.is_owned = false;
16509 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16510 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
16511 return (long)ret_conv;
16514 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) {
16515 LDKPublicKey revocation_key_ref;
16516 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
16517 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
16518 LDKPublicKey broadcaster_delayed_payment_key_ref;
16519 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
16520 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
16521 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
16522 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16523 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16524 CVec_u8Z_free(arg_var);
16528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16529 LDKHTLCOutputInCommitment this_ptr_conv;
16530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16532 HTLCOutputInCommitment_free(this_ptr_conv);
16535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
16536 LDKHTLCOutputInCommitment this_ptr_conv;
16537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16538 this_ptr_conv.is_owned = false;
16539 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
16543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16544 LDKHTLCOutputInCommitment this_ptr_conv;
16545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16546 this_ptr_conv.is_owned = false;
16547 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
16550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16551 LDKHTLCOutputInCommitment this_ptr_conv;
16552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16553 this_ptr_conv.is_owned = false;
16554 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
16558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16559 LDKHTLCOutputInCommitment this_ptr_conv;
16560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16561 this_ptr_conv.is_owned = false;
16562 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
16565 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
16566 LDKHTLCOutputInCommitment this_ptr_conv;
16567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16568 this_ptr_conv.is_owned = false;
16569 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
16573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16574 LDKHTLCOutputInCommitment this_ptr_conv;
16575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16576 this_ptr_conv.is_owned = false;
16577 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
16580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16581 LDKHTLCOutputInCommitment this_ptr_conv;
16582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16583 this_ptr_conv.is_owned = false;
16584 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16585 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
16589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16590 LDKHTLCOutputInCommitment this_ptr_conv;
16591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16592 this_ptr_conv.is_owned = false;
16593 LDKThirtyTwoBytes val_ref;
16594 CHECK((*env)->GetArrayLength(env, val) == 32);
16595 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16596 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
16599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16600 LDKHTLCOutputInCommitment orig_conv;
16601 orig_conv.inner = (void*)(orig & (~1));
16602 orig_conv.is_owned = false;
16603 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
16604 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16605 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16606 long ret_ref = (long)ret_var.inner;
16607 if (ret_var.is_owned) {
16613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
16614 LDKHTLCOutputInCommitment obj_conv;
16615 obj_conv.inner = (void*)(obj & (~1));
16616 obj_conv.is_owned = false;
16617 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
16618 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16619 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16620 CVec_u8Z_free(arg_var);
16624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16625 LDKu8slice ser_ref;
16626 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16627 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16628 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16629 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
16630 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16631 return (long)ret_conv;
16634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
16635 LDKHTLCOutputInCommitment htlc_conv;
16636 htlc_conv.inner = (void*)(htlc & (~1));
16637 htlc_conv.is_owned = false;
16638 LDKTxCreationKeys keys_conv;
16639 keys_conv.inner = (void*)(keys & (~1));
16640 keys_conv.is_owned = false;
16641 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
16642 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16643 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16644 CVec_u8Z_free(arg_var);
16648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
16649 LDKPublicKey broadcaster_ref;
16650 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
16651 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
16652 LDKPublicKey countersignatory_ref;
16653 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
16654 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
16655 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
16656 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16657 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16658 CVec_u8Z_free(arg_var);
16662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
16663 unsigned char prev_hash_arr[32];
16664 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
16665 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
16666 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
16667 LDKHTLCOutputInCommitment htlc_conv;
16668 htlc_conv.inner = (void*)(htlc & (~1));
16669 htlc_conv.is_owned = false;
16670 LDKPublicKey broadcaster_delayed_payment_key_ref;
16671 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
16672 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
16673 LDKPublicKey revocation_key_ref;
16674 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
16675 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
16676 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
16677 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16678 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16679 Transaction_free(arg_var);
16683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16684 LDKChannelTransactionParameters this_ptr_conv;
16685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16687 ChannelTransactionParameters_free(this_ptr_conv);
16690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
16691 LDKChannelTransactionParameters this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
16695 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16696 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16697 long ret_ref = (long)ret_var.inner;
16698 if (ret_var.is_owned) {
16704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16705 LDKChannelTransactionParameters this_ptr_conv;
16706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16707 this_ptr_conv.is_owned = false;
16708 LDKChannelPublicKeys val_conv;
16709 val_conv.inner = (void*)(val & (~1));
16710 val_conv.is_owned = (val & 1) || (val == 0);
16711 val_conv = ChannelPublicKeys_clone(&val_conv);
16712 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
16715 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16716 LDKChannelTransactionParameters this_ptr_conv;
16717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16718 this_ptr_conv.is_owned = false;
16719 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
16723 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) {
16724 LDKChannelTransactionParameters this_ptr_conv;
16725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16726 this_ptr_conv.is_owned = false;
16727 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
16730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
16731 LDKChannelTransactionParameters this_ptr_conv;
16732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16733 this_ptr_conv.is_owned = false;
16734 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
16738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16739 LDKChannelTransactionParameters this_ptr_conv;
16740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16741 this_ptr_conv.is_owned = false;
16742 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
16745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
16746 LDKChannelTransactionParameters this_ptr_conv;
16747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16748 this_ptr_conv.is_owned = false;
16749 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
16750 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16751 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16752 long ret_ref = (long)ret_var.inner;
16753 if (ret_var.is_owned) {
16759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16760 LDKChannelTransactionParameters this_ptr_conv;
16761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16762 this_ptr_conv.is_owned = false;
16763 LDKCounterpartyChannelTransactionParameters val_conv;
16764 val_conv.inner = (void*)(val & (~1));
16765 val_conv.is_owned = (val & 1) || (val == 0);
16766 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
16767 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
16770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16771 LDKChannelTransactionParameters this_ptr_conv;
16772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16773 this_ptr_conv.is_owned = false;
16774 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
16775 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16776 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16777 long ret_ref = (long)ret_var.inner;
16778 if (ret_var.is_owned) {
16784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16785 LDKChannelTransactionParameters this_ptr_conv;
16786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16787 this_ptr_conv.is_owned = false;
16788 LDKOutPoint val_conv;
16789 val_conv.inner = (void*)(val & (~1));
16790 val_conv.is_owned = (val & 1) || (val == 0);
16791 val_conv = OutPoint_clone(&val_conv);
16792 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
16795 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) {
16796 LDKChannelPublicKeys holder_pubkeys_arg_conv;
16797 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
16798 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
16799 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
16800 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
16801 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
16802 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
16803 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
16804 LDKOutPoint funding_outpoint_arg_conv;
16805 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
16806 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
16807 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
16808 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);
16809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16811 long ret_ref = (long)ret_var.inner;
16812 if (ret_var.is_owned) {
16818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16819 LDKChannelTransactionParameters orig_conv;
16820 orig_conv.inner = (void*)(orig & (~1));
16821 orig_conv.is_owned = false;
16822 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
16823 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16824 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16825 long ret_ref = (long)ret_var.inner;
16826 if (ret_var.is_owned) {
16832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16833 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16836 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
16839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
16840 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16842 this_ptr_conv.is_owned = false;
16843 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
16844 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16845 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16846 long ret_ref = (long)ret_var.inner;
16847 if (ret_var.is_owned) {
16853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16854 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16856 this_ptr_conv.is_owned = false;
16857 LDKChannelPublicKeys val_conv;
16858 val_conv.inner = (void*)(val & (~1));
16859 val_conv.is_owned = (val & 1) || (val == 0);
16860 val_conv = ChannelPublicKeys_clone(&val_conv);
16861 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
16864 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16865 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16867 this_ptr_conv.is_owned = false;
16868 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
16872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16873 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16875 this_ptr_conv.is_owned = false;
16876 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
16879 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) {
16880 LDKChannelPublicKeys pubkeys_arg_conv;
16881 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
16882 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
16883 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
16884 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
16885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16887 long ret_ref = (long)ret_var.inner;
16888 if (ret_var.is_owned) {
16894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16895 LDKCounterpartyChannelTransactionParameters orig_conv;
16896 orig_conv.inner = (void*)(orig & (~1));
16897 orig_conv.is_owned = false;
16898 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
16899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16901 long ret_ref = (long)ret_var.inner;
16902 if (ret_var.is_owned) {
16908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
16909 LDKChannelTransactionParameters this_arg_conv;
16910 this_arg_conv.inner = (void*)(this_arg & (~1));
16911 this_arg_conv.is_owned = false;
16912 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
16916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
16917 LDKChannelTransactionParameters this_arg_conv;
16918 this_arg_conv.inner = (void*)(this_arg & (~1));
16919 this_arg_conv.is_owned = false;
16920 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
16921 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16922 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16923 long ret_ref = (long)ret_var.inner;
16924 if (ret_var.is_owned) {
16930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
16931 LDKChannelTransactionParameters this_arg_conv;
16932 this_arg_conv.inner = (void*)(this_arg & (~1));
16933 this_arg_conv.is_owned = false;
16934 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
16935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16937 long ret_ref = (long)ret_var.inner;
16938 if (ret_var.is_owned) {
16944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
16945 LDKCounterpartyChannelTransactionParameters obj_conv;
16946 obj_conv.inner = (void*)(obj & (~1));
16947 obj_conv.is_owned = false;
16948 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
16949 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16950 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16951 CVec_u8Z_free(arg_var);
16955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16956 LDKu8slice ser_ref;
16957 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16958 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16959 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16960 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
16961 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16962 return (long)ret_conv;
16965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
16966 LDKChannelTransactionParameters obj_conv;
16967 obj_conv.inner = (void*)(obj & (~1));
16968 obj_conv.is_owned = false;
16969 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
16970 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16971 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16972 CVec_u8Z_free(arg_var);
16976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16977 LDKu8slice ser_ref;
16978 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16979 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16980 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16981 *ret_conv = ChannelTransactionParameters_read(ser_ref);
16982 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16983 return (long)ret_conv;
16986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16987 LDKDirectedChannelTransactionParameters this_ptr_conv;
16988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16990 DirectedChannelTransactionParameters_free(this_ptr_conv);
16993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
16994 LDKDirectedChannelTransactionParameters this_arg_conv;
16995 this_arg_conv.inner = (void*)(this_arg & (~1));
16996 this_arg_conv.is_owned = false;
16997 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
16998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17000 long ret_ref = (long)ret_var.inner;
17001 if (ret_var.is_owned) {
17007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17008 LDKDirectedChannelTransactionParameters this_arg_conv;
17009 this_arg_conv.inner = (void*)(this_arg & (~1));
17010 this_arg_conv.is_owned = false;
17011 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
17012 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17013 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17014 long ret_ref = (long)ret_var.inner;
17015 if (ret_var.is_owned) {
17021 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17022 LDKDirectedChannelTransactionParameters this_arg_conv;
17023 this_arg_conv.inner = (void*)(this_arg & (~1));
17024 this_arg_conv.is_owned = false;
17025 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
17030 LDKDirectedChannelTransactionParameters this_arg_conv;
17031 this_arg_conv.inner = (void*)(this_arg & (~1));
17032 this_arg_conv.is_owned = false;
17033 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
17038 LDKDirectedChannelTransactionParameters this_arg_conv;
17039 this_arg_conv.inner = (void*)(this_arg & (~1));
17040 this_arg_conv.is_owned = false;
17041 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17044 long ret_ref = (long)ret_var.inner;
17045 if (ret_var.is_owned) {
17051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17052 LDKHolderCommitmentTransaction this_ptr_conv;
17053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17055 HolderCommitmentTransaction_free(this_ptr_conv);
17058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
17059 LDKHolderCommitmentTransaction this_ptr_conv;
17060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17061 this_ptr_conv.is_owned = false;
17062 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
17063 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
17067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17068 LDKHolderCommitmentTransaction this_ptr_conv;
17069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17070 this_ptr_conv.is_owned = false;
17071 LDKSignature val_ref;
17072 CHECK((*env)->GetArrayLength(env, val) == 64);
17073 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17074 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
17077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17078 LDKHolderCommitmentTransaction this_ptr_conv;
17079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17080 this_ptr_conv.is_owned = false;
17081 LDKCVec_SignatureZ val_constr;
17082 val_constr.datalen = (*env)->GetArrayLength(env, val);
17083 if (val_constr.datalen > 0)
17084 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17086 val_constr.data = NULL;
17087 for (size_t i = 0; i < val_constr.datalen; i++) {
17088 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
17089 LDKSignature arr_conv_8_ref;
17090 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
17091 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
17092 val_constr.data[i] = arr_conv_8_ref;
17094 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
17097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17098 LDKHolderCommitmentTransaction orig_conv;
17099 orig_conv.inner = (void*)(orig & (~1));
17100 orig_conv.is_owned = false;
17101 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
17102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17104 long ret_ref = (long)ret_var.inner;
17105 if (ret_var.is_owned) {
17111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
17112 LDKHolderCommitmentTransaction obj_conv;
17113 obj_conv.inner = (void*)(obj & (~1));
17114 obj_conv.is_owned = false;
17115 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
17116 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17117 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17118 CVec_u8Z_free(arg_var);
17122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17123 LDKu8slice ser_ref;
17124 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17125 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17126 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
17127 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
17128 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17129 return (long)ret_conv;
17132 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) {
17133 LDKCommitmentTransaction commitment_tx_conv;
17134 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
17135 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
17136 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
17137 LDKSignature counterparty_sig_ref;
17138 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
17139 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
17140 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
17141 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
17142 if (counterparty_htlc_sigs_constr.datalen > 0)
17143 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17145 counterparty_htlc_sigs_constr.data = NULL;
17146 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
17147 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
17148 LDKSignature arr_conv_8_ref;
17149 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
17150 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
17151 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
17153 LDKPublicKey holder_funding_key_ref;
17154 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
17155 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
17156 LDKPublicKey counterparty_funding_key_ref;
17157 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
17158 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
17159 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
17160 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17161 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17162 long ret_ref = (long)ret_var.inner;
17163 if (ret_var.is_owned) {
17169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17170 LDKBuiltCommitmentTransaction this_ptr_conv;
17171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17173 BuiltCommitmentTransaction_free(this_ptr_conv);
17176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
17177 LDKBuiltCommitmentTransaction this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
17181 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17182 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17183 Transaction_free(arg_var);
17187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17188 LDKBuiltCommitmentTransaction this_ptr_conv;
17189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17190 this_ptr_conv.is_owned = false;
17191 LDKTransaction val_ref;
17192 val_ref.datalen = (*env)->GetArrayLength(env, val);
17193 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
17194 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17195 val_ref.data_is_owned = true;
17196 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
17199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17200 LDKBuiltCommitmentTransaction this_ptr_conv;
17201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17202 this_ptr_conv.is_owned = false;
17203 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
17208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17209 LDKBuiltCommitmentTransaction this_ptr_conv;
17210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17211 this_ptr_conv.is_owned = false;
17212 LDKThirtyTwoBytes val_ref;
17213 CHECK((*env)->GetArrayLength(env, val) == 32);
17214 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17215 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
17218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
17219 LDKTransaction transaction_arg_ref;
17220 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
17221 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
17222 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
17223 transaction_arg_ref.data_is_owned = true;
17224 LDKThirtyTwoBytes txid_arg_ref;
17225 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
17226 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
17227 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
17228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17230 long ret_ref = (long)ret_var.inner;
17231 if (ret_var.is_owned) {
17237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17238 LDKBuiltCommitmentTransaction orig_conv;
17239 orig_conv.inner = (void*)(orig & (~1));
17240 orig_conv.is_owned = false;
17241 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
17242 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17243 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17244 long ret_ref = (long)ret_var.inner;
17245 if (ret_var.is_owned) {
17251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
17252 LDKBuiltCommitmentTransaction obj_conv;
17253 obj_conv.inner = (void*)(obj & (~1));
17254 obj_conv.is_owned = false;
17255 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
17256 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17257 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17258 CVec_u8Z_free(arg_var);
17262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17263 LDKu8slice ser_ref;
17264 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17265 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17266 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
17267 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
17268 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17269 return (long)ret_conv;
17272 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) {
17273 LDKBuiltCommitmentTransaction this_arg_conv;
17274 this_arg_conv.inner = (void*)(this_arg & (~1));
17275 this_arg_conv.is_owned = false;
17276 LDKu8slice funding_redeemscript_ref;
17277 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
17278 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
17279 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
17280 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
17281 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
17285 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) {
17286 LDKBuiltCommitmentTransaction this_arg_conv;
17287 this_arg_conv.inner = (void*)(this_arg & (~1));
17288 this_arg_conv.is_owned = false;
17289 unsigned char funding_key_arr[32];
17290 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
17291 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
17292 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
17293 LDKu8slice funding_redeemscript_ref;
17294 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
17295 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
17296 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
17297 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
17298 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
17302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17303 LDKCommitmentTransaction this_ptr_conv;
17304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17306 CommitmentTransaction_free(this_ptr_conv);
17309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17310 LDKCommitmentTransaction orig_conv;
17311 orig_conv.inner = (void*)(orig & (~1));
17312 orig_conv.is_owned = false;
17313 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
17314 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17315 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17316 long ret_ref = (long)ret_var.inner;
17317 if (ret_var.is_owned) {
17323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
17324 LDKCommitmentTransaction obj_conv;
17325 obj_conv.inner = (void*)(obj & (~1));
17326 obj_conv.is_owned = false;
17327 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
17328 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17329 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17330 CVec_u8Z_free(arg_var);
17334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17335 LDKu8slice ser_ref;
17336 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17337 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17338 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
17339 *ret_conv = CommitmentTransaction_read(ser_ref);
17340 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17341 return (long)ret_conv;
17344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
17345 LDKCommitmentTransaction this_arg_conv;
17346 this_arg_conv.inner = (void*)(this_arg & (~1));
17347 this_arg_conv.is_owned = false;
17348 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
17352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
17353 LDKCommitmentTransaction this_arg_conv;
17354 this_arg_conv.inner = (void*)(this_arg & (~1));
17355 this_arg_conv.is_owned = false;
17356 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
17360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
17361 LDKCommitmentTransaction this_arg_conv;
17362 this_arg_conv.inner = (void*)(this_arg & (~1));
17363 this_arg_conv.is_owned = false;
17364 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
17368 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
17369 LDKCommitmentTransaction this_arg_conv;
17370 this_arg_conv.inner = (void*)(this_arg & (~1));
17371 this_arg_conv.is_owned = false;
17372 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
17376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
17377 LDKCommitmentTransaction this_arg_conv;
17378 this_arg_conv.inner = (void*)(this_arg & (~1));
17379 this_arg_conv.is_owned = false;
17380 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
17381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17383 long ret_ref = (long)ret_var.inner;
17384 if (ret_var.is_owned) {
17390 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) {
17391 LDKCommitmentTransaction this_arg_conv;
17392 this_arg_conv.inner = (void*)(this_arg & (~1));
17393 this_arg_conv.is_owned = false;
17394 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17395 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17396 channel_parameters_conv.is_owned = false;
17397 LDKChannelPublicKeys broadcaster_keys_conv;
17398 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17399 broadcaster_keys_conv.is_owned = false;
17400 LDKChannelPublicKeys countersignatory_keys_conv;
17401 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17402 countersignatory_keys_conv.is_owned = false;
17403 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
17404 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
17405 return (long)ret_conv;
17408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17409 LDKTrustedCommitmentTransaction this_ptr_conv;
17410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17412 TrustedCommitmentTransaction_free(this_ptr_conv);
17415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
17416 LDKTrustedCommitmentTransaction this_arg_conv;
17417 this_arg_conv.inner = (void*)(this_arg & (~1));
17418 this_arg_conv.is_owned = false;
17419 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
17420 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
17424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
17425 LDKTrustedCommitmentTransaction this_arg_conv;
17426 this_arg_conv.inner = (void*)(this_arg & (~1));
17427 this_arg_conv.is_owned = false;
17428 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
17429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17431 long ret_ref = (long)ret_var.inner;
17432 if (ret_var.is_owned) {
17438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
17439 LDKTrustedCommitmentTransaction this_arg_conv;
17440 this_arg_conv.inner = (void*)(this_arg & (~1));
17441 this_arg_conv.is_owned = false;
17442 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
17443 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17444 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17445 long ret_ref = (long)ret_var.inner;
17446 if (ret_var.is_owned) {
17452 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) {
17453 LDKTrustedCommitmentTransaction this_arg_conv;
17454 this_arg_conv.inner = (void*)(this_arg & (~1));
17455 this_arg_conv.is_owned = false;
17456 unsigned char htlc_base_key_arr[32];
17457 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
17458 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
17459 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
17460 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17461 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17462 channel_parameters_conv.is_owned = false;
17463 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
17464 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
17465 return (long)ret_conv;
17468 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) {
17469 LDKPublicKey broadcaster_payment_basepoint_ref;
17470 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
17471 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
17472 LDKPublicKey countersignatory_payment_basepoint_ref;
17473 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
17474 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
17475 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17480 LDKInitFeatures orig_conv;
17481 orig_conv.inner = (void*)(orig & (~1));
17482 orig_conv.is_owned = false;
17483 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
17484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17486 long ret_ref = (long)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17494 LDKNodeFeatures orig_conv;
17495 orig_conv.inner = (void*)(orig & (~1));
17496 orig_conv.is_owned = false;
17497 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
17498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17500 long ret_ref = (long)ret_var.inner;
17501 if (ret_var.is_owned) {
17507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17508 LDKChannelFeatures orig_conv;
17509 orig_conv.inner = (void*)(orig & (~1));
17510 orig_conv.is_owned = false;
17511 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
17512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17514 long ret_ref = (long)ret_var.inner;
17515 if (ret_var.is_owned) {
17521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17522 LDKInitFeatures this_ptr_conv;
17523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17525 InitFeatures_free(this_ptr_conv);
17528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17529 LDKNodeFeatures this_ptr_conv;
17530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17532 NodeFeatures_free(this_ptr_conv);
17535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17536 LDKChannelFeatures this_ptr_conv;
17537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17538 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17539 ChannelFeatures_free(this_ptr_conv);
17542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
17543 LDKInitFeatures ret_var = InitFeatures_empty();
17544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17546 long ret_ref = (long)ret_var.inner;
17547 if (ret_var.is_owned) {
17553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
17554 LDKInitFeatures ret_var = InitFeatures_known();
17555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17557 long ret_ref = (long)ret_var.inner;
17558 if (ret_var.is_owned) {
17564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
17565 LDKNodeFeatures ret_var = NodeFeatures_empty();
17566 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17567 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17568 long ret_ref = (long)ret_var.inner;
17569 if (ret_var.is_owned) {
17575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
17576 LDKNodeFeatures ret_var = NodeFeatures_known();
17577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17579 long ret_ref = (long)ret_var.inner;
17580 if (ret_var.is_owned) {
17586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
17587 LDKChannelFeatures ret_var = ChannelFeatures_empty();
17588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17590 long ret_ref = (long)ret_var.inner;
17591 if (ret_var.is_owned) {
17597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
17598 LDKChannelFeatures ret_var = ChannelFeatures_known();
17599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17601 long ret_ref = (long)ret_var.inner;
17602 if (ret_var.is_owned) {
17608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
17609 LDKInitFeatures obj_conv;
17610 obj_conv.inner = (void*)(obj & (~1));
17611 obj_conv.is_owned = false;
17612 LDKCVec_u8Z arg_var = InitFeatures_write(&obj_conv);
17613 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17614 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17615 CVec_u8Z_free(arg_var);
17619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
17620 LDKNodeFeatures obj_conv;
17621 obj_conv.inner = (void*)(obj & (~1));
17622 obj_conv.is_owned = false;
17623 LDKCVec_u8Z arg_var = NodeFeatures_write(&obj_conv);
17624 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17625 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17626 CVec_u8Z_free(arg_var);
17630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
17631 LDKChannelFeatures obj_conv;
17632 obj_conv.inner = (void*)(obj & (~1));
17633 obj_conv.is_owned = false;
17634 LDKCVec_u8Z arg_var = ChannelFeatures_write(&obj_conv);
17635 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17636 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17637 CVec_u8Z_free(arg_var);
17641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17642 LDKu8slice ser_ref;
17643 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17644 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17645 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17646 *ret_conv = InitFeatures_read(ser_ref);
17647 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17648 return (long)ret_conv;
17651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17652 LDKu8slice ser_ref;
17653 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17654 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17655 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17656 *ret_conv = NodeFeatures_read(ser_ref);
17657 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17658 return (long)ret_conv;
17661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17662 LDKu8slice ser_ref;
17663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17665 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17666 *ret_conv = ChannelFeatures_read(ser_ref);
17667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17668 return (long)ret_conv;
17671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17672 LDKRouteHop this_ptr_conv;
17673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17675 RouteHop_free(this_ptr_conv);
17678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17679 LDKRouteHop this_ptr_conv;
17680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17681 this_ptr_conv.is_owned = false;
17682 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
17683 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
17687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17688 LDKRouteHop this_ptr_conv;
17689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17690 this_ptr_conv.is_owned = false;
17691 LDKPublicKey val_ref;
17692 CHECK((*env)->GetArrayLength(env, val) == 33);
17693 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17694 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
17697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
17698 LDKRouteHop this_ptr_conv;
17699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17700 this_ptr_conv.is_owned = false;
17701 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
17702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17704 long ret_ref = (long)ret_var.inner;
17705 if (ret_var.is_owned) {
17711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17712 LDKRouteHop this_ptr_conv;
17713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17714 this_ptr_conv.is_owned = false;
17715 LDKNodeFeatures val_conv;
17716 val_conv.inner = (void*)(val & (~1));
17717 val_conv.is_owned = (val & 1) || (val == 0);
17718 val_conv = NodeFeatures_clone(&val_conv);
17719 RouteHop_set_node_features(&this_ptr_conv, val_conv);
17722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17723 LDKRouteHop this_ptr_conv;
17724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17725 this_ptr_conv.is_owned = false;
17726 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
17730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17731 LDKRouteHop this_ptr_conv;
17732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17733 this_ptr_conv.is_owned = false;
17734 RouteHop_set_short_channel_id(&this_ptr_conv, val);
17737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
17738 LDKRouteHop this_ptr_conv;
17739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17740 this_ptr_conv.is_owned = false;
17741 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
17742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17744 long ret_ref = (long)ret_var.inner;
17745 if (ret_var.is_owned) {
17751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17752 LDKRouteHop this_ptr_conv;
17753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17754 this_ptr_conv.is_owned = false;
17755 LDKChannelFeatures val_conv;
17756 val_conv.inner = (void*)(val & (~1));
17757 val_conv.is_owned = (val & 1) || (val == 0);
17758 val_conv = ChannelFeatures_clone(&val_conv);
17759 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
17762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17763 LDKRouteHop this_ptr_conv;
17764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17765 this_ptr_conv.is_owned = false;
17766 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
17770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17771 LDKRouteHop this_ptr_conv;
17772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17773 this_ptr_conv.is_owned = false;
17774 RouteHop_set_fee_msat(&this_ptr_conv, val);
17777 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
17778 LDKRouteHop this_ptr_conv;
17779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17780 this_ptr_conv.is_owned = false;
17781 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
17785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17786 LDKRouteHop this_ptr_conv;
17787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17788 this_ptr_conv.is_owned = false;
17789 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
17792 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) {
17793 LDKPublicKey pubkey_arg_ref;
17794 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
17795 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
17796 LDKNodeFeatures node_features_arg_conv;
17797 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
17798 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
17799 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
17800 LDKChannelFeatures channel_features_arg_conv;
17801 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
17802 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
17803 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
17804 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);
17805 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17806 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17807 long ret_ref = (long)ret_var.inner;
17808 if (ret_var.is_owned) {
17814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17815 LDKRouteHop orig_conv;
17816 orig_conv.inner = (void*)(orig & (~1));
17817 orig_conv.is_owned = false;
17818 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
17819 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17820 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17821 long ret_ref = (long)ret_var.inner;
17822 if (ret_var.is_owned) {
17828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17829 LDKRoute this_ptr_conv;
17830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17832 Route_free(this_ptr_conv);
17835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17836 LDKRoute this_ptr_conv;
17837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17838 this_ptr_conv.is_owned = false;
17839 LDKCVec_CVec_RouteHopZZ val_constr;
17840 val_constr.datalen = (*env)->GetArrayLength(env, val);
17841 if (val_constr.datalen > 0)
17842 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17844 val_constr.data = NULL;
17845 for (size_t m = 0; m < val_constr.datalen; m++) {
17846 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
17847 LDKCVec_RouteHopZ arr_conv_12_constr;
17848 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
17849 if (arr_conv_12_constr.datalen > 0)
17850 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17852 arr_conv_12_constr.data = NULL;
17853 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
17854 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
17855 int64_t arr_conv_10 = arr_conv_12_vals[k];
17856 LDKRouteHop arr_conv_10_conv;
17857 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
17858 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
17859 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
17860 arr_conv_12_constr.data[k] = arr_conv_10_conv;
17862 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
17863 val_constr.data[m] = arr_conv_12_constr;
17865 Route_set_paths(&this_ptr_conv, val_constr);
17868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
17869 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
17870 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
17871 if (paths_arg_constr.datalen > 0)
17872 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17874 paths_arg_constr.data = NULL;
17875 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
17876 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
17877 LDKCVec_RouteHopZ arr_conv_12_constr;
17878 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
17879 if (arr_conv_12_constr.datalen > 0)
17880 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17882 arr_conv_12_constr.data = NULL;
17883 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
17884 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
17885 int64_t arr_conv_10 = arr_conv_12_vals[k];
17886 LDKRouteHop arr_conv_10_conv;
17887 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
17888 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
17889 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
17890 arr_conv_12_constr.data[k] = arr_conv_10_conv;
17892 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
17893 paths_arg_constr.data[m] = arr_conv_12_constr;
17895 LDKRoute ret_var = Route_new(paths_arg_constr);
17896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17898 long ret_ref = (long)ret_var.inner;
17899 if (ret_var.is_owned) {
17905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17906 LDKRoute orig_conv;
17907 orig_conv.inner = (void*)(orig & (~1));
17908 orig_conv.is_owned = false;
17909 LDKRoute ret_var = Route_clone(&orig_conv);
17910 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17911 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17912 long ret_ref = (long)ret_var.inner;
17913 if (ret_var.is_owned) {
17919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
17921 obj_conv.inner = (void*)(obj & (~1));
17922 obj_conv.is_owned = false;
17923 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
17924 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17925 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17926 CVec_u8Z_free(arg_var);
17930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17931 LDKu8slice ser_ref;
17932 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17933 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17934 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17935 *ret_conv = Route_read(ser_ref);
17936 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17937 return (long)ret_conv;
17940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17941 LDKRouteHint this_ptr_conv;
17942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17944 RouteHint_free(this_ptr_conv);
17947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17948 LDKRouteHint this_ptr_conv;
17949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17950 this_ptr_conv.is_owned = false;
17951 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
17952 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
17956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17957 LDKRouteHint this_ptr_conv;
17958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17959 this_ptr_conv.is_owned = false;
17960 LDKPublicKey val_ref;
17961 CHECK((*env)->GetArrayLength(env, val) == 33);
17962 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17963 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
17966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17967 LDKRouteHint this_ptr_conv;
17968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17969 this_ptr_conv.is_owned = false;
17970 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
17974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17975 LDKRouteHint this_ptr_conv;
17976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17977 this_ptr_conv.is_owned = false;
17978 RouteHint_set_short_channel_id(&this_ptr_conv, val);
17981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
17982 LDKRouteHint this_ptr_conv;
17983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17984 this_ptr_conv.is_owned = false;
17985 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
17986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17988 long ret_ref = (long)ret_var.inner;
17989 if (ret_var.is_owned) {
17995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17996 LDKRouteHint this_ptr_conv;
17997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17998 this_ptr_conv.is_owned = false;
17999 LDKRoutingFees val_conv;
18000 val_conv.inner = (void*)(val & (~1));
18001 val_conv.is_owned = (val & 1) || (val == 0);
18002 val_conv = RoutingFees_clone(&val_conv);
18003 RouteHint_set_fees(&this_ptr_conv, val_conv);
18006 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18007 LDKRouteHint this_ptr_conv;
18008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18009 this_ptr_conv.is_owned = false;
18010 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18015 LDKRouteHint this_ptr_conv;
18016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18017 this_ptr_conv.is_owned = false;
18018 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18022 LDKRouteHint this_ptr_conv;
18023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18024 this_ptr_conv.is_owned = false;
18025 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
18029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18030 LDKRouteHint this_ptr_conv;
18031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18032 this_ptr_conv.is_owned = false;
18033 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
18036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_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) {
18037 LDKPublicKey src_node_id_arg_ref;
18038 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
18039 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
18040 LDKRoutingFees fees_arg_conv;
18041 fees_arg_conv.inner = (void*)(fees_arg & (~1));
18042 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
18043 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
18044 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
18045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18047 long ret_ref = (long)ret_var.inner;
18048 if (ret_var.is_owned) {
18054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18055 LDKRouteHint orig_conv;
18056 orig_conv.inner = (void*)(orig & (~1));
18057 orig_conv.is_owned = false;
18058 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18059 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18060 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18061 long ret_ref = (long)ret_var.inner;
18062 if (ret_var.is_owned) {
18068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray target, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
18069 LDKPublicKey our_node_id_ref;
18070 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
18071 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
18072 LDKNetworkGraph network_conv;
18073 network_conv.inner = (void*)(network & (~1));
18074 network_conv.is_owned = false;
18075 LDKPublicKey target_ref;
18076 CHECK((*env)->GetArrayLength(env, target) == 33);
18077 (*env)->GetByteArrayRegion(env, target, 0, 33, target_ref.compressed_form);
18078 LDKCVec_ChannelDetailsZ first_hops_constr;
18079 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
18080 if (first_hops_constr.datalen > 0)
18081 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18083 first_hops_constr.data = NULL;
18084 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
18085 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18086 int64_t arr_conv_16 = first_hops_vals[q];
18087 LDKChannelDetails arr_conv_16_conv;
18088 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
18089 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
18090 first_hops_constr.data[q] = arr_conv_16_conv;
18092 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
18093 LDKCVec_RouteHintZ last_hops_constr;
18094 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
18095 if (last_hops_constr.datalen > 0)
18096 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
18098 last_hops_constr.data = NULL;
18099 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
18100 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
18101 int64_t arr_conv_11 = last_hops_vals[l];
18102 LDKRouteHint arr_conv_11_conv;
18103 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
18104 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
18105 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
18106 last_hops_constr.data[l] = arr_conv_11_conv;
18108 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
18109 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18110 if (logger_conv.free == LDKLogger_JCalls_free) {
18111 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18112 LDKLogger_JCalls_clone(logger_conv.this_arg);
18114 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18115 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
18116 FREE(first_hops_constr.data);
18117 return (long)ret_conv;
18120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18121 LDKNetworkGraph this_ptr_conv;
18122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18124 NetworkGraph_free(this_ptr_conv);
18127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18128 LDKLockedNetworkGraph this_ptr_conv;
18129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18131 LockedNetworkGraph_free(this_ptr_conv);
18134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18135 LDKNetGraphMsgHandler this_ptr_conv;
18136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18138 NetGraphMsgHandler_free(this_ptr_conv);
18141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
18142 LDKThirtyTwoBytes genesis_hash_ref;
18143 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
18144 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
18145 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18146 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18147 if (logger_conv.free == LDKLogger_JCalls_free) {
18148 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18149 LDKLogger_JCalls_clone(logger_conv.this_arg);
18151 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
18152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18154 long ret_ref = (long)ret_var.inner;
18155 if (ret_var.is_owned) {
18161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
18162 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18163 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18164 if (logger_conv.free == LDKLogger_JCalls_free) {
18165 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18166 LDKLogger_JCalls_clone(logger_conv.this_arg);
18168 LDKNetworkGraph network_graph_conv;
18169 network_graph_conv.inner = (void*)(network_graph & (~1));
18170 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
18171 // Warning: we need a move here but no clone is available for LDKNetworkGraph
18172 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
18173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18175 long ret_ref = (long)ret_var.inner;
18176 if (ret_var.is_owned) {
18182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
18183 LDKNetGraphMsgHandler this_arg_conv;
18184 this_arg_conv.inner = (void*)(this_arg & (~1));
18185 this_arg_conv.is_owned = false;
18186 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
18187 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18188 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18189 long ret_ref = (long)ret_var.inner;
18190 if (ret_var.is_owned) {
18196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
18197 LDKLockedNetworkGraph this_arg_conv;
18198 this_arg_conv.inner = (void*)(this_arg & (~1));
18199 this_arg_conv.is_owned = false;
18200 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
18201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18203 long ret_ref = (long)ret_var.inner;
18204 if (ret_var.is_owned) {
18210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
18211 LDKNetGraphMsgHandler this_arg_conv;
18212 this_arg_conv.inner = (void*)(this_arg & (~1));
18213 this_arg_conv.is_owned = false;
18214 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18215 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
18219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18220 LDKNetGraphMsgHandler this_arg_conv;
18221 this_arg_conv.inner = (void*)(this_arg & (~1));
18222 this_arg_conv.is_owned = false;
18223 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18224 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
18228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18229 LDKDirectionalChannelInfo this_ptr_conv;
18230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18232 DirectionalChannelInfo_free(this_ptr_conv);
18235 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
18236 LDKDirectionalChannelInfo this_ptr_conv;
18237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18238 this_ptr_conv.is_owned = false;
18239 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
18243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18244 LDKDirectionalChannelInfo this_ptr_conv;
18245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18246 this_ptr_conv.is_owned = false;
18247 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
18250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
18251 LDKDirectionalChannelInfo this_ptr_conv;
18252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18253 this_ptr_conv.is_owned = false;
18254 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
18258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18259 LDKDirectionalChannelInfo this_ptr_conv;
18260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18261 this_ptr_conv.is_owned = false;
18262 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
18265 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18266 LDKDirectionalChannelInfo this_ptr_conv;
18267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18268 this_ptr_conv.is_owned = false;
18269 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
18273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18274 LDKDirectionalChannelInfo this_ptr_conv;
18275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18276 this_ptr_conv.is_owned = false;
18277 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18281 LDKDirectionalChannelInfo this_ptr_conv;
18282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18283 this_ptr_conv.is_owned = false;
18284 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
18288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18289 LDKDirectionalChannelInfo this_ptr_conv;
18290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18291 this_ptr_conv.is_owned = false;
18292 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
18295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
18296 LDKDirectionalChannelInfo this_ptr_conv;
18297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18298 this_ptr_conv.is_owned = false;
18299 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
18300 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18301 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18302 long ret_ref = (long)ret_var.inner;
18303 if (ret_var.is_owned) {
18309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18310 LDKDirectionalChannelInfo this_ptr_conv;
18311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18312 this_ptr_conv.is_owned = false;
18313 LDKRoutingFees val_conv;
18314 val_conv.inner = (void*)(val & (~1));
18315 val_conv.is_owned = (val & 1) || (val == 0);
18316 val_conv = RoutingFees_clone(&val_conv);
18317 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
18320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
18321 LDKDirectionalChannelInfo this_ptr_conv;
18322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18323 this_ptr_conv.is_owned = false;
18324 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
18325 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18326 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18327 long ret_ref = (long)ret_var.inner;
18328 if (ret_var.is_owned) {
18334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18335 LDKDirectionalChannelInfo this_ptr_conv;
18336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18337 this_ptr_conv.is_owned = false;
18338 LDKChannelUpdate val_conv;
18339 val_conv.inner = (void*)(val & (~1));
18340 val_conv.is_owned = (val & 1) || (val == 0);
18341 val_conv = ChannelUpdate_clone(&val_conv);
18342 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
18345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18346 LDKDirectionalChannelInfo orig_conv;
18347 orig_conv.inner = (void*)(orig & (~1));
18348 orig_conv.is_owned = false;
18349 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
18350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18352 long ret_ref = (long)ret_var.inner;
18353 if (ret_var.is_owned) {
18359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
18360 LDKDirectionalChannelInfo obj_conv;
18361 obj_conv.inner = (void*)(obj & (~1));
18362 obj_conv.is_owned = false;
18363 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
18364 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18365 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18366 CVec_u8Z_free(arg_var);
18370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18371 LDKu8slice ser_ref;
18372 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18373 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18374 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
18375 *ret_conv = DirectionalChannelInfo_read(ser_ref);
18376 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18377 return (long)ret_conv;
18380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18381 LDKChannelInfo this_ptr_conv;
18382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18384 ChannelInfo_free(this_ptr_conv);
18387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18388 LDKChannelInfo this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
18392 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18393 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18394 long ret_ref = (long)ret_var.inner;
18395 if (ret_var.is_owned) {
18401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18402 LDKChannelInfo this_ptr_conv;
18403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18404 this_ptr_conv.is_owned = false;
18405 LDKChannelFeatures val_conv;
18406 val_conv.inner = (void*)(val & (~1));
18407 val_conv.is_owned = (val & 1) || (val == 0);
18408 val_conv = ChannelFeatures_clone(&val_conv);
18409 ChannelInfo_set_features(&this_ptr_conv, val_conv);
18412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
18413 LDKChannelInfo this_ptr_conv;
18414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18415 this_ptr_conv.is_owned = false;
18416 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
18417 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
18421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18422 LDKChannelInfo this_ptr_conv;
18423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18424 this_ptr_conv.is_owned = false;
18425 LDKPublicKey val_ref;
18426 CHECK((*env)->GetArrayLength(env, val) == 33);
18427 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18428 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
18431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
18432 LDKChannelInfo this_ptr_conv;
18433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18434 this_ptr_conv.is_owned = false;
18435 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
18436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18438 long ret_ref = (long)ret_var.inner;
18439 if (ret_var.is_owned) {
18445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18446 LDKChannelInfo this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 LDKDirectionalChannelInfo val_conv;
18450 val_conv.inner = (void*)(val & (~1));
18451 val_conv.is_owned = (val & 1) || (val == 0);
18452 val_conv = DirectionalChannelInfo_clone(&val_conv);
18453 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
18456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
18457 LDKChannelInfo this_ptr_conv;
18458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18459 this_ptr_conv.is_owned = false;
18460 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
18461 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
18465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18466 LDKChannelInfo this_ptr_conv;
18467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18468 this_ptr_conv.is_owned = false;
18469 LDKPublicKey val_ref;
18470 CHECK((*env)->GetArrayLength(env, val) == 33);
18471 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18472 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
18475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
18476 LDKChannelInfo this_ptr_conv;
18477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18478 this_ptr_conv.is_owned = false;
18479 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
18480 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18481 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18482 long ret_ref = (long)ret_var.inner;
18483 if (ret_var.is_owned) {
18489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18490 LDKChannelInfo this_ptr_conv;
18491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18492 this_ptr_conv.is_owned = false;
18493 LDKDirectionalChannelInfo val_conv;
18494 val_conv.inner = (void*)(val & (~1));
18495 val_conv.is_owned = (val & 1) || (val == 0);
18496 val_conv = DirectionalChannelInfo_clone(&val_conv);
18497 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
18500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
18501 LDKChannelInfo this_ptr_conv;
18502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18503 this_ptr_conv.is_owned = false;
18504 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
18505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18507 long ret_ref = (long)ret_var.inner;
18508 if (ret_var.is_owned) {
18514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18515 LDKChannelInfo this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 LDKChannelAnnouncement val_conv;
18519 val_conv.inner = (void*)(val & (~1));
18520 val_conv.is_owned = (val & 1) || (val == 0);
18521 val_conv = ChannelAnnouncement_clone(&val_conv);
18522 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
18525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
18526 LDKChannelInfo obj_conv;
18527 obj_conv.inner = (void*)(obj & (~1));
18528 obj_conv.is_owned = false;
18529 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
18530 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18531 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18532 CVec_u8Z_free(arg_var);
18536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18537 LDKu8slice ser_ref;
18538 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18539 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18540 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18541 *ret_conv = ChannelInfo_read(ser_ref);
18542 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18543 return (long)ret_conv;
18546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18547 LDKRoutingFees this_ptr_conv;
18548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18550 RoutingFees_free(this_ptr_conv);
18553 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18554 LDKRoutingFees this_ptr_conv;
18555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18556 this_ptr_conv.is_owned = false;
18557 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
18561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18562 LDKRoutingFees this_ptr_conv;
18563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18564 this_ptr_conv.is_owned = false;
18565 RoutingFees_set_base_msat(&this_ptr_conv, val);
18568 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18569 LDKRoutingFees this_ptr_conv;
18570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18571 this_ptr_conv.is_owned = false;
18572 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
18576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18577 LDKRoutingFees this_ptr_conv;
18578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18579 this_ptr_conv.is_owned = false;
18580 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
18583 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) {
18584 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
18585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18587 long ret_ref = (long)ret_var.inner;
18588 if (ret_var.is_owned) {
18594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18595 LDKRoutingFees orig_conv;
18596 orig_conv.inner = (void*)(orig & (~1));
18597 orig_conv.is_owned = false;
18598 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
18599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18601 long ret_ref = (long)ret_var.inner;
18602 if (ret_var.is_owned) {
18608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18609 LDKu8slice ser_ref;
18610 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18611 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18612 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18613 *ret_conv = RoutingFees_read(ser_ref);
18614 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18615 return (long)ret_conv;
18618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
18619 LDKRoutingFees obj_conv;
18620 obj_conv.inner = (void*)(obj & (~1));
18621 obj_conv.is_owned = false;
18622 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
18623 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18624 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18625 CVec_u8Z_free(arg_var);
18629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18630 LDKNodeAnnouncementInfo this_ptr_conv;
18631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18633 NodeAnnouncementInfo_free(this_ptr_conv);
18636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18637 LDKNodeAnnouncementInfo this_ptr_conv;
18638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18639 this_ptr_conv.is_owned = false;
18640 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
18641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18643 long ret_ref = (long)ret_var.inner;
18644 if (ret_var.is_owned) {
18650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18651 LDKNodeAnnouncementInfo this_ptr_conv;
18652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18653 this_ptr_conv.is_owned = false;
18654 LDKNodeFeatures val_conv;
18655 val_conv.inner = (void*)(val & (~1));
18656 val_conv.is_owned = (val & 1) || (val == 0);
18657 val_conv = NodeFeatures_clone(&val_conv);
18658 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
18661 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
18662 LDKNodeAnnouncementInfo this_ptr_conv;
18663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18664 this_ptr_conv.is_owned = false;
18665 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
18669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18670 LDKNodeAnnouncementInfo this_ptr_conv;
18671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18672 this_ptr_conv.is_owned = false;
18673 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
18676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18677 LDKNodeAnnouncementInfo this_ptr_conv;
18678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18679 this_ptr_conv.is_owned = false;
18680 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18681 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
18685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18686 LDKNodeAnnouncementInfo this_ptr_conv;
18687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18688 this_ptr_conv.is_owned = false;
18689 LDKThreeBytes val_ref;
18690 CHECK((*env)->GetArrayLength(env, val) == 3);
18691 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18692 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
18695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18696 LDKNodeAnnouncementInfo this_ptr_conv;
18697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18698 this_ptr_conv.is_owned = false;
18699 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18700 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
18704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18705 LDKNodeAnnouncementInfo this_ptr_conv;
18706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18707 this_ptr_conv.is_owned = false;
18708 LDKThirtyTwoBytes val_ref;
18709 CHECK((*env)->GetArrayLength(env, val) == 32);
18710 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18711 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
18714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18715 LDKNodeAnnouncementInfo this_ptr_conv;
18716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18717 this_ptr_conv.is_owned = false;
18718 LDKCVec_NetAddressZ val_constr;
18719 val_constr.datalen = (*env)->GetArrayLength(env, val);
18720 if (val_constr.datalen > 0)
18721 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18723 val_constr.data = NULL;
18724 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18725 for (size_t m = 0; m < val_constr.datalen; m++) {
18726 int64_t arr_conv_12 = val_vals[m];
18727 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
18728 FREE((void*)arr_conv_12);
18729 val_constr.data[m] = arr_conv_12_conv;
18731 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18732 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
18735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
18736 LDKNodeAnnouncementInfo this_ptr_conv;
18737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18738 this_ptr_conv.is_owned = false;
18739 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
18740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18742 long ret_ref = (long)ret_var.inner;
18743 if (ret_var.is_owned) {
18749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18750 LDKNodeAnnouncementInfo this_ptr_conv;
18751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18752 this_ptr_conv.is_owned = false;
18753 LDKNodeAnnouncement val_conv;
18754 val_conv.inner = (void*)(val & (~1));
18755 val_conv.is_owned = (val & 1) || (val == 0);
18756 val_conv = NodeAnnouncement_clone(&val_conv);
18757 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
18760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
18761 LDKNodeFeatures features_arg_conv;
18762 features_arg_conv.inner = (void*)(features_arg & (~1));
18763 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18764 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
18765 LDKThreeBytes rgb_arg_ref;
18766 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
18767 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
18768 LDKThirtyTwoBytes alias_arg_ref;
18769 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
18770 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
18771 LDKCVec_NetAddressZ addresses_arg_constr;
18772 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
18773 if (addresses_arg_constr.datalen > 0)
18774 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18776 addresses_arg_constr.data = NULL;
18777 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
18778 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
18779 int64_t arr_conv_12 = addresses_arg_vals[m];
18780 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
18781 FREE((void*)arr_conv_12);
18782 addresses_arg_constr.data[m] = arr_conv_12_conv;
18784 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
18785 LDKNodeAnnouncement announcement_message_arg_conv;
18786 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
18787 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
18788 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
18789 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
18790 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18791 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18792 long ret_ref = (long)ret_var.inner;
18793 if (ret_var.is_owned) {
18799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18800 LDKNodeAnnouncementInfo orig_conv;
18801 orig_conv.inner = (void*)(orig & (~1));
18802 orig_conv.is_owned = false;
18803 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
18804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18806 long ret_ref = (long)ret_var.inner;
18807 if (ret_var.is_owned) {
18813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
18814 LDKNodeAnnouncementInfo obj_conv;
18815 obj_conv.inner = (void*)(obj & (~1));
18816 obj_conv.is_owned = false;
18817 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
18818 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18819 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18820 CVec_u8Z_free(arg_var);
18824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18825 LDKu8slice ser_ref;
18826 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18827 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18828 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18829 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
18830 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18831 return (long)ret_conv;
18834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18835 LDKNodeInfo this_ptr_conv;
18836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18838 NodeInfo_free(this_ptr_conv);
18841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18842 LDKNodeInfo this_ptr_conv;
18843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18844 this_ptr_conv.is_owned = false;
18845 LDKCVec_u64Z val_constr;
18846 val_constr.datalen = (*env)->GetArrayLength(env, val);
18847 if (val_constr.datalen > 0)
18848 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18850 val_constr.data = NULL;
18851 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18852 for (size_t g = 0; g < val_constr.datalen; g++) {
18853 int64_t arr_conv_6 = val_vals[g];
18854 val_constr.data[g] = arr_conv_6;
18856 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18857 NodeInfo_set_channels(&this_ptr_conv, val_constr);
18860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
18861 LDKNodeInfo this_ptr_conv;
18862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18863 this_ptr_conv.is_owned = false;
18864 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
18865 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18866 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18867 long ret_ref = (long)ret_var.inner;
18868 if (ret_var.is_owned) {
18874 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) {
18875 LDKNodeInfo this_ptr_conv;
18876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18877 this_ptr_conv.is_owned = false;
18878 LDKRoutingFees val_conv;
18879 val_conv.inner = (void*)(val & (~1));
18880 val_conv.is_owned = (val & 1) || (val == 0);
18881 val_conv = RoutingFees_clone(&val_conv);
18882 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
18885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
18886 LDKNodeInfo this_ptr_conv;
18887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18888 this_ptr_conv.is_owned = false;
18889 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
18890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18892 long ret_ref = (long)ret_var.inner;
18893 if (ret_var.is_owned) {
18899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18900 LDKNodeInfo this_ptr_conv;
18901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18902 this_ptr_conv.is_owned = false;
18903 LDKNodeAnnouncementInfo val_conv;
18904 val_conv.inner = (void*)(val & (~1));
18905 val_conv.is_owned = (val & 1) || (val == 0);
18906 val_conv = NodeAnnouncementInfo_clone(&val_conv);
18907 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
18910 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) {
18911 LDKCVec_u64Z channels_arg_constr;
18912 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
18913 if (channels_arg_constr.datalen > 0)
18914 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18916 channels_arg_constr.data = NULL;
18917 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
18918 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
18919 int64_t arr_conv_6 = channels_arg_vals[g];
18920 channels_arg_constr.data[g] = arr_conv_6;
18922 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
18923 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
18924 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
18925 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
18926 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
18927 LDKNodeAnnouncementInfo announcement_info_arg_conv;
18928 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
18929 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
18930 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
18931 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
18932 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18933 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18934 long ret_ref = (long)ret_var.inner;
18935 if (ret_var.is_owned) {
18941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18942 LDKNodeInfo orig_conv;
18943 orig_conv.inner = (void*)(orig & (~1));
18944 orig_conv.is_owned = false;
18945 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
18946 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18947 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18948 long ret_ref = (long)ret_var.inner;
18949 if (ret_var.is_owned) {
18955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
18956 LDKNodeInfo obj_conv;
18957 obj_conv.inner = (void*)(obj & (~1));
18958 obj_conv.is_owned = false;
18959 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
18960 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18961 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18962 CVec_u8Z_free(arg_var);
18966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18967 LDKu8slice ser_ref;
18968 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18969 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18970 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18971 *ret_conv = NodeInfo_read(ser_ref);
18972 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18973 return (long)ret_conv;
18976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
18977 LDKNetworkGraph obj_conv;
18978 obj_conv.inner = (void*)(obj & (~1));
18979 obj_conv.is_owned = false;
18980 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
18981 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
18982 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
18983 CVec_u8Z_free(arg_var);
18987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18988 LDKu8slice ser_ref;
18989 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18990 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18991 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18992 *ret_conv = NetworkGraph_read(ser_ref);
18993 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18994 return (long)ret_conv;
18997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
18998 LDKThirtyTwoBytes genesis_hash_ref;
18999 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
19000 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
19001 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19004 long ret_ref = (long)ret_var.inner;
19005 if (ret_var.is_owned) {
19011 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) {
19012 LDKNetworkGraph this_arg_conv;
19013 this_arg_conv.inner = (void*)(this_arg & (~1));
19014 this_arg_conv.is_owned = false;
19015 LDKNodeAnnouncement msg_conv;
19016 msg_conv.inner = (void*)(msg & (~1));
19017 msg_conv.is_owned = false;
19018 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19019 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
19020 return (long)ret_conv;
19023 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) {
19024 LDKNetworkGraph this_arg_conv;
19025 this_arg_conv.inner = (void*)(this_arg & (~1));
19026 this_arg_conv.is_owned = false;
19027 LDKUnsignedNodeAnnouncement msg_conv;
19028 msg_conv.inner = (void*)(msg & (~1));
19029 msg_conv.is_owned = false;
19030 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19031 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
19032 return (long)ret_conv;
19035 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) {
19036 LDKNetworkGraph this_arg_conv;
19037 this_arg_conv.inner = (void*)(this_arg & (~1));
19038 this_arg_conv.is_owned = false;
19039 LDKChannelAnnouncement msg_conv;
19040 msg_conv.inner = (void*)(msg & (~1));
19041 msg_conv.is_owned = false;
19042 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19043 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19044 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
19045 return (long)ret_conv;
19048 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) {
19049 LDKNetworkGraph this_arg_conv;
19050 this_arg_conv.inner = (void*)(this_arg & (~1));
19051 this_arg_conv.is_owned = false;
19052 LDKUnsignedChannelAnnouncement msg_conv;
19053 msg_conv.inner = (void*)(msg & (~1));
19054 msg_conv.is_owned = false;
19055 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
19056 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19057 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
19058 return (long)ret_conv;
19061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
19062 LDKNetworkGraph this_arg_conv;
19063 this_arg_conv.inner = (void*)(this_arg & (~1));
19064 this_arg_conv.is_owned = false;
19065 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
19068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19069 LDKNetworkGraph this_arg_conv;
19070 this_arg_conv.inner = (void*)(this_arg & (~1));
19071 this_arg_conv.is_owned = false;
19072 LDKChannelUpdate msg_conv;
19073 msg_conv.inner = (void*)(msg & (~1));
19074 msg_conv.is_owned = false;
19075 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19076 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
19077 return (long)ret_conv;
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19081 LDKNetworkGraph this_arg_conv;
19082 this_arg_conv.inner = (void*)(this_arg & (~1));
19083 this_arg_conv.is_owned = false;
19084 LDKUnsignedChannelUpdate msg_conv;
19085 msg_conv.inner = (void*)(msg & (~1));
19086 msg_conv.is_owned = false;
19087 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19088 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
19089 return (long)ret_conv;